Class ComplexAmplitude
- Namespace
- VirtualLabAPI.Core.FieldRepresentations
- Assembly
- VirtualLabAPI.dll
This class represents a complex amplitude of a
wave (without time depending part) in a plane or a complex transmission function.
Both X and Y field components are stored. In general all functions are applied to both components.
This class is also used to represent globally polarized fields and transmissions.
It contains one or two ComplexField as mathematical representations for complex fields.
See manual for details of physical interpretation.
The ComplexAmplitude class can contain some additional information about
the radius (distance from the origin) of a spherical phase factor. Using this
information field may contain a spherical phase factor that is undersampled.
If the radius of the spherical phase factor is known, the whole complex amplitude
at every point can be reconstructed. The radius of the spherical phase factor
helps to reduce the number of sampling points. Functions that use the
ComplexAmplitude class have to take into account this spherical
phase information to avoid numerical errors.
Operators (\(a+b\), \(a-b\), \(a*b\) and \(a/b\)) can be used.
Passing \(a\) or \(b\) as Complex is supported.
\(a^b\) can be applied for pointwise power function: \(a[x,y] ^ b\) \(b\) must be Complex.
Operator \(a|b\) is used for calculation of inner product of two Complex Amplitudes:
\(a|b=\sum _{j=0}^{m}\sum _{i=0}^{n}a_{{i,j}}b_{{i,j}^{\star}}\) (\(z^{\star}\) means conjugation of complex number).
[Serializable]
public class ComplexAmplitude : HarmonicFieldBase, IDeserializationCallback, IDisposable, IDocument, IEquatable<IObjectBase>, ICloneable, ISerializable, IProvidesPositioningReferences
- Inheritance
-
ObjectBaseSerializableObjectBaseManualSerializationComplexAmplitude
- Implements
-
IEquatable<IObjectBase>
- Inherited Members
- Extension Methods
Constructors
ComplexAmplitude()
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and 3×3 sampling points.
public ComplexAmplitude()
ComplexAmplitude(ComplexAmplitude)
Creates a clone of the given complex amplitude.
public ComplexAmplitude(ComplexAmplitude ca)
Parameters
caComplexAmplitudeThe complex amplitude to be cloned.
ComplexAmplitude(ComplexField)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and the given ComplexField.
public ComplexAmplitude(ComplexField field)
Parameters
fieldComplexFieldComplex field used for initialization.
ComplexAmplitude(ComplexField, ComplexField)
Constructs a locally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and given Ex and Ey component.
public ComplexAmplitude(ComplexField xField, ComplexField yField)
Parameters
xFieldComplexFieldEx component complex field.
yFieldComplexFieldEy component complex field.
ComplexAmplitude(SamplingParameters, bool, bool)
Constructs a globally polarized ComplexAmplitude using the default wavelength from the GlobalOptions and given SamplingParameters.
public ComplexAmplitude(SamplingParameters samplingParameters, bool IsComplex, bool initializeValues = true)
Parameters
samplingParametersSamplingParametersSampling parameter of constructed field.
IsComplexboolIf true real and imaginary part are stored. If false only the real part is stored.
initializeValuesboolIf this optional parameter is set to false, the field values are not initialized. Should be used only if the values are initialized immediately afterwards, but then performance is better.
ComplexAmplitude(SamplingParameters, PrecisionMode, bool, bool)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions, and given SamplingParameters.
public ComplexAmplitude(SamplingParameters samplingParameters, PrecisionMode precision, bool IsComplex, bool initializeValues = true)
Parameters
samplingParametersSamplingParametersSampling parameter of constructed field.
precisionPrecisionModeObsolete parameter.
IsComplexboolIf true real and imaginary part are stored. Else only the real part is stored.
initializeValuesboolIf this optional parameter is set to false, the field values are not initialized. Should be used only if the values are initialized immediately afterwards, but then performance is better.
ComplexAmplitude(SamplingParameters, PrecisionMode, bool, Func<double, double, double>, ParallelizationType)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions, and given SamplingParameters. Sampling points are initialized using given real function.
public ComplexAmplitude(SamplingParameters samplingParameters, PrecisionMode precision, bool IsComplex, Func<double, double, double> f, ParallelizationType parallelizationType = ParallelizationType.AutomaticMeasure)
Parameters
samplingParametersSamplingParametersSampling parameter of constructed field.
precisionPrecisionModeObsolete and unused parameter.
IsComplexboolIf true real and imaginary part are stored but the imaginary part is zero because f is a real function. If false only the real part is stored.
fFunc<double, double, double>A method returning a double (the real part) and having two doubles (the physical coordinates) as input parameter.
parallelizationTypeParallelizationTypeType of the parallelization. Set it to ParallelizationType.NoParallelization if the method passed by the function delegate is not thread-safe. Otherwise you can choose of the remaining parallelization types (ParallelizationType.AutomaticMeasure is the default).
ComplexAmplitude(SamplingParameters, PrecisionMode, Func<double, double, Complex>, ParallelizationType)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions,
and given SamplingParameters. Sampling points are initialized using given complex function.
The point (0 m; 0 m) will be placed in the center of the field.
public ComplexAmplitude(SamplingParameters samplingParameters, PrecisionMode precision, Func<double, double, Complex> f, ParallelizationType parallelizationType = ParallelizationType.AutomaticMeasure)
Parameters
samplingParametersSamplingParametersSampling parameters of constructed field.
precisionPrecisionModeObsolete and unused parameter.
fFunc<double, double, Complex>A method returning a Complex (the field value) and having two doubles (the physical coordinates) as input parameter.
parallelizationTypeParallelizationTypeType of the parallelization. Set it to ParallelizationType.NoParallelization if the method passed by the function delegate is not thread-safe. Otherwise you can choose of the remaining parallelization types (ParallelizationType.AutomaticMeasure is the default).
ComplexAmplitude(Vector, bool)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and the given number of sampling points.
public ComplexAmplitude(Vector SamplingPoints, bool initializeValues = true)
Parameters
SamplingPointsVectorNumber of sampling points.
initializeValuesboolIf this optional parameter is set to
false, the field values are not initialized. Should be used only if the values are initialized immediately afterwards, but then performance is better.
ComplexAmplitude(Vector, Complex)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and given number of sampling points. All sampling points are set to the given complex number.
public ComplexAmplitude(Vector SamplingPoints, Complex c)
Parameters
SamplingPointsVectorNumber of sampling points.
cComplexComplex value all points are initialized to.
ComplexAmplitude(HomogeneousMedium)
Constructs a globally polarized ComplexAmplitude using the wavelength defined in the GlobalOptions and 3×3 sampling points.
public ComplexAmplitude(HomogeneousMedium embeddingMedium)
Parameters
embeddingMediumHomogeneousMediumThe embedding medium of the complex amplitude.
Fields
SamplingDistance
Distance between sampling points in meters.
public VectorD SamplingDistance
Field Value
_sphericalFactorIsRemoved
indicates whether a spherical factor has been removed from the sampled data
protected bool _sphericalFactorIsRemoved
Field Value
hasSphericalPhaseRadius
Shows if there are some additionally information about the distance of a spherical phase factor from its origin.
protected bool hasSphericalPhaseRadius
Field Value
hasWaveParameters
If true then the object contains the additional wave parameters like waist width, distance from waist and Rayleigh length for both axis. This parameters are necessary for the propagation. This parameter can be only true if the type is HarmonicFieldComponent.
[NonSerialized]
protected bool hasWaveParameters
Field Value
sphericalPhaseRadius
If there are additional information about the spherical phase (HasSphericalPhaseRadius is true) then this variable contains the radius (this is the distance from the origin) of the spherical phase.
protected double sphericalPhaseRadius
Field Value
wavelength
Wavelength in meters.
protected double wavelength
Field Value
Properties
CentralDirection
Get and set the central direction of the field. This means a normalized Vector3D which represents an analytically stored global linear phase. If the linear phase information is represented by this CentralDirection vector, it does not have to be sampled on the data which may reduce the sampling effort. The x and y component of the vector are related to k_x and k_y of the field while the sign of its z component is related to the flag PropagatesInPositiveZDirection.
public Vector3D CentralDirection { get; set; }
Property Value
ComplexAmplitudeType
Gets and sets the ComplexAmplitudeType (globally or locally polarized field, transmission, and so on) of this ComplexAmplitude object.
public ComplexAmplitudeType ComplexAmplitudeType { get; set; }
Property Value
CoordinateOffset
Offset of the physical sampling point coordinates.
public VectorD CoordinateOffset { get; set; }
Property Value
Field
The complex field containing the scalar field of the globally polarized complex amplitude. In case of a locally polarized ComplexAmplitude, the Ex component is returned on get access. (Set access will raise an exception.)
public ComplexField Field { get; set; }
Property Value
FieldRepresentation
Returns field representation of this ComplexAmplitude.
public override FieldRepresentation FieldRepresentation { get; }
Property Value
- FieldRepresentation
The field representation (globally or locally polarized field).
FieldX
The complex field containing the Ex component of the complex amplitude.
public ComplexField FieldX { get; set; }
Property Value
FieldY
The complex field containing the Ey component of the complex amplitude. In case of globally polarized ComplexAmplitude using this property will throw an exception.
public ComplexField FieldY { get; set; }
Property Value
FileExtension
File extension
public override string FileExtension { get; }
Property Value
HasSphericalPhaseRadius
Indicates whether there are additionally information about the distance of a spherical phase factor from its origin. The default setting after the initialization of a new complex amplitude is false.
public bool HasSphericalPhaseRadius { get; set; }
Property Value
IsComplexAmplitudeField
Returns true if complex amplitudes represents a complex amplitude.
public bool IsComplexAmplitudeField { get; }
Property Value
IsGloballyPolarizedField
Gets whether this instance represents a globally polarized field.
public bool IsGloballyPolarizedField { get; }
Property Value
IsLocallyPolarized
Returns true if complex amplitude is locally polarized.
public bool IsLocallyPolarized { get; }
Property Value
IsPeriodic
Specifies whether this complex amplitude is a periodic field or transmission.
public bool IsPeriodic { get; set; }
Property Value
IsSpatial
Gets and sets whether the complex amplitudes are in spatial domain.
public override bool IsSpatial { get; set; }
Property Value
IsSpectral
Gets and sets whether the complex amplitudes are in spectral domain.
public bool IsSpectral { get; set; }
Property Value
IsTransmission
Returns true if this complex amplitude represents a transmission.
public bool IsTransmission { get; }
Property Value
this[int, int, bool]
Gets or sets a Complex value on the specified position in the complex amplitude. The coordinate system of x and y is the same like for a ComplexField.
public Complex this[int x, int y, bool accessFieldY] { get; set; }
Parameters
xintX position in pixels.
yintY position in pixels.
accessFieldYboolIf this parameter is true, the Ey component is accessed by the indexer. This is allowed for locally polarized ComplexAmplitudes only. If it is false, then the Ex component is accessed. For globally polarized ComplexAmplitudes this parameter has to be always false.
Property Value
- Complex
Complex value at position (x, y).
JonesMatrix
Jones matrix for transmissions.
public Matrix2x2C JonesMatrix { get; set; }
Property Value
JonesVector
Jones vector for globally polarized complex amplitude fields
public VectorC JonesVector { get; set; }
Property Value
LinearPhaseFunction
Function that describes the linear phase (in geometrical values). Important: The coefficients have to refer to the geometric distances instead of the phase values. That means the parameters have the meaning of k_x/k and k_y/k resp. (with k = 2π⋅n/λ). Calculating phase values require a multiplication with k = 2π⋅n/λ.
public LinearFunction LinearPhaseFunction { get; set; }
Property Value
- LinearFunction
MeasuredQuantityOfCoordinates
Gets the measured quantity of the coordinates (depends on the IsSpatial flag).
public MeasuredQuantity MeasuredQuantityOfCoordinates { get; }
Property Value
- MeasuredQuantity
MeasuredQuantityOfFieldData
Gets the measured quantity of the field data (depends on the type of the complex amplitude).
public MeasuredQuantity MeasuredQuantityOfFieldData { get; }
Property Value
- MeasuredQuantity
Medium
Property to get the medium the field is located in.
public HomogeneousMedium Medium { get; }
Property Value
MediumWavelength
Gets the medium wavelength of this ComplexAmplitude.
public double MediumWavelength { get; }
Property Value
PropagatesInPositiveZDirection
Is the sign of the z-component of the k-vector positive or not. This flag has meaning for harmonic fields only.
public override bool PropagatesInPositiveZDirection { get; set; }
Property Value
QuadraticPhaseFunction
Public property to set and get the off-axis quadratic wave. Important: The coefficients have to refer to the geometric distances instead of the phase values. So the representation of a spherical wave with phase radius R would be (1/2R)*x^2 + (1/2R)*y^2 + R. Calculating phase values would require a multiplication with k = 2π⋅n/λ.
public QuadraticFunction QuadraticPhaseFunction { get; set; }
Property Value
- QuadraticFunction
RefractiveIndex
Gets the complex refractive index of the embedding medium in which the ComplexAmplitude is defined.
public Complex RefractiveIndex { get; }
Property Value
SamplingDistanceOneD
Gets or sets sampling distance of a one-dimensional ComplexAmplitude.
public double SamplingDistanceOneD { get; set; }
Property Value
SamplingParameters
Sets and gets the sampling parameters of this ComplexAmplitude which include sampling distance and number of sampling points. Modification of this property performs equal to changing the parameters using the SamplingDistance and SamplingPoints properties.
public SamplingParameters SamplingParameters { get; set; }
Property Value
SamplingPoints
Number of sampling points of current complex amplitude. Setting a new number of sampling points will embed the sampling points in zero samples or extract the central samples.
public Vector SamplingPoints { get; set; }
Property Value
SamplingPointsOneD
Number of sampling points of one-dimensional field. An exception will be thrown if the field is two-dimensional.
public int SamplingPointsOneD { get; }
Property Value
SphericalPhaseRadius
If there is additional information about the spherical phase
(HasSphericalPhaseRadius is true) this property returns
the radius of the spherical equiphase surfaces,
which is equal to the distance from the definition plane of this
ComplexAmplitude to the center of the spherical wave front.
If HasSphericalPhaseRadius is false, radius = Double.MaxValue is
returned. This is similar to an infinite radius. Setting this
property in case HasSphericalPhaseRadius is false will switch
HasSphericalPhaseRadius to true.
This property stores the information about an analytical spherical phase
factor only, in order to reconstruct the complex amplitude, even if it is undersampled.
Changing the spherical phase radius will have no effect on the sampled data but maybe an
error free reconstruction of the complete complex amplitude will be impossible.
To change the sampled spherical phase factor and the stored spherical phase radius
at once use the functions MultiplySphericalPhaseFactor(double, CancellationToken?) and
RemoveSphericalPhaseFactor(CancellationToken?) instead.
public double SphericalPhaseRadius { get; set; }
Property Value
Exceptions
- ArgumentException
Thrown if the spherical phase radius is set to zero.
TypeOfDocument
Gets the type of the document. For a ComplexAmplitude, this depends on the ComplexAmplitudeType: either JonesMatrixTransmission or HarmonicFieldsSet.
public override DocumentType TypeOfDocument { get; }
Property Value
- DocumentType
Wavelength
Sets or gets the vacuum wavelength of this ComplexAmplitude.
public double Wavelength { get; set; }
Property Value
Methods
AddEqual(ComplexAmplitude)
Adds a given ComplexAmplitude to this one taking into account the spherical phase radius. The result is stored in this ComplexAmplitude. Both operands must have same number of sampling points. Other parameters like sampling distance or wavelength will not be changed.
public void AddEqual(ComplexAmplitude ca)
Parameters
caComplexAmplitudeComplexAmplitude to be added to current one.
AddEqual(Complex)
Adds a complex number to this ComplexAmplitude.
public void AddEqual(Complex c)
Parameters
cComplexComplex number to be added.
AddWithResampling(ComplexAmplitude, ComplexAmplitude, InterpolationMethod, InterpolationMethod)
Checks both ComplexAmplitude operands for identical sampling parameters, does the interpolation if one or both operands have to be resampled, then the second ComplexAmplitude is added to the first ComplexAmplitude.
public static ComplexAmplitude AddWithResampling(ComplexAmplitude cac1, ComplexAmplitude cac2, InterpolationMethod method1, InterpolationMethod method2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand.
cac2ComplexAmplitudeSecond ComplexAmplitude operand.
method1InterpolationMethodHow to interpolate 1. operand, if it is a transmission
method2InterpolationMethodHow to interpolate 2. operand, if it is a transmission
Returns
- ComplexAmplitude
The resulting harmonic field.
ApplyAnalyticallyLinearPhaseToDataPoints_withoutResampling(CancellationToken)
public support method to apply the analytically linear phase value onto the data points
public void ApplyAnalyticallyLinearPhaseToDataPoints_withoutResampling(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token for cooperative task cancellation.
ApplyAnalyticallyQuadraticPhaseToDataPoints_withoutResampling(CancellationToken, bool)
public support method to apply the analytically quadratic phase value onto the data points
public void ApplyAnalyticallyQuadraticPhaseToDataPoints_withoutResampling(CancellationToken cancellationToken, bool enableAnalyticalLinearPhaseResultingFromOffset = false)
Parameters
cancellationTokenCancellationTokenThe token for cooperative task cancellation.
enableAnalyticalLinearPhaseResultingFromOffsetboolIf true, the underlying CA may contain an additional analytical linear phase, which results from the quadratic phase if there is a lateral offset.
ApplyAperture(eApertureShape, double)
Applies an aperture function to the Complex Amplitude.
public void ApplyAperture(BasicParameter.eApertureShape shape, double absoluteEdgeWidth)
Parameters
shapeBasicParameter.eApertureShapeThe shape of the aperture to be applied.
absoluteEdgeWidthdoubleThe absolute edge width to be applied.
ChangeFieldRepresentation(bool)
Changes field representation of this ComplexAmplitude, i.e. whether the field is complex.
public void ChangeFieldRepresentation(bool isComplex)
Parameters
isComplexboolWhether this ComplexAmplitude should be changed to complex-valued data (true) or to real-valued data false.
ClipAmplitude(double)
Sets all amplitude values of this ComplexAmplitude greater than the clippingLevel to the clippingLevel.
public void ClipAmplitude(double clippingLevel)
Parameters
clippingLeveldoubleMaximal value of amplitude.
Clone()
Clones this ComplexAmplitude.
public override object Clone()
Returns
- object
A deep copy of this complex amplitude.
Conjugate()
Conjugates this ComplexAmplitude.
public void Conjugate()
ConvertToLocallyPolarizedField()
Converts this instance to a locally polarized field (if this is not already the case).
public void ConvertToLocallyPolarizedField()
ConvoluteWithResampling(ComplexAmplitude, ComplexAmplitude, InterpolationMethod, InterpolationMethod)
Checks both ComplexAmplitude operands for identical sampling parameters, does the interpolation if one or both operands have to be resampled, then the convolution of both ComplexAmplitude operands is performed.
public static ComplexAmplitude ConvoluteWithResampling(ComplexAmplitude cac1, ComplexAmplitude cac2, InterpolationMethod method1, InterpolationMethod method2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand.
cac2ComplexAmplitudeSecond ComplexAmplitude operand.
method1InterpolationMethodHow to interpolate 1. operand, if it is a transmission.
method2InterpolationMethodHow to interpolate 2. operand, if it is a transmission.
Returns
- ComplexAmplitude
The resulting harmonic field.
Convolution(ComplexAmplitude, ComplexAmplitude)
Returns convolution of \(a\) and \(b\): Convolute(a, b) := ℱ⁻¹(ℱ(a) ⋅ ℱ(b)).
public static ComplexAmplitude Convolution(ComplexAmplitude cac1, ComplexAmplitude cac2)
Parameters
cac1ComplexAmplitudeOperator \(a\).
cac2ComplexAmplitudeOperator \(b\).
Returns
- ComplexAmplitude
Result of operation.
DefaultField(ComplexAmplitudeType)
Gets a default field which can be used e.g. as initial value for both the Stored Lateral Field and Stored Complete Field light source.
public static ComplexAmplitude DefaultField(ComplexAmplitudeType fieldType = ComplexAmplitudeType.GloballyPolSpatialComplexAmplitudeField)
Parameters
fieldTypeComplexAmplitudeTypeOptional type of the field (transmission, spatial harmonic field and so on). If not specified, a globally polarized spatial field is generated. In case of a transmission a periodic transmission is returned.
Returns
- ComplexAmplitude
A field with 5 × 5 sampling points and the given type.
DivEqual(ComplexAmplitude)
Divides this ComplexAmplitude by the given one taking into account the spherical phase radius. The result is stored in this ComplexAmplitude. Both operands must have same number of sampling points. Other parameters like sampling distance or wavelength will not be changed.
public void DivEqual(ComplexAmplitude ca)
Parameters
caComplexAmplitudeThe ComplexAmplitude this one is divided by.
DivEqual(Complex)
Divides this ComplexAmplitude by given complex number.
public void DivEqual(Complex c)
Parameters
cComplexComplex number this ComplexAmplitude is to be divided by.
DivideWithResampling(ComplexAmplitude, ComplexAmplitude, InterpolationMethod, InterpolationMethod)
Checks both ComplexAmplitude operands for identical sampling parameters, does the interpolation if one or both operands have to be resampled, then the first ComplexAmplitude is divided by the second ComplexAmplitude.
public static ComplexAmplitude DivideWithResampling(ComplexAmplitude cac1, ComplexAmplitude cac2, InterpolationMethod method1, InterpolationMethod method2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand (dividend).
cac2ComplexAmplitudeSecond ComplexAmplitude operand (divisor).
method1InterpolationMethodHow to interpolate 1. operand, if it is a transmission.
method2InterpolationMethodHow to interpolate 2. operand, if it is a transmission.
Returns
- ComplexAmplitude
The resulting harmonic field.
EmbedCorner(Vector)
This ComplexAmplitude is embedded into sampling points having the value zero so that the resulting size is twice the original size. In contrast to the EmbedExtract(Vector) method, this method places the original field in the bottom left quadrant of the changed field, not in the center.
public void EmbedCorner(Vector newSize)
Parameters
newSizeVectorNew size in pixels.
EmbedExtract()
This ComplexAmplitude is embedded centrically into sampling points having the value zero so that the resulting size is twice the original size.
public void EmbedExtract()
EmbedExtract(Rectangle)
Embeds current complex amplitude into the given rectangle.
public ComplexAmplitude EmbedExtract(Rectangle rectangle)
Parameters
rectangleRectangleRegion to extract. Pixels outside of this ComplexAmplitude are set to zero.
Returns
- ComplexAmplitude
Modified ComplexAmplitude.
EmbedExtract(Vector)
Changes this ComplexAmplitude to the given size.
public void EmbedExtract(Vector newSize)
Parameters
newSizeVectorNew size in pixels. If the new size is larger than the original number of sampling points, the field is embedded centrically into sampling points having the value zero. If the size is smaller than the the original number of sampling points, the central region of the field is extracted.
Equals(object, EqualityIntent)
Determines whether the specified object is equal to this instance.
public override bool Equals(object otherObject, EqualityIntent equalityIntent)
Parameters
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.
Returns
Extract(Vector, Vector)
Extracts the defined piece from this ComplexAmplitude.
public ComplexAmplitude Extract(Vector size, Vector position)
Parameters
sizeVectorThe size of the region to extract in pixels.
positionVectorThe zero-position of the region to extract in pixel coordinates.
Returns
- ComplexAmplitude
Extracted region as a new ComplexAmplitude.
ExtractColumn(int, bool)
Extracts a column from this ComplexAmplitude.
public ComplexAmplitude ExtractColumn(int colIndex, bool considerSphericalPhase)
Parameters
colIndexintindex of the column to extract in pixel coordinates.
considerSphericalPhasebooltrue: The analytical spherical phase factor is sampled in the resulting field. false: The analytical spherical phase factor is not present in the resulting field.
Returns
- ComplexAmplitude
Extracted column as a new ComplexAmplitude.
ExtractComplexValue(VectorD, VectorialComponent)
Public method to get a complex value for a defined physical position for a specified vectorial component.
public Complex ExtractComplexValue(VectorD position, VectorialComponent comp)
Parameters
positionVectorDThe position where the value has to be extracted.
compVectorialComponentThe vectorial component which shall be used.
Returns
- Complex
The complex value on the defined position.
ExtractDiagonal(double)
Extracts data from a diagonal line right through the center of this ComplexAmplitude.
public ComplexAmplitude ExtractDiagonal(double alpha)
Parameters
alphadoubleThe orientation angle of the diagonal line in radians. A angle of zero means that a line in x-direction is extracted. An angle of \(\frac{\pi}{2}\) means that a line in y-direction is extracted.
Returns
- ComplexAmplitude
Extracted data as new one-dimensional ComplexAmplitude.
ExtractRow(int, bool)
Extracts a row from this ComplexAmplitude.
public ComplexAmplitude ExtractRow(int rowIndex, bool considerSphericalPhase)
Parameters
rowIndexintindex of the row to extract in pixel coordinates.
considerSphericalPhasebooltrue: The analytical spherical phase factor is sampled in the resulting field. false: The analytical spherical phase factor is not present in the resulting field.
Returns
- ComplexAmplitude
Extracted row as a new one-dimensional ComplexAmplitude.
Fill(Complex)
Sets all pixels of this ComplexAmplitude to the given complex value.
public void Fill(Complex c)
Parameters
cComplexComplex value to fill the field with.
Fill(Complex, Rectangle, bool)
Sets all pixels of this ComplexAmplitude to the given complex value.
public void Fill(Complex c, Rectangle marker, bool inside)
Parameters
cComplexComplex value to fill the field with.
markerRectangleMarker that decides where to fill.
insideboolFill inside or outside of the marker.
GetAnalyticLinearPhaseValueAtPosition(double, double)
Function to get the complex value of the analytic linear phase at a specific position.
public Complex GetAnalyticLinearPhaseValueAtPosition(double x, double y)
Parameters
Returns
- Complex
The complex value for the analytically stored linear phase at the specified position.
GetAnalyticLinearPhaseValueAtPosition(VectorD)
Function to get the complex value of the analytic linear phase at a specific position.
public Complex GetAnalyticLinearPhaseValueAtPosition(VectorD position)
Parameters
positionVectorDThe position where the linear phase should be evaluated.
Returns
- Complex
The complex value for the analytically stored linear phase at the specified position.
GetFields()
Gets all member fields in the harmonic field.
public override IEnumerable<ComplexAmplitude> GetFields()
Returns
- IEnumerable<ComplexAmplitude>
Collection of the member fields.
GetLocalFieldVector(int, int)
Gets the field vector (Ex; Ey) at a certain position (x; y) in pixels. Only works for Harmonic Fields, not Transmissions.
public VectorC GetLocalFieldVector(int x, int y)
Parameters
Returns
- VectorC
The local field vector (Ex; Ey).
HorizontalMirror_physicalCoordinates()
Performs a horizontal mirroring of this ComplexAmplitude. The physical coordinate origin is maintained.
public void HorizontalMirror_physicalCoordinates()
HorizontalMirror_pixelCoordinates()
Performs a horizontal mirroring of this ComplexAmplitude. \([SamplingPoints.X - x - 1, y] = [x, y]\)
public void HorizontalMirror_pixelCoordinates()
Insert(ComplexAmplitude, Vector)
Inserts the given ComplexAmplitude into this ComplexAmplitude at the given position. Points exceeding boundaries will be ignored.
public void Insert(ComplexAmplitude ca, Vector position)
Parameters
caComplexAmplitudeComplex amplitude to be inserted.
positionVectorPosition at which the field is to be inserted.
JonesMatrixMultiplication(Matrix2x2C)
Multiplies a ComplexAmplitude with a Matrix2x2C.
public ComplexAmplitude JonesMatrixMultiplication(Matrix2x2C m)
Parameters
mMatrix2x2CThe complex transformation matrix.
Returns
- ComplexAmplitude
ComplexAmplitude multiplied with the given matrix.
LiftPositive()
Lifts complex amplitude to positive. See also LiftPositive().
public void LiftPositive()
Load(string)
Loads the specified file name. Works independently from whether the document has been saved without view settings (as prior to VirtualLab 6.0) or with view settings.
public static ComplexAmplitude Load(string fileName)
Parameters
fileNamestringName of the file.
Returns
- ComplexAmplitude
The specified document.
ModifyComplexPart(ComplexPart, bool)
Extracts, shifts or swaps complex part of this ComplexAmplitude.
public void ModifyComplexPart(ComplexPart complexPart, bool makeRealValuedIfSuitable = false)
Parameters
complexPartComplexPartComplexPart enum defining the desired action.
makeRealValuedIfSuitableboolIf this optional parameter is set to true the field is made real-valued if the imaginary part is zeroized. This is e.g. the case for “extract amplitude” and “shift phase to real”.
MultEqual(ComplexAmplitude)
Multiplies the given ComplexAmplitude with this one taking into account the spherical phase radius. The result is stored in this ComplexAmplitude. Both operands must have same number of sampling points. Other parameters like sampling distance or wavelength will not be changed.
public void MultEqual(ComplexAmplitude ca)
Parameters
caComplexAmplitudeComplexAmplitude to be multiplied with current one.
MultEqual(Complex)
Multiplies a complex number to this ComplexAmplitude.
public void MultEqual(Complex c)
Parameters
cComplexComplex number to be multiplied.
MultiplySphericalPhaseFactor(double, CancellationToken?)
Samples a spherical phase factor with specified distance from source plane and sets the SphericalPhaseRadius property. Function uses the present sampling distance of the this ComplexAmplitude to sample the spherical phase factor.
public void MultiplySphericalPhaseFactor(double newRadius, CancellationToken? cancellationToken = null)
Parameters
newRadiusdoubleDistance of the spherical phase factor from origin plane.
cancellationTokenCancellationToken?Optional token for cooperative task cancellation.
MultiplyWithResampling(ComplexAmplitude, ComplexAmplitude, InterpolationMethod, InterpolationMethod)
Checks both ComplexAmplitude operands for identical sampling parameters, does the interpolation if one or both operands have to be resampled, then the second ComplexAmplitude is multiplied with the first ComplexAmplitude.
public static ComplexAmplitude MultiplyWithResampling(ComplexAmplitude cac1, ComplexAmplitude cac2, InterpolationMethod method1, InterpolationMethod method2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand.
cac2ComplexAmplitudeSecond ComplexAmplitude operand.
method1InterpolationMethodHow to interpolate 1. operand, if it is a transmission.
method2InterpolationMethodHow to interpolate 2. operand, if it is a transmission.
Returns
- ComplexAmplitude
The resulting harmonic field.
Normalize()
Normalizes this ComplexAmplitude so that the maximal amplitude is one.
public void Normalize()
Normalize(Rectangle)
Normalizes this ComplexAmplitude so that the maximal amplitude in given rectangle is one.
public void Normalize(Rectangle rectangle)
Parameters
rectangleRectangleRegion to which normalization refers.
PowerEqual(Complex)
Raises every element of this ComplexAmplitude to the power of the given complex number.
public void PowerEqual(Complex c)
Parameters
cComplexComplex exponent this complex amplitude is raised to.
RemoveSphericalPhaseFactor(CancellationToken?)
Removes a sampled spherical phase factor whose distance from the source plane is specified in the SphericalPhaseRadius property. The sampled complex field is divided by the corresponding spherical phase function.
public override void RemoveSphericalPhaseFactor(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?Optional token for cooperative task cancellation.
Replicate_Periodic(Vector)
Replicates this ComplexAmplitude periodically, original field is centered around (0; 0).
public void Replicate_Periodic(Vector newSize)
Parameters
newSizeVectorNew size in pixels.
Save(string)
Saves this ComplexAmplitude into a file.
public override void Save(string fileName)
Parameters
fileNamestringComplete path of the file.
SetBothComponentsAtOnce(ComplexField, ComplexField)
Because both Ex and Ey component must have same size, a function is needed to change both components at once.
public void SetBothComponentsAtOnce(ComplexField fieldX, ComplexField fieldY)
Parameters
fieldXComplexFieldComplex field containing Ex component.
fieldYComplexFieldComplex field containing Ey component.
Shift(Vector)
Shifts this ComplexAmplitude by a specified number of sampling points. Size is not modified, so sampling points can get lost.
public void Shift(Vector shift)
Parameters
shiftVectorField shift in pixels.
SplitLocallyPolarizedField(out ComplexAmplitude, out ComplexAmplitude)
Splits current complex amplitude into Ex and Ey component.
public void SplitLocallyPolarizedField(out ComplexAmplitude caX, out ComplexAmplitude caY)
Parameters
caXComplexAmplitudeReturns new ComplexAmplitude containing Ex component of this ComplexAmplitude.
caYComplexAmplitudeReturns new ComplexAmplitude containing Ey component of this ComplexAmplitude.
SubEqual(ComplexAmplitude)
Subtracts the given ComplexAmplitude from current one taking into account the spherical phase radius. The result is stored in this ComplexAmplitude. Both operands must have same number of sampling points. Other parameters like sampling distance or wavelength will not be changed.
public void SubEqual(ComplexAmplitude ca)
Parameters
caComplexAmplitudeComplexAmplitude to be subtracted from current one.
SubtractWithResampling(ComplexAmplitude, ComplexAmplitude, InterpolationMethod, InterpolationMethod)
Checks both ComplexAmplitude operands for identical sampling parameters, does the interpolation if one or both operands have to be resampled, then the second ComplexAmplitude is subtracted from the first ComplexAmplitude.
public static ComplexAmplitude SubtractWithResampling(ComplexAmplitude cac1, ComplexAmplitude cac2, InterpolationMethod method1, InterpolationMethod method2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand (minuend).
cac2ComplexAmplitudeSecond ComplexAmplitude operand (subtrahend).
method1InterpolationMethodHow to interpolate 1. operand, if it is a transmission.
method2InterpolationMethodHow to interpolate 2. operand, if it is a transmission.
Returns
- ComplexAmplitude
The resulting harmonic field.
ToString()
The overridden ToString function for ComplexAmplitudes
public override string ToString()
Returns
- string
either "Transmission", "Signal Region", "Complex Amplitude"
Transpose()
Transposes this ComplexAmplitude. This means \([x, y] = [y, x]\).
public void Transpose()
VerticalMirror_physicalCoordinates()
Performs a vertical mirroring of this ComplexAmplitude. The physical coordinate origin is maintained.
public void VerticalMirror_physicalCoordinates()
VerticalMirror_pixelCoordinates()
Performs a vertical mirroring of this ComplexAmplitude. \([x, SamplingPoints.Y - y - 1] = [x, y]\)
public void VerticalMirror_pixelCoordinates()
Operators
operator +(ComplexAmplitude, ComplexAmplitude)
Adds two ComplexAmplitude objects. The sampling distance and the wavelength are ignored during the operation. The resulting object has the same sampling distance and wavelength as the first operand.
[Obsolete("Keep in mind that the AddEqual method is more performant than the += operator.")]
public static ComplexAmplitude operator +(ComplexAmplitude cac1, ComplexAmplitude cac2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand.
cac2ComplexAmplitudeSecond ComplexAmplitude operand.
Returns
- ComplexAmplitude
The result of the operator.
operator +(ComplexAmplitude, Complex)
Adds a Complex value to a ComplexAmplitude.
public static ComplexAmplitude operator +(ComplexAmplitude ca, Complex c)
Parameters
caComplexAmplitudeThe ComplexAmplitude.
cComplexThe complex value.
Returns
- ComplexAmplitude
A new ComplexAmplitude where the given Complex value has been added to every pixel.
operator +(Complex, ComplexAmplitude)
Adds a Complex value to a ComplexAmplitude.
public static ComplexAmplitude operator +(Complex c, ComplexAmplitude ca)
Parameters
cComplexThe complex value.
caComplexAmplitudeThe ComplexAmplitude.
Returns
- ComplexAmplitude
A new ComplexAmplitude where the given Complex value has been added to every pixel.
operator /(ComplexAmplitude, ComplexAmplitude)
Divides two ComplexAmplitude objects.
public static ComplexAmplitude operator /(ComplexAmplitude cac1, ComplexAmplitude cac2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand (dividend).
cac2ComplexAmplitudeSecond ComplexAmplitude operand (divisor).
Returns
- ComplexAmplitude
Quotient of the two ComplexAmplitude objects.
operator /(ComplexAmplitude, Complex)
Divides a ComplexAmplitude by a Complex value.
public static ComplexAmplitude operator /(ComplexAmplitude ca, Complex c)
Parameters
caComplexAmplitudeThe ComplexAmplitude.
cComplexThe complex value.
Returns
- ComplexAmplitude
The quotient of the ComplexAmplitude and the complex value.
operator ^(ComplexAmplitude, Complex)
Raises a ComplexAmplitude to a complex value
public static ComplexAmplitude operator ^(ComplexAmplitude ca, Complex c)
Parameters
caComplexAmplitudethe first ComplexAmplitude
cComplexthe complex value
Returns
- ComplexAmplitude
the power .
operator *(ComplexAmplitude, ComplexAmplitude)
Multiplies two ComplexAmplitude objects.
[Obsolete("Keep in mind that the MultEqual method is more performant than the *= operator.")]
public static ComplexAmplitude operator *(ComplexAmplitude cac1, ComplexAmplitude cac2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand.
cac2ComplexAmplitudeSecond ComplexAmplitude operand.
Returns
- ComplexAmplitude
Product of the two ComplexAmplitude objects.
operator *(ComplexAmplitude, Complex)
Multiplies a ComplexAmplitude with a complex value.
public static ComplexAmplitude operator *(ComplexAmplitude ca, Complex c)
Parameters
caComplexAmplitudeThe ComplexAmplitude.
cComplexThe complex value.
Returns
- ComplexAmplitude
The product of the ComplexAmplitude and the complex value.
operator *(Complex, ComplexAmplitude)
Multiplies a complex value with a ComplexAmplitude.
public static ComplexAmplitude operator *(Complex c, ComplexAmplitude ca)
Parameters
cComplexThe complex value.
caComplexAmplitudeThe ComplexAmplitude.
Returns
- ComplexAmplitude
The product of the ComplexAmplitude and the complex value.
operator -(ComplexAmplitude, ComplexAmplitude)
Subtracts two ComplexAmplitude objects.
public static ComplexAmplitude operator -(ComplexAmplitude cac1, ComplexAmplitude cac2)
Parameters
cac1ComplexAmplitudeFirst ComplexAmplitude operand (minuend).
cac2ComplexAmplitudeSecond ComplexAmplitude operand (subtrahend).
Returns
- ComplexAmplitude
The result of the operator.
operator -(ComplexAmplitude, Complex)
Subtracts a ComplexAmplitude and a Complex value.
public static ComplexAmplitude operator -(ComplexAmplitude ca, Complex c)
Parameters
caComplexAmplitudeThe ComplexAmplitude.
cComplexThe complex value.
Returns
- ComplexAmplitude
The difference of the ComplexAmplitude and the complex value.