Skip to main content

ZOS-API interface 2024 R2 SP02

ZOSAPI.Analysis.Data.IAR_DataSeries Interface Reference

Last update: 17.07.2025

Public Member Functions

IAR_DataSeriesRgb ConvertToRGB (IColorTranslator translator)
 

Properties

String Description [get]
 
String XLabel [get]
 
IVectorData XData [get]
 
String[] SeriesLabels [get]
 
int NumSeries [get]
 
IMatrixData YData [get]
 

Detailed Description

Usage (see Example 23 for a full sample)

C#

// runs a ray fan analysis and extracts
ZOSAPI.Analysis.IA_ ray = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.RayFan);
ray_settings.NumberOfRays = max_rays / 2;
ray_settings.Field.UseAllFields();
ray_settings.Wavelength.UseAllWavelengths();
Properties and methods for retrieving analysis window data. This interface can be accessed via the IA...
Definition: IAR_Base.cs:21
Base interface for all analysis windows. This interface can be accessed via the I_Analyses interface.
Definition: IA_Base.cs:29
IAR_ GetResults()
Gets the result data (if available) for the current analysis.
IAS_ GetSettings()
Gets the settings for the current analysis.
IMessage ApplyAndWaitForCompletion()
Re-runs the analysis with the current settings and waits for it to finish calculating.
Definition: IAS_Fan.cs:24
IAS_Wavelength Wavelength
Definition: IAS_Fan.cs:27
IAS_Field Field
Definition: IAS_Fan.cs:25
Definition: IAS_Fan.cs:5
Definition: IAS_FieldCurvatureAndDistortion.cs:5
Definition: IAS_FieldCurvatureAndDistortion.cs:5
The ZOSAPI namespace contains classes for initially connecting to zemax. See also ZOSAPI_Connection,...
Definition: IAS_FieldCurvatureAndDistortion.cs:5

C++

// Set up Ray Fan analysis
IA_Ptr ray = TheSystem->Analyses->New_Analysis(AnalysisIDM_RayFan);
IAS_Ptr ray_set = ray->GetSettings();
IAS_FanPtr ray_fanset = ray_set;
ray_fanset->NumberOfRays = max_rays / 2;
ray_fanset->Field->UseAllFields();
ray_fanset->Wavelength->UseAllWavelengths();
ray->ApplyAndWaitForCompletion();
IAR_Ptr ray_results = ray->GetResults();

Matlab

% runs a ray fan analysis and extracts
ray = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.RayFan);
ray_settings = ray.GetSettings();
ray_settings.NumberOfRays = max_rays / 2;
ray_settings.Field.UseAllFields();
ray_settings.Wavelength.UseAllWavelengths();
ray.ApplyAndWaitForCompletion();
ray_results = ray.GetResults();

Python

ray = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.RayFan)
ray_settings = ray.GetSettings()
ray_settings.NumberOfRays = max_rays / 2
ray_settings.Field.UseAllFields()
ray_settings.Wavelength.UseAllWavelengths()
ray.ApplyAndWaitForCompletion()
ray_results = ray.GetResults()

Member Function Documentation

◆ ConvertToRGB()

IAR_DataSeriesRgb ZOSAPI.Analysis.Data.IAR_DataSeries.ConvertToRGB ( IColorTranslator  translator)

Property Documentation

◆ Description

String ZOSAPI.Analysis.Data.IAR_DataSeries.Description
get

◆ NumSeries

int ZOSAPI.Analysis.Data.IAR_DataSeries.NumSeries
get

◆ SeriesLabels

String [] ZOSAPI.Analysis.Data.IAR_DataSeries.SeriesLabels
get

◆ XData

IVectorData ZOSAPI.Analysis.Data.IAR_DataSeries.XData
get

Usage (see Example 04 for a full sample)

C#

// Read data series
System.Text.StringBuilder sbReport = new System.Text.StringBuilder();
sbReport.Append("X Data\t");
for (int i = 0; i < newWin_Results.NumberOfDataSeries; i++)
{
sbReport.Append("Series " + i + "\t\t");
}
sbReport.AppendLine("");
for (int k = 0; k < newWin_Results.GetDataSeries(0).XData.Length; k++)
{
sbReport.Append(newWin_Results.GetDataSeries(0).XData.GetValueAt(k) + "\t");
for (int i = 0; i < newWin_Results.NumberOfDataSeries; i++)
{
for (int j = 0; j < newWin_Results.GetDataSeries(i).NumSeries; j++)
{
sbReport.Append(newWin_Results.GetDataSeries(i).YData.GetValueAt(k, j) + "\t");
}
}
sbReport.AppendLine("");
}
string resFile = TheApplication.SamplesDir + "\\API\\CS\\e04_pull_data_from_FFTMT.txt";
System.IO.File.WriteAllText(resFile, sbReport.ToString());

C++

// Export the data series to a text file
fstream textfile;
string filepath = sampleDir + "\\API\\CPP\\e04_pull_data_from_FFTMTF.txt";
textfile.open(filepath, fstream::trunc | ios::out);
for (int i = 0; i < newWin_Results->NumberOfDataSeries; i++) {
IAR_DataSeriesPtr dataseries = newWin_Results->GetDataSeries(i);
for (int j = 0; j < dataseries->NumSeries; j++) {
textfile << "\nSeries " << i << " - " << j << " : (X, Y)" << endl;
for (int k = 0; k < dataseries->GetXData()->Length; k++) {
textfile << dataseries->GetXData()->GetValueAt(k) << "\t";
textfile << dataseries->GetYData()->GetValueAt(k, j) << endl;
}
}
}

Matlab

% Read and plot data series
dataSeries = newWin_Results.DataSeries;
cc=lines(double(newWin_Results.NumberOfDataSeries));
for gridN=1:newWin_Results.NumberOfDataSeries
data = dataSeries(gridN);
y = data.YData.Data.double;
x = data.XData.Data.double;
plot(x,y(:,1),'-','color',cc(gridN,:));
plot(x,y(:,2),':','color',cc(gridN,:));
end

Python

# Read and plot data series
# NOTE: numpy functions are used to unpack and plot the 2D tuple for Sagittal & Tangential MTF
# You will need to import the numpy module to get this part of the code to work
colors = ('b','g','r','c', 'm', 'y', 'k')
for seriesNum in range(0,newWin_Results.NumberOfDataSeries, 1):
data = newWin_Results.GetDataSeries(seriesNum)
# get raw .NET data into numpy array
xRaw = data.XData.Data
yRaw = data.YData.Data
x = list(xRaw)
y = zos.reshape(yRaw, yRaw.GetLength(0), yRaw.GetLength(1), True)
plt.plot(x,y[0],color=colors[seriesNum])
plt.plot(x,y[1],linestyle='--',color=colors[seriesNum])
Examples
CSharpStandalone_04_pull_data_from_FFTMTF.cs, and CSharpStandalone_23_ray_fan_native_manual_comparison.cs.

◆ XLabel

String ZOSAPI.Analysis.Data.IAR_DataSeries.XLabel
get

◆ YData

Connect with Ansys