Result1DComplex Object

This object offers access and manipulation functions to complex 1D results. A Result1DComplex object can hold a number of points ( x, y ) where x is a real number and y is a complex number. Access to the points is possible by specifying an zero-based index.

Initialization, File Operation

Construction

An Result1DComplex object can be created as follows:

 

From within  CST EM STUDIO

Dim result As Object

Set result = Result1DComplex("")

 

This will create an empty object. Alternatively, a filename of a complex .sig-file can be given as a parameter, then the object loads the data from the .sig-file.

Initialize ( string Size )

Initializes an empty Result1DComplex object with the given number of samples.

 

Load ( string FileName )

Loads a 1D Complex result from a file. The string FileName is the signal file name for the complex signal to be loaded. If you do not specify an absolute path, the path of the current project will be used. If you do not specify a file ending, the default file ending ".sig" will be used.

 

Note: The names used in the ResultTree do not necessarily correspond to the file names. The file names of tree items can be queried using the ResultTree Object.

 

Save ( string FileName )

Saves the object to a file with the given filename. If you do not specify an absolute path, the path of the current project will be used. If you do not specify a file ending, the default file ending ".sig" will be used.

 

LoadFromMagnitudeAndPhase ( string MagnitudeFilename , string PhaseFilename )

Loads a 1D Complex result out of two files. The string MagnitudeFilename specifies the file where the magnitude of the data is stored. The string PhaseFilename specifies the file where the phase in degree of the data is stored. If the two files have a different sampling, an error will be returned. If you do not specify an absolute path, the path of the current project will be used. If you do not specify a file ending, the default file ending ".sig" will be used.

 

LoadFromRealAndImaginary ( string RealFilename , string ImaginaryFilename )

Loads a 1D Complex result out of two files. The string RealFilename specifies the file where the real part of the data is stored. The string ImaginaryFilename specifies the file where the imaginary part of the data is stored. If the two files have a different sampling, an error will be returned. If you do not specify an absolute path, the path of the current project will be used. If you do not specify a file ending, the default file ending ".sig" will be used.

 

AddToTree ( string TreePath )

Inserts the Result1DComplex object into the tree at the folder specified by TreePath. Please note that the Result1DComplex object needs to be saved before it can be added to the tree. It will be automatically added below the "1D Results" tree folder.

 

Save ( name ObjectName )

Saves the object with the given filename. If you do not specify an absolute path, the path of the current project will be used. If you do not specify a file ending, the default file ending ".sig" will be used.

 

Clear

Deletes all data stored in the Result1DComplex object.

 

DeleteDataAt ( string Index )

Deletes the data point at the given index.

1D Complex to 1D Complex Operations

none

1D Complex to 1D Operations

Real Result 1D Object

Returns a Result1D Object filled with the real part of the data stored in the Result1DComplex object.

 

Imaginary Result 1D Object

Returns a Result1D Object filled with the imaginary part of the data stored in the Result1DComplex object.

 

Magnitude Result 1D Object

Returns a Result1D Object filled with the magnitude of the data stored in the Result1DComplex object.

 

Phase Result 1D Object

Returns a Result1D Object filled with the phase in degrees of the data stored in the Result1DComplex object.

Local Operations:

GetN long

Returns the number of elements in the Result1DComplex object.

 

GetX / GetYRe / GetYIm ( long Index ) double

Returns the x-value / the Real part of y / the Imaginary part of y at the specified index in the Result1DComplex object.

 

SetX / SetYRe / SetYIm ( long Index, double Value )

Sets the x-value / the Real part of y / the Imaginary part of y at the specified index in the Result1DComplex object.

 

GetDataFromIndex( long Index, double X, double YReal, double YImaginary )

Fills the variables X, YReal and YImaginary with the data point at the given index.

 

AppendXY( double XValue, double YReal , double YImaginary )

Appends a data point  to the end of the complex result object.

 

Xunit / Yunit( string Unit )

Sets the Unit string for the Result1DComplex object.

 

GetXunit / GetYunit string

Returns the Unit string of the Result1DComplex object.

 

ScalarMultReIm( string YReal, string YImaginary )

Multiplies all y-values of the current object with the given complex number.

 

ScalarMultAmPh( string YAmplitude, string YPhase)

Multiplies all y-values of the current object with the given complex number. The phase needs to be scaled in degrees.

 

Conjugate

Conjugates all complex y-values of the current object.

 

NthPower( string Exponent )

Raises each complex y-value of the current object to the real power of Exponent .

 

ResampleTo( string Min, string Max, string Samples )

Re-samples the data points of the object to a given number of samples between a minimum specified in Min and maximum value specified in Max. The new data samples are calculated using an interpolation of the original data samples. The method returns an error if less than three data points are contained in the object.

 

Add( Result 1D Complex Object Other )

Adds the complex y-values of the other object to the y-values of the current object. The number of points need to be the same in both objects. The x-values are taken from the current object.

 

Subtract( Result 1D Complex Object Other )

Subtracts the complex y-values of the other object from the y-values of the current object. The number of points need to be the same in both objects. The x-values are taken from the current object.

 

ComponentMult( Result 1D Complex Object Other )

Multiplies the complex y-values of the other object with the y-values of the current object. The number of points need to be the same in both objects. The x-values are taken from the current object.

 

ComponentDiv( Result 1D Complex Object Other )

Divides the complex y-values of the current object by the y-values of the other object. The method returns an error if a division by zero was encountered. The number of points need to be the same in both objects. The x-values are taken from the current object.

 

MakeCompatibleTo( Result1D Object/Result1DComplex Object Other )

Re-samples the result data of the current object to make it compatible to the sampling of the other object. The new data samples are calculated by an interpolation of the original data samples. The method returns an error if less than three data points are contained in the current object or less than two data points are contained in the other object.

 

ZthPower( Result 1D Complex Object Other )

Raises each complex y-value of the current object to the complex power of the y-value of the other object at the same index. The number of points need to be the same in both objects. The x-values remain unchanged. The method returns an error if an invalid operation was encountered (e.g. zero to the power of zero).

General Settings

Title / Xlabel / Ylabel ( string Name )

Defines the title / x-axis label / y-axis label of the result.  

 

GetTitle / GetXlabel / GetYlabel string

Returns the title / x-axis label / y-axis label of the result.

 

SetLogarithmicFactor( string LogFactor )

When the complex curve contained in the Result1DComplex object is visualized in dB, the logarithmic factor provides the scaling of the data. The string LogFactor can either be 10 for a power quantity, or 20 for a field quantity. The default is 20.

 

GetLogarithmicFactor double

Returns the logarithmic factor.

 

AttachImpedanceOfTreeItem( string Name )

If the Result1DComplex object is created and processed within a multiple template evaluation in the Template Based Postprocessing framework, this setting creates a separate result entry of the impedance of the specified tree item and attaches it to the result entry of the current Result1DComplex object to allow visualizing a Smith Chart.

 

GetAttachedImpedanceTreeItem string

Returns the tree item specified by AttachImpedanceOfTreeItem.

 

SetImpedanceTreeItem( string Name )

If the Result1DComplex object is created and processed within a multiple template evaluation in the Template Based Postprocessing framework, this setting stores a reference to a tree item. The data of this tree item is used as impedance data to allow visualizing a Smith Chart. The data is expected to be stored in complex data format.

 

GetImpedanceTreeItem string

Returns the tree item specified by SetImpedanceTreeItem.

 

SetDefaultPlotView( string Type  )

This setting specifies the default plot view type that should be used when a 1D plot of  this result is opened. The variable Type specifies the type of view that should be plotted and can be one of the following strings: "real", "imaginary", "magnitude", "magnitudedb", "phase", "polar", or an empty string. This setting is only considered if the Result1DComplex object is created and processed within a template evaluation in the Template Based Postprocessing framework.

 

GetDefaultPlotView string

Returns the default plot view type specified by SetDefaultPlotView.

Examples

This example creates an empty object, fills it with data and adds it to the ResultTree.

 

Dim result As Object

Set result = Result1DComplex("")

With result

    .AppendXY(1,1,1)

    .AppendXY(2,2,1)

    .AppendXY(3,2,2)

    .Title("A complex curve")

    .Save("a_file_name")

    .AddToTree("1D Results\Test\complex_curve")

End With