Class ComplexAmplitudeOperations
- Namespace
- VirtualLabAPI.Core.FieldRepresentations
- Assembly
- VirtualLabAPI.dll
Contains different operators for the manipulation of a ComplexAmplitude.
public static class ComplexAmplitudeOperations
- Inheritance
-
ComplexAmplitudeOperations
- Inherited Members
Methods
CoherentAddition(params ComplexAmplitude[])
Coherent addition of multiple fields.
public static ComplexAmplitude CoherentAddition(params ComplexAmplitude[] fields)
Parameters
fieldsComplexAmplitude[]The fields to sum up.
Returns
- ComplexAmplitude
The summed fields. For the result, wavelength, Jones vector etc. are taken from the first field.
Exceptions
- ArgumentException
At least two fields must be given for coherent addition. or All fields must be of type “Globally Polarized Harmonic Field” or “Angular Spectrum of Harmonic Field (Globally Polarized)”.
Combine(ComplexAmplitude, ComplexAmplitude)
Combines two one-dimensional ComplexAmplitudes into a two-dimensional one. \(P(x,y)=f_x(x) * f_y(y)\). If one of the one-dimensional ComplexField is complex then the resulting ComplexField is complex, else it is real.
public static ComplexAmplitude Combine(ComplexAmplitude caX, ComplexAmplitude caY)
Parameters
caXComplexAmplitudeOne-dimensional X field.
caYComplexAmplitudeOne-dimensional Y field.
Returns
- ComplexAmplitude
Resulting complex amplitude, which is only globally polarized if both input fields have the same Jones vector.
ComputeDeviation(ComplexAmplitude, ComplexAmplitude, bool, out double, out double, out Complex, InterpolationMethod)
Compute the absolute and relative deviation between two fields. The deviation between two harmonic fields is defined as the integral of the squared amplitudes of the difference field. The reference field prescribes the reference sampling and the reference medium for resampling. All four polarization combinations of both fields are allowed.
public static bool ComputeDeviation(ComplexAmplitude caArg, ComplexAmplitude caReference, bool applyComplexScalingFactor, out double relativeDeviation, out double absoluteDeviation, out Complex scalingFactor, InterpolationMethod interpolationMethod = InterpolationMethod.SincFFT)
Parameters
caArgComplexAmplitudeArgument field that is to be compared to the reference. Polarization may be arbitrary.
caReferenceComplexAmplitudeReference field. Polarization may be arbitrary.
applyComplexScalingFactorboolIf true, a optimal complex scaling factor is computed to scale the argument field prior to computing the deviation.
relativeDeviationdoubleRelative deviation that is being computed.
absoluteDeviationdoubleAbsolute deviation that is being computed.
scalingFactorComplexScaling factor that is being used.
interpolationMethodInterpolationMethodThe used interpolation method.
Returns
CreateRotationallySymmetricFieldFromCrossSection(ComplexAmplitude, SamplingParameters, InterpolationMethod)
Creates a rotationally symmetric field from a one-dimensional cross section.
public static ComplexAmplitude CreateRotationallySymmetricFieldFromCrossSection(ComplexAmplitude crossSection, SamplingParameters resultSampling, InterpolationMethod interpolationMethod = InterpolationMethod.Linear_AmplitudeAndPhase)
Parameters
crossSectionComplexAmplitudeThe cross section. It is assumed that the radius r = 0 is exactly at pixel 0.
resultSamplingSamplingParametersThe sampling the resulting field shall have.
interpolationMethodInterpolationMethodThe interpolation method to be used to interpolate between values for different radii. If this optional parameter is not specified, linear interpolation is used, which is suitable for transmissions and very fast.
Returns
- ComplexAmplitude
A rotationally symmetric field created from the cross section.
Exceptions
- ArgumentException
The cross section must be one-dimensional, i.e. it must contain only one sampling point in y-direction.
EvaluationRegionFromField(ComplexAmplitude, bool)
Generates an Evaluation Region / Optimization Region from the given field.
public static IRegion1D2D EvaluationRegionFromField(ComplexAmplitude field, bool evaluateEy = false)
Parameters
fieldComplexAmplitudeThe field from which a Evaluation Region shall be generated.
evaluateEyboolIf set to
truethe Ey component is evaluated for locally polarized fields. Otherwise the Ex component is evaluated for locally polarized fields.
Returns
- IRegion1D2D
A ComplexAmplitude object with the Evaluation Region. Returns null if the field is null.
FieldDeviation(ComplexAmplitude, ComplexAmplitude)
Help method to compare amplitude and phase of two harmonic fields. The results are stored into distinct subsets of a data array.
public static DataArrayBase FieldDeviation(ComplexAmplitude firstCA, ComplexAmplitude secondCA)
Parameters
firstCAComplexAmplitudeThe first harmonic field to compare.
secondCAComplexAmplitudeThe second harmonic field to compare.
Returns
- DataArrayBase
A data arrays with one subset storing the amplitude differences and one storing the phase differences. If any of the two fields is locally polarized, results for Ex and Ey are returned (in total 4 subsets).
Exceptions
- OperationNotSupportedException
Operation between 1d and 2d or 1d-x and 1d-y arrays is not defined.
FilterNoise(ComplexAmplitude, double)
Filters out numerical noise in the given harmonic field. This means that each pixel having an intensity below \(t \cdot I_{\text{max}}\) is set to zero. \(t\) is the give noise limit and \(I_{\text{max}}\) is the maximum intensity in the harmonic field. If the field is a locally polarized one, the filtering is done separately for the Ex and the Ey component, respectively.
public static ComplexAmplitude FilterNoise(ComplexAmplitude ca, double noiseLimit)
Parameters
caComplexAmplitudeThe harmonic field to filter.
noiseLimitdoubleThe noise limit \(t\).
Returns
- ComplexAmplitude
The filter harmonic field.
RemoveSampledLinearPhase(ComplexAmplitude, Vector3D, VectorD)
Method that removes a linear phase from the sampled complex values of one harmonic field
public static ComplexAmplitude RemoveSampledLinearPhase(ComplexAmplitude ca, Vector3D centralDirectionVector, VectorD referencePointForCentralDirection = default)
Parameters
caComplexAmplitudeHarmonic field to remove the linear phase from
centralDirectionVectorVector3DDirection vector that describes the linear phase
referencePointForCentralDirectionVectorDThe reference point for the central direction.
Returns
- ComplexAmplitude
Harmonic field, reduced by the given linear phase.
Exceptions
- ArgumentException
Information about the sign of k_z is inconsistent.
Separate(ComplexAmplitude, out ComplexAmplitude, out ComplexAmplitude)
Separates a globally or locally polarized two-dimensional ComplexAmplitude P(x,y) and returns the
x-component \(f_x(x)\) and the y-component \(f_y(y)\) as separated fields. If the field is separable, \(P(x,y)=f_x(x) * f_y(y)\) applies.
The separation is done by integrating of all rows and columns.
Note: This function does not check whether input field is separable.
public static void Separate(ComplexAmplitude ca, out ComplexAmplitude xField, out ComplexAmplitude yField)
Parameters
caComplexAmplitudeComplexAmplitude to be separated.
xFieldComplexAmplitudeSeparated x-field.
yFieldComplexAmplitudeSeparated y-field.
ToAngularCoordinates(ComplexAmplitude, CoordinateDefinitionType, VectorialComponent[], double, double)
Resamples a given Harmonic Field to angular coordinates.
public static DataArray2D ToAngularCoordinates(ComplexAmplitude inputField, CoordinateDefinitionType coordinateType, VectorialComponent[] vectorialComponents, double oversamplingFactorAngle1, double oversamplingFactorAngle2)
Parameters
inputFieldComplexAmplitudeThe field2convert.
coordinateTypeCoordinateDefinitionTypeType of the coordinate.
vectorialComponentsVectorialComponent[]The vectorial components.
oversamplingFactorAngle1doubleThe oversampling factor for either the Cartesian angle α or the spherical angle φ.
oversamplingFactorAngle2doubleThe oversampling factor for either the Cartesian angle β or the spherical angle ϑ.
Returns
- DataArray2D
The field in angular coordinates as Data Array.
Exceptions
- ArgumentException
No valid data given. or Conversion supports 2-dimensional data only. or Resulting sampling distances are numerically equal to zero.
- NotImplementedException
Case missing.