Table of Contents

Class ComplexAmplitudeInterpolation

Namespace
VirtualLabAPI.Core.FieldRepresentations
Assembly
VirtualLabAPI.dll

This class contains static member functions for interpolating a complex amplitude to another sampling grid.

public class ComplexAmplitudeInterpolation
Inheritance
ComplexAmplitudeInterpolation
Inherited Members

Methods

CalculateSamplingParametersForCoordinateTransformation(Matrix2x2D, SamplingParameters)

Method for calculating sampling parameters for a field which will undergo a 2D coordinate transformation.

public static SamplingParameters CalculateSamplingParametersForCoordinateTransformation(Matrix2x2D trafoMatrix, SamplingParameters oldSamplingParameters)

Parameters

trafoMatrix Matrix2x2D

The matrix which describes the transform.

oldSamplingParameters SamplingParameters

Old sampling parameters of the field to be transformed.

Returns

SamplingParameters

The new sampling parameters after the transform.

DiscreteOversampling(ComplexAmplitude, Vector)

Inserts zero points between sampling points.

public static ComplexAmplitude DiscreteOversampling(ComplexAmplitude ca, Vector factor)

Parameters

ca ComplexAmplitude

ComplexAmplitude operation is applied to.

factor Vector

For example a factor of two means, that every second sampling point is zero.

Returns

ComplexAmplitude

Result of operation.

Interpolation(ComplexAmplitude, SamplingParameters, VectorD, InterpolationMethod, CancellationToken?)

Interpolates a ComplexAmplitude using the specified interpolation method. It is possible to interpolate a not centered part of the ComplexAmplitude using the zeroPoint parameter.

public static ComplexAmplitude Interpolation(ComplexAmplitude ca, SamplingParameters samplingParameters, VectorD zeroPoint, InterpolationMethod interpolationMethod, CancellationToken? cancellationToken = null)

Parameters

ca ComplexAmplitude

ComplexAmplitude to interpolate.

samplingParameters SamplingParameters

Contains the new number of sampling points and the sampling distance of the ComplexAmplitude after interpolation.

zeroPoint VectorD

The zero point parameter specifies the position of the center of the ComplexAmplitude after interpolation.

interpolationMethod InterpolationMethod

The used interpolation method.

cancellationToken CancellationToken?

Optional token for cooperative task cancellation.

Returns

ComplexAmplitude

Result of operation.

ProfileExtractionCoordsPhysical(ComplexAmplitude, VectorD, VectorD, int, InterpolationMethod, bool)

Extracts a one-dimensional profile from a two-dimensional ComplexAmplitude. Different interpolation methods are supported.

public static ComplexAmplitude ProfileExtractionCoordsPhysical(ComplexAmplitude ca, VectorD startPointPhys, VectorD endPointPhys, int samplingPoints, InterpolationMethod interpolationMethod, bool removeSphericalPhase)

Parameters

ca ComplexAmplitude

ComplexAmplitude to extract a profile from.

startPointPhys VectorD

Start point of the one-dimensional profile in physical coordinates.

endPointPhys VectorD

End point of the one-dimensional profile in physical coordinates.

samplingPoints int

Number of sampling points of the profile including the start and the end point. So the minimum number is 2.

interpolationMethod InterpolationMethod

Interpolation method for extraction.

removeSphericalPhase bool

Additional spherical phase is removed from profile line.

Returns

ComplexAmplitude

Result of operation.

Rotation2D(ComplexAmplitude, Vector, double, InterpolationMethod)

Rotates a ComplexAmplitude in the x-y-plane by the angle \(\phi\). The rotation is calculated using the specified interpolation method.

public static ComplexAmplitude Rotation2D(ComplexAmplitude ca, Vector newSamplingPoints, double phi, InterpolationMethod interpolationMethod)

Parameters

ca ComplexAmplitude

ComplexAmplitude to rotate.

newSamplingPoints Vector

The number of sampling points the rotated field shall have.

phi double

Rotation angle in radians.

interpolationMethod InterpolationMethod

Specifies with which algorithm the point interpolation is done.

Returns

ComplexAmplitude

Result of operation.

SampleAllAnalyticFunctionsAtField(ref ComplexAmplitude, InterpolationMethod, CancellationToken)

Method that samples the lateral offset (via embedding, i.e. zero padding) which is stored at a field as well as its quadratic and linear phase function.

public static void SampleAllAnalyticFunctionsAtField(ref ComplexAmplitude ca, InterpolationMethod interpolationMethod, CancellationToken cancellationToken)

Parameters

ca ComplexAmplitude

Harmonic field whose analytic function parameters shall be sampled.

interpolationMethod InterpolationMethod

Interpolation method to be used for sampling the quadratic and the linear phase function.

cancellationToken CancellationToken

The token for cooperative task cancellation.

SampleLateralOffsetFromAnalyticValuesAtField(ref ComplexAmplitude, bool, CancellationToken, InterpolationMethod)

Method that samples (via embedding, i.e. zero padding) the lateral offset stored at a given field.

public static void SampleLateralOffsetFromAnalyticValuesAtField(ref ComplexAmplitude ca, bool sampleOtherAnalyticFunctionsToo, CancellationToken cancellationToken, InterpolationMethod interpMethod = InterpolationMethod.SincFFT)

Parameters

ca ComplexAmplitude

Field whose offset shall be sampled.

sampleOtherAnalyticFunctionsToo bool

If true, the sampling of quadratic and linear phase functions will be ensured.

cancellationToken CancellationToken

The token for cooperative task cancellation.

interpMethod InterpolationMethod

In case the parameter sampleOtherAnalyticFunctionsToo is true, the interpolation method for the sampling can be set here.

SampleLinearPhaseFromAnalyticFunctionAtField(ref ComplexAmplitude, InterpolationMethod, CancellationToken)

Samples the linear phase function stored at a field and multiplies function and field values.

public static void SampleLinearPhaseFromAnalyticFunctionAtField(ref ComplexAmplitude ca, InterpolationMethod interpolationMethod, CancellationToken cancellationToken)

Parameters

ca ComplexAmplitude

ComplexAmplitude to sample the linear phase on. Since this is a ref parameter, it will be modified by the function.

interpolationMethod InterpolationMethod

Method of interpolation if necessary

cancellationToken CancellationToken

The token for cooperative task cancellation.

SampleQuadraticPhaseFromAnalyticFunctionAtField(ref ComplexAmplitude, InterpolationMethod, bool, CancellationToken, LightPathProcessingLogger, long)

Samples a quadratic phase from a given quadratic function and multiplies it with the given ComplexAmplitude.

public static void SampleQuadraticPhaseFromAnalyticFunctionAtField(ref ComplexAmplitude ca, InterpolationMethod interpolationMethod, bool enableAnalyticalLinearPhaseResultingFromOffset, CancellationToken cancellationToken, LightPathProcessingLogger logger = null, long maximumNumberPixels = -1)

Parameters

ca ComplexAmplitude

ComplexAmplitude to sample the quadratic phase on. Since this is a ref parameter, it will be modified by the function.

interpolationMethod InterpolationMethod

Method of interpolation if necessary

enableAnalyticalLinearPhaseResultingFromOffset bool

If true, the result may contain an additional analytical linear phase, which results from the quadratic phase if there is a lateral offset.

cancellationToken CancellationToken

The token for cooperative task cancellation.

logger LightPathProcessingLogger

The process logger.

maximumNumberPixels long

Maximum number of pixels to use.

SampleSphericalPhaseFactor(ComplexAmplitude)

A ComplexAmplitude can contain a separate spherical phase factor. Thus the phase of the sampled complex amplitude can be undersampled. This function resamples the complex amplitude in a way that complies to Nyquist criterion and separate spherical phase is no longer needed.

public static ComplexAmplitude SampleSphericalPhaseFactor(ComplexAmplitude ca)

Parameters

ca ComplexAmplitude

ComplexAmplitude to sample the spherical phase for.

Returns

ComplexAmplitude

Result of operation.

SampleSphericalPhaseFactor(HarmonicFieldBase)

A Harmonic Field can contain a separate spherical phase factor. Thus the phase of the sampled complex amplitude can be undersampled. This function resamples the harmonic field in a way that complies to Nyquist criterion and separate spherical phase factor is no longer needed.

public static HarmonicFieldBase SampleSphericalPhaseFactor(HarmonicFieldBase field)

Parameters

field HarmonicFieldBase

ComplexAmplitude to sample the spherical phase for.

Returns

HarmonicFieldBase

Result of operation.

SampleSphericalPhaseFactor(HarmonicFieldsSet)

The member fields of a HarmonicFieldsSet can contain a separate spherical phase factor. Thus the phase of the sampled complex amplitude can be undersampled. This function resamples the complex amplitude in a way that complies to Nyquist criterion and separate spherical phase is no longer needed.

public static HarmonicFieldsSet SampleSphericalPhaseFactor(HarmonicFieldsSet hfs)

Parameters

hfs HarmonicFieldsSet

The HarmonicFieldsSet whose member fields shall be resampled according to the spherical phase factor.

Returns

HarmonicFieldsSet

Result of operation. Null if the sampling warning was shown and the user decided to not create such a large field.

TryToDecreaseSamplingEffort(ComplexAmplitude, bool, double, double, double, CancellationToken)

Method which tries to decrease the sampling effort for a ComplexAmplitude.

public static ComplexAmplitude TryToDecreaseSamplingEffort(ComplexAmplitude caIn, bool truncateFieldSize, double minimumOversamplingFactor, double truncationInflationFactor, double powerPortionForEvaluation, CancellationToken cancellationToken)

Parameters

caIn ComplexAmplitude

ComplexAmplitude whose sampling shall be optimized.

truncateFieldSize bool

If true, a truncation of the field is tried.

minimumOversamplingFactor double

Minimum oversampling factor, independent of the factor given in Globals. The larger value of both will be used.

truncationInflationFactor double

If the truncation flag is true, this factor will be applied to the minimum detected field size.

powerPortionForEvaluation double

the power portion that shall be used for evaluation in case of truncation. If truncateFieldSize is false, this parameter will be ignored.

cancellationToken CancellationToken

Token for cooperative task cancellation.

Returns

ComplexAmplitude

A ComplexAmplitude which uses less sampling than the input if possible.