Programming Reference for VirtualLab Fusion  2026.1
Loading...
Searching...
No Matches
DataArrayConversions Class Reference

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Support class containing various conversions between numerical data arrays or data array based documents and other documents. More...

Static Public Member Functions

static DataArray2D CombineTwoDataArray1DAsNewDimensionsOfDataArray2D (DataArray1D xRepresentation, DataArray1D yRepresentation)
 Method which combines two 1D data arrays (which has to represent identical data) to one 2D data array. Each of the input parameters represents one of the two dimensions.
 
static DataArray2D ComposeDataArray2DWithSubSetsFromListOfDataArray1DWithSubsets (List< DataArray1D > dataArraysToConvert, AxisDirection newDirection, List< PhysicalValue > newCoordinates)
 Method for creating a 2D data array from a list of 1D data arrays with identical number of subsets, subset meanings (per index), sampling and dimensions.
 
static DataArray2D ConvertDataArray1DWithSubSetsToDataArray2D (DataArray1D dataArrayToConvert, AxisDirection newDirection, double samplingDistance_new, string commentAxis_new, MeasuredQuantity quantityAxis_new, double coordinateOfFirstDataPoint_new)
 Method for creating a 2D data array with one subset from a 1D data array with more than one subset.
 
static DataArray2D ConvertDataArray1DWithSubSetsToDataArray2D (DataArray1D dataArrayToConvert, AxisDirection newDirection, List< PhysicalValue > newCoordinates)
 Method for creating a 2D data array with one subset from a 1D data array with more than one subset.
 
static DataArrayGridLess ConvertDataArray2DToDataArrayGridless (DataArray2D dataArray2D)
 Converts the data array2 d to data array grid less.
 
static ChromaticFieldsSetBase ConvertHarmonicFieldsSetToChromaticFieldsSet (HarmonicFieldsSet hfs)
 Converts a Harmonic Fields Set into a Chromatic Fields Set.
 
static DataArrayBase ConvertHarmonicFieldsSetToDataArray (HarmonicFieldsSet hfs, bool complexConversion, FieldQuantity fieldQuantity, InterpolationMethod interpolationMethodX, InterpolationMethod interpolationMethodY, VectorComponentModesForConversionToDataArray vectorComponentMode=VectorComponentModesForConversionToDataArray.ScalarField_U)
 Converts a harmonic fields set to an equidistant data array. In a first step all member fields are interpolated to have the same sampling. Then all member fields are converted to a data array. The coordinates are calculated from the SamplingParameters and the IsSpectral information of the member field. Finally the resulting subsets are "merged" into the resulting data array.
 
static DataArrayBase ConvertHarmonicFieldToDataArray (ComplexAmplitude ca, bool complexConversion, FieldQuantity fieldQuantity, InterpolationMethod interpolationMethodX, InterpolationMethod interpolationMethodY, VectorComponentModesForConversionToDataArray vectorComponentMode=VectorComponentModesForConversionToDataArray.ScalarField_U, bool cloneFields=true, string optionalPrefix="")
 Converts a harmonic field to an equidistant data array. The coordinates are calculated from the SamplingParameters and the IsSpectral information of the field. If the harmonic field is complex / real-valued, the resulting data array is also complex / real-valued.
 
static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField (DataArrayBase dataArray2Bconverted, int subsetIndexForFieldXorU, int subsetIndexForFieldY, double wavelength, VectorC jonesVector, out string warnings)
 Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. ComplexAmplitudeField.
 
static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField (DataArrayBase dataArray2Bconverted, int subsetIndexForFieldXorU, int subsetIndexForFieldY, out string warnings)
 Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. ComplexAmplitudeField.
 
static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField (DataArrayBase dataArray2Bconverted, int subsetIndexForFieldXorU, out string warnings)
 Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. globally polarized ComplexAmplitudeField.
 
static DataArrayBase ConvertOrderCollectionToDataArray (OrderCollection oc, double distanceForPositions)
 Converts the given Order Collection document to a data array containing all data (plotted versus order number).
 
static DataArrayBase ConvertSetOfDataArraysToDataArray (ISetOfDataArrays setOfDataArrays)
 Converts the set of data arrays to a single data array containing all subsets (possibly resampled).
 
