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
trafoMatrixMatrix2x2DThe matrix which describes the transform.
oldSamplingParametersSamplingParametersOld 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
caComplexAmplitudeComplexAmplitude operation is applied to.
factorVectorFor 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
caComplexAmplitudeComplexAmplitude to interpolate.
samplingParametersSamplingParametersContains the new number of sampling points and the sampling distance of the ComplexAmplitude after interpolation.
zeroPointVectorDThe zero point parameter specifies the position of the center of the ComplexAmplitude after interpolation.
interpolationMethodInterpolationMethodThe used interpolation method.
cancellationTokenCancellationToken?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
caComplexAmplitudeComplexAmplitude to extract a profile from.
startPointPhysVectorDStart point of the one-dimensional profile in physical coordinates.
endPointPhysVectorDEnd point of the one-dimensional profile in physical coordinates.
samplingPointsintNumber of sampling points of the profile including the start and the end point. So the minimum number is 2.
interpolationMethodInterpolationMethodInterpolation method for extraction.
removeSphericalPhaseboolAdditional 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
caComplexAmplitudeComplexAmplitude to rotate.
newSamplingPointsVectorThe number of sampling points the rotated field shall have.
phidoubleRotation angle in radians.
interpolationMethodInterpolationMethodSpecifies 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
caComplexAmplitudeHarmonic field whose analytic function parameters shall be sampled.
interpolationMethodInterpolationMethodInterpolation method to be used for sampling the quadratic and the linear phase function.
cancellationTokenCancellationTokenThe 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
caComplexAmplitudeField whose offset shall be sampled.
sampleOtherAnalyticFunctionsTooboolIf
true, the sampling of quadratic and linear phase functions will be ensured.cancellationTokenCancellationTokenThe token for cooperative task cancellation.
interpMethodInterpolationMethodIn 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
caComplexAmplitudeComplexAmplitude to sample the linear phase on. Since this is a ref parameter, it will be modified by the function.
interpolationMethodInterpolationMethodMethod of interpolation if necessary
cancellationTokenCancellationTokenThe 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
caComplexAmplitudeComplexAmplitude to sample the quadratic phase on. Since this is a ref parameter, it will be modified by the function.
interpolationMethodInterpolationMethodMethod of interpolation if necessary
enableAnalyticalLinearPhaseResultingFromOffsetboolIf true, the result may contain an additional analytical linear phase, which results from the quadratic phase if there is a lateral offset.
cancellationTokenCancellationTokenThe token for cooperative task cancellation.
loggerLightPathProcessingLoggerThe process logger.
maximumNumberPixelslongMaximum 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
caComplexAmplitudeComplexAmplitude 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
fieldHarmonicFieldBaseComplexAmplitude 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
hfsHarmonicFieldsSetThe HarmonicFieldsSet whose member fields shall be resampled according to the spherical phase factor.
Returns
- HarmonicFieldsSet
Result of operation.
Nullif 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
caInComplexAmplitudeComplexAmplitude whose sampling shall be optimized.
truncateFieldSizeboolIf
true, a truncation of the field is tried.minimumOversamplingFactordoubleMinimum oversampling factor, independent of the factor given in Globals. The larger value of both will be used.
truncationInflationFactordoubleIf the truncation flag is
true, this factor will be applied to the minimum detected field size.powerPortionForEvaluationdoublethe power portion that shall be used for evaluation in case of truncation. If truncateFieldSize is
false, this parameter will be ignored.cancellationTokenCancellationTokenToken for cooperative task cancellation.
Returns
- ComplexAmplitude
A ComplexAmplitude which uses less sampling than the input if possible.