static DataArrayBase[] ConvertSetOfDataArraysToDataArrays (this ISetOfDataArrays setOfDataArrays)
 Extracts the array of data arrays forming a set of data arrays. Just to simplify usage of the ISetOfDataArrays interface.
 
static DataArray1D DecomposeSingleSubset2DDataArrayToMultiSubset1DDataArray (DataArray2D dataArray2D, AxisDirection directionForDecomposition)
 Method that decomposes a 2D data array containing a single subset into a 1D data array with several subsets.
 
static DataArrayBase ExtractComponentFromHarmonicFieldsSet (HarmonicFieldsSet hfsToExtract, HarmonicFieldComponents componentToExtract)
 public support method to extract a vectorial component from an harmonic fields set
 
static void ExtractCrossProfile (DataArray2D dataArray2D, Vector position, out DataArray1D dataArrayX, out DataArray1D dataArrayY)
 Extracts a cross profile (= profile line along both x- and y-direction at a certain position) from a certain position.
 
static DataArray2D ExtrudeDataArray1DToDataArray2D (DataArray1D dataArrayToConvert, int noOfPointsInNewDirection, AxisDirection newDirection, double samplingDistance_new, string commentAxis_new, MeasuredQuantity measuredQuantityAxis_new, double coordinateOfFirstDataPoint_new)
 Method for creating a 2D data array by extruding a 1D data array.
 
static DataArray2D MakeDataArray2DSeparable (DataArray2D dataArray)
 Method which makes all subsets of a DataArray2D separable.
 
static void SeparateDataArray2DDimensions (DataArray2D dataArray, out DataArray1D daX, out DataArray1D daY)
 Method which separates the dimensions of a DataArray2D.
 

Detailed Description

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Support class containing various conversions between numerical data arrays or data array based documents and other documents.

Member Function Documentation

◆ CombineTwoDataArray1DAsNewDimensionsOfDataArray2D()

static DataArray2D CombineTwoDataArray1DAsNewDimensionsOfDataArray2D ( DataArray1D xRepresentation,
DataArray1D yRepresentation )
static

Method which combines two 1D data arrays (which has to represent identical data) to one 2D data array. Each of the input parameters represents one of the two dimensions.

Parameters
xRepresentation1D data array which represents the x-dimension.
yRepresentation1D data array which represents the y-dimension.
Returns
The 2D combination of the 1D input data arrays.
Exceptions
System.ArgumentExceptionThe dimensionalities of the 1D data arrays are not equal.

◆ ComposeDataArray2DWithSubSetsFromListOfDataArray1DWithSubsets()

static DataArray2D ComposeDataArray2DWithSubSetsFromListOfDataArray1DWithSubsets ( List< DataArray1D > dataArraysToConvert,
AxisDirection newDirection,
List< PhysicalValue > newCoordinates )
static

Method for creating a 2D data array from a list of 1D data arrays with identical number of subsets, subset meanings (per index), sampling and dimensions.

Parameters
dataArraysToConvertList of 1D data arrays to be converted.
newDirectionThe new coordinate direction.
newCoordinatesThe coordinates for each data point (= input data arrays) on the new axis.
Returns
2D data array created from the 1D data arrays. If the given new coordinates are equidistant so is the resulting data array in the new direction.

◆ ConvertDataArray1DWithSubSetsToDataArray2D() [1/2]

static DataArray2D ConvertDataArray1DWithSubSetsToDataArray2D ( DataArray1D dataArrayToConvert,
AxisDirection newDirection,
double samplingDistance_new,
string commentAxis_new,
MeasuredQuantity quantityAxis_new,
double coordinateOfFirstDataPoint_new )
static

Method for creating a 2D data array with one subset from a 1D data array with more than one subset.

Parameters
dataArrayToConvert1D data array to be converted.
newDirectionThe new direction.
samplingDistance_newNew sampling distance.
commentAxis_newNew axis description.
quantityAxis_newNew coordinate's measured quantity.
coordinateOfFirstDataPoint_newNew coordinate's start point.
Returns
2D data array created from the subsets of a 1D data array.
Exceptions
ArgumentExceptionThe data array to convert must contain more than one subsets. or The physical properties of the data entries do not match. The conversion is not supported.

◆ ConvertDataArray1DWithSubSetsToDataArray2D() [2/2]

static DataArray2D ConvertDataArray1DWithSubSetsToDataArray2D ( DataArray1D dataArrayToConvert,
AxisDirection newDirection,
List< PhysicalValue > newCoordinates )
static

Method for creating a 2D data array with one subset from a 1D data array with more than one subset.

Parameters
dataArrayToConvert1D data array to be converted.
newDirectionThe new direction.
newCoordinatesThe coordinates for each data point (= former subset) on the new axis.
Returns
2D data array created from the subsets of a 1D data array. If the given new coordinates are equidistant so is the resulting data array in the new direction.
Exceptions
ArgumentExceptionThe data array to convert must contain more than one subsets. or The physical properties of the data entries do not match. The conversion is not supported.

◆ ConvertDataArray2DToDataArrayGridless()

static DataArrayGridLess ConvertDataArray2DToDataArrayGridless ( DataArray2D dataArray2D)
static

Converts the data array2 d to data array grid less.

Parameters
dataArray2DThe data array2 d.
Returns
Data Array 2D converted to Data Array Grid less. Each Subset of complex field is converted to Grid less Array.

◆ ConvertHarmonicFieldsSetToChromaticFieldsSet()

static ChromaticFieldsSetBase ConvertHarmonicFieldsSetToChromaticFieldsSet ( HarmonicFieldsSet hfs)
static

Converts a Harmonic Fields Set into a Chromatic Fields Set.

Parameters
hfsThe HarmonicFieldsSet object to convert.
Returns
The resulting Chromatic Fields Set.

◆ ConvertHarmonicFieldsSetToDataArray()

static DataArrayBase ConvertHarmonicFieldsSetToDataArray ( HarmonicFieldsSet hfs,
bool complexConversion,
FieldQuantity fieldQuantity,
InterpolationMethod interpolationMethodX,
InterpolationMethod interpolationMethodY,
VectorComponentModesForConversionToDataArray vectorComponentMode = VectorComponentModesForConversionToDataArray::ScalarField_U )
static

Converts a harmonic fields set to an equidistant data array. In a first step all member fields are interpolated to have the same sampling. Then all member fields are converted to a data array. The coordinates are calculated from the SamplingParameters and the IsSpectral information of the member field. Finally the resulting subsets are "merged" into the resulting data array.

Parameters
hfsThe HarmonicFieldSet to convert.
complexConversionIf set to true the whole field is converted. Otherwise the specified field quantity is extracted.
fieldQuantityThe field quantity to be extracted. This optional parameter only has an effect if complexConversion is false.
interpolationMethodXThe interpolation method x.
interpolationMethodYThe interpolation method y.
vectorComponentModeOptional vector component mode for correct handling of locally polarized fields. In this case you can specify whether Ex, Ey or both Ex and Ey are converted. In the latter case, the resulting data array has two subsets.
Returns
The resulting data array. Cubic-8-point interpolation is used as interpolation method. Note that the comments of the individual subsets must be specified externally.
Exceptions
System.ArgumentExceptionHarmonic Fields Set must not be null. or HarmonicFieldsSet must have at least one member field.

◆ ConvertHarmonicFieldToDataArray()

static DataArrayBase ConvertHarmonicFieldToDataArray ( ComplexAmplitude ca,
bool complexConversion,
FieldQuantity fieldQuantity,
InterpolationMethod interpolationMethodX,
InterpolationMethod interpolationMethodY,
VectorComponentModesForConversionToDataArray vectorComponentMode = VectorComponentModesForConversionToDataArray::ScalarField_U,
bool cloneFields = true,
string optionalPrefix = "" )
static

Converts a harmonic field to an equidistant data array. The coordinates are calculated from the SamplingParameters and the IsSpectral information of the field. If the harmonic field is complex / real-valued, the resulting data array is also complex / real-valued.

Parameters
caThe ComplexAmplitude to convert.
complexConversionIf set to true the whole field is converted. Otherwise the specified field quantity is extracted.
fieldQuantityThe field quantity to be extracted. This optional parameter only has an effect if complexConversion is false.
interpolationMethodXThe interpolation method for the x-direction.
interpolationMethodYThe interpolation method for the y-direction.
vectorComponentModeOptional vector component mode for correct handling of locally polarized fields. In this case you can specify whether Ex, Ey or both Ex and Ey are converted. In the latter case, the resulting data array has two subsets.
cloneFieldsIf this optional parameter is set to false, the original ComplexAmplitude and the resulting data array use the same data fields. This increases the performance of this method, but only works if the original ComplexAmplitude is not used afterwards.
optionalPrefixAn optional prefix added to the data description of the resulting Data Array.
Returns
The resulting data array. Cubic-8-point interpolation is used as interpolation method. Note that the comments of the individual subsets must be specified externally.
Exceptions
VirtualLabAPI.Core.Propagation.HandlingNumericalEffortToHigh.ExceptionCase not found.
System.NotImplementedExceptionCase not found.

◆ ConvertNumericalDataArrayToComplexAmplitudeField() [1/3]

static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField ( DataArrayBase dataArray2Bconverted,
int subsetIndexForFieldXorU,
int subsetIndexForFieldY,
double wavelength,
VectorC jonesVector,
out string warnings )
static

Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. ComplexAmplitudeField.

Parameters
dataArray2BconvertedNumerical DataArray1D or DataArray2D to be converted.
subsetIndexForFieldXorUIndex of the subset which shall provide the complex field for FieldX.
subsetIndexForFieldYIndex of the subset which shall provide the complex field for FieldY. Set to -1 if the result shall be globally polarized.
wavelengthWavelength of the LFO.
jonesVectorJones vector of the LFO if it will be globally polarized.
warningsOut parameter containing possible warnings.
Returns
New ComplexAmplitude created from the data array.
Exceptions
System.ArgumentExceptionThe wavelength has to be a positive value. or Data Array has to be of type DataArray1D or DataArray2D. or Data Array to be converted must be of type 'Numerical'.

◆ ConvertNumericalDataArrayToComplexAmplitudeField() [2/3]

static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField ( DataArrayBase dataArray2Bconverted,
int subsetIndexForFieldXorU,
int subsetIndexForFieldY,
out string warnings )
static

Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. ComplexAmplitudeField.

Parameters
dataArray2BconvertedNumerical DataArray1D or DataArray2D to be converted.
subsetIndexForFieldXorUIndex of the subset which shall provide the complex field for FieldX.
subsetIndexForFieldYIndex of the subset which shall provide the complex field for FieldY. Set to -1 if the result shall be globally polarized.
warningsOut parameter containing possible warnings.
Returns
New ComplexAmplitude created from the data array.

◆ ConvertNumericalDataArrayToComplexAmplitudeField() [3/3]

static ComplexAmplitude ConvertNumericalDataArrayToComplexAmplitudeField ( DataArrayBase dataArray2Bconverted,
int subsetIndexForFieldXorU,
out string warnings )
static

Method for conversion a Numerical DataArray1D or DataArray2D to an old Light Field Object, i.e. globally polarized ComplexAmplitudeField.

Parameters
dataArray2BconvertedNumerical DataArray1D or DataArray2D to be converted.
subsetIndexForFieldXorUIndex of the subset which shall provide the complex field for FieldX.
warningsOut parameter containing possible warnings.
Returns
New ComplexAmplitude created from the data array.

◆ ConvertOrderCollectionToDataArray()

static DataArrayBase ConvertOrderCollectionToDataArray ( OrderCollection oc,
double distanceForPositions )
static

Converts the given Order Collection document to a data array containing all data (plotted versus order number).

Parameters
ocThe Order Collection.
distanceForPositionsThe distance, required for calculating the positions of the orders.
Returns
An equidistant data array whose subsets contain the angles, positions, efficiencies, and Rayleigh coefficients in separate subsets.

◆ ConvertSetOfDataArraysToDataArray()

static DataArrayBase ConvertSetOfDataArraysToDataArray ( ISetOfDataArrays setOfDataArrays)
static

Converts the set of data arrays to a single data array containing all subsets (possibly resampled).

Parameters
setOfDataArraysThe set of data arrays.
Returns
The data array. Some settings like extrapolation are taken from the first data array.
Exceptions
System.ArgumentExceptionSet of Data Arrays must contain at least one data array. or The physical meanings of the data arrays must be all the same.

◆ ConvertSetOfDataArraysToDataArrays()

static DataArrayBase[] ConvertSetOfDataArraysToDataArrays ( this ISetOfDataArrays setOfDataArrays)
static

Extracts the array of data arrays forming a set of data arrays. Just to simplify usage of the ISetOfDataArrays interface.

Parameters
setOfDataArraysThe set of data arrays.
Returns
The data arrays stored in the set of data arrays.
Exceptions
System.ArgumentExceptionSet of Data Arrays must contain at least one data array.

◆ DecomposeSingleSubset2DDataArrayToMultiSubset1DDataArray()

static DataArray1D DecomposeSingleSubset2DDataArrayToMultiSubset1DDataArray ( DataArray2D dataArray2D,
AxisDirection directionForDecomposition )
static

Method that decomposes a 2D data array containing a single subset into a 1D data array with several subsets.

Parameters
dataArray2DData array to decompose
directionForDecompositionShall the data array be decomposed in x- or y-direction?
Returns
A 1D data array with one subset per data row / data column of the original 2D data array.
Exceptions
System.ArgumentExceptionInput data arrays may have one subset only. or Data array can be decomposed in x or y only.

◆ ExtractComponentFromHarmonicFieldsSet()

static DataArrayBase ExtractComponentFromHarmonicFieldsSet ( HarmonicFieldsSet hfsToExtract,
HarmonicFieldComponents componentToExtract )
static

public support method to extract a vectorial component from an harmonic fields set

Parameters
hfsToExtractThe harmonic fields set which shall be used for the evaluation
componentToExtractThe harmonic field component which shall be extracted
Returns
The data array containing the specified harmonic field component.

◆ ExtractCrossProfile()

static void ExtractCrossProfile ( DataArray2D dataArray2D,
Vector position,
out DataArray1D dataArrayX,
out DataArray1D dataArrayY )
static

Extracts a cross profile (= profile line along both x- and y-direction at a certain position) from a certain position.

Parameters
dataArray2DThe 2D data array from which the cross profile is extracted.
positionThe (x; y) position from which the cross profile is extracted.
dataArrayXOut parameter returning the profile along x-direction.
dataArrayYOut parameter returning the profile along y-direction.

◆ ExtrudeDataArray1DToDataArray2D()

static DataArray2D ExtrudeDataArray1DToDataArray2D ( DataArray1D dataArrayToConvert,
int noOfPointsInNewDirection,
AxisDirection newDirection,
double samplingDistance_new,
string commentAxis_new,
MeasuredQuantity measuredQuantityAxis_new,
double coordinateOfFirstDataPoint_new )
static

Method for creating a 2D data array by extruding a 1D data array.

Parameters
dataArrayToConvert1D data array to be extruded.
noOfPointsInNewDirectionNumber of replications in extruding direction.
newDirectionThe new (extruding) direction.
samplingDistance_newNew sampling distance.
commentAxis_newNew axis description.
measuredQuantityAxis_newNew coordinate's measured quantity.
coordinateOfFirstDataPoint_newNew coordinate's start point.
Returns
2D data array created by extruding a 1D data array.

◆ MakeDataArray2DSeparable()

static DataArray2D MakeDataArray2DSeparable ( DataArray2D dataArray)
static

Method which makes all subsets of a DataArray2D separable.

Parameters
dataArrayData array (2D) to be made separable.
Returns
New 2D data array with separable subsets.

◆ SeparateDataArray2DDimensions()

static void SeparateDataArray2DDimensions ( DataArray2D dataArray,
out DataArray1D daX,
out DataArray1D daY )
static

Method which separates the dimensions of a DataArray2D.

Parameters
dataArrayData array (2D) to be separated.
daXDataArray1D which represents the data along the x-coordinate.
daYDataArray1D which represents the data along the y-coordinate.