Skip to main content

ZOS-API interface 2025 R1

ZOSAPI.Analysis.Data.IAR_ Interface Reference

Last update: 17.07.2025

Properties and methods for retrieving analysis window data. This interface can be accessed via the IA_ interface. Note that not all analysis types currently return detailed results via this interface, however all analyses that support text output should support the GetTextFile method. See the OpticStudio manual for more information. More...

Public Member Functions

IAR_DataGrid GetDataGrid (int index)
 
IAR_DataGridRgb GetDataGridRgb (int index)
 
IAR_DataSeries GetDataSeries (int index)
 
IAR_DataSeriesRgb GetDataSeriesRgb (int index)
 
IAR_DataScatterPoints GetDataScatterPoint (int index)
 
IAR_DataScatterPointsRgb GetDataScatterPointRgb (int index)
 
IAR_RayData GetRayData (int index)
 
IMessage GetMessageAt (int index)
 
bool GetTextFile (String Filename)
 This function provides similar functionality to the DDE and ZPL commands GETTEXTFILE.
 

Properties

IAR_MetaData MetaData [get]
 
IAR_HeaderData HeaderData [get]
 
int NumberOfDataGrids [get]
 
IAR_DataGrid[] DataGrids [get]
 
int NumberOfDataGridsRgb [get]
 
IAR_DataGridRgb[] DataGridsRgb [get]
 
int NumberOfDataSeries [get]
 
IAR_DataSeries[] DataSeries [get]
 
int NumberOfDataSeriesRgb [get]
 
IAR_DataSeriesRgb[] DataSeriesRgb [get]
 
int NumberOfDataScatterPoints [get]
 
IAR_DataScatterPoints[] DataScatterPoints [get]
 
int NumberOfDataScatterPointsRgb [get]
 
IAR_DataScatterPointsRgb[] DataScatterPointsRgb [get]
 
int NumberOfRayData [get]
 
IAR_RayData[] RayData [get]
 
IAR_CriticalRayData CriticalRayData [get]
 
IAR_PathAnalysisData PathAnalysisData [get]
 
IAR_SpotDataResultMatrix SpotData [get]
 
IAR_NSCSingleRayTraceData NSCSingleRayTraceData [get]
 
int NumberOfMessages [get]
 
IMessage[] Messages [get]
 

Detailed Description

Properties and methods for retrieving analysis window data. This interface can be accessed via the IA_ interface. Note that not all analysis types currently return detailed results via this interface, however all analyses that support text output should support the GetTextFile method. See the OpticStudio manual for more information.

Examples
CSharpStandalone_04_pull_data_from_FFTMTF.cs, CSharpStandalone_10_NSC_ZRD_filter_string.cs, CSharpStandalone_22_seq_spot_diagram.cs, CSharpStandalone_23_ray_fan_native_manual_comparison.cs, CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.

Member Function Documentation

◆ GetDataGrid()

IAR_DataGrid ZOSAPI.Analysis.Data.IAR_.GetDataGrid ( int  index)

◆ GetDataGridRgb()

IAR_DataGridRgb ZOSAPI.Analysis.Data.IAR_.GetDataGridRgb ( int  index)

Usage (see Example 24 for a full sample)

C#

// Creates a new detector viewer analysis reference
ZOSAPI.Analysis.IA_ d4 = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer);
d4_settings.Detector.SetDetectorNumber(4);
d4_settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.TrueColor;
Definition: IAR_Base.cs:286
Properties and methods for retrieving analysis window data. This interface can be accessed via the IA...
Definition: IAR_Base.cs:21
IAR_DataGridRgb GetDataGridRgb(int index)
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_DetectorViewer.cs:23
IAS_Detector Detector
Definition: IAS_DetectorViewer.cs:25
Definition: IAR_Base.cs:11
Definition: IAS_DetectorViewer.cs:6
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++

// Creates a new detector viewer analysis reference
IA_Ptr d4 = TheSystem->Analyses->New_Analysis(AnalysisIDM::AnalysisIDM_DetectorViewer);
IAS_DetectorViewerPtr d4_settings = d4->GetSettings();
d4_settings->Detector->SetDetectorNumber(4);
d4_settings->ShowAs = DetectorViewerShowAsTypes_TrueColor;
d4->ApplyAndWaitForCompletion();
IAR_Ptr d4_results = d4->GetResults();
IAR_DataGridRgbPtr d4_raw = d4_results->GetDataGridRgb(0);

Matlab

% Creates a new detector viewer analysis reference, changes to TrueColor for RGB extraction
d4 = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer);
d4_settings = d4.GetSettings();
d4_settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.TrueColor;
d4_settings.Detector.SetDetectorNumber(4);
d4.ApplyAndWaitForCompletion();
d4_Results = d4.GetResults();
d4_raw = d4_Results.DataGridsRgb.Get(0);

Python

# Creates a new detector viewer analysis reference, changes to TrueColor for RGB extraction
d4 = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.DetectorViewer)
det_settings = d4.GetSettings()
det_settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.TrueColor
det_settings.Detector.SetDetectorNumber(4);
d4.ApplyAndWaitForCompletion()
d4_Results = d4.GetResults()
d4_raw = d4_Results.GetDataGridRgb(0)
Examples
CSharpStandalone_24_nsc_detectors.cs, and CSharpStandalone_25_source_spectrum_diffraction_grating.cs.

◆ GetDataScatterPoint()

IAR_DataScatterPoints ZOSAPI.Analysis.Data.IAR_.GetDataScatterPoint ( int  index)

◆ GetDataScatterPointRgb()

IAR_DataScatterPointsRgb ZOSAPI.Analysis.Data.IAR_.GetDataScatterPointRgb ( int  index)

◆ GetDataSeries()

IAR_DataSeries ZOSAPI.Analysis.Data.IAR_.GetDataSeries ( int  index)

◆ GetDataSeriesRgb()

IAR_DataSeriesRgb ZOSAPI.Analysis.Data.IAR_.GetDataSeriesRgb ( int  index)

◆ GetMessageAt()

IMessage ZOSAPI.Analysis.Data.IAR_.GetMessageAt ( int  index)

◆ GetRayData()

IAR_RayData ZOSAPI.Analysis.Data.IAR_.GetRayData ( int  index)

◆ GetTextFile()

bool ZOSAPI.Analysis.Data.IAR_.GetTextFile ( String  Filename)

This function provides similar functionality to the DDE and ZPL commands GETTEXTFILE.

Usage (see Example 10 for a full sample)

C#

// Save Ray Path Analysis to Text File
if (TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition)
{
IA_ RayPath = TheSystem.Analyses.New_Analysis(AnalysisIDM.PathAnalysis);
RayPath_settings.RayDatabaseFile = "e10_API_RayTrace.ZRD";
IAR_ Rays = RayPath.GetResults();
Rays.GetTextFile(TheApplication.SamplesDir + "\\API\\CS\\e10_RayPathAnalysis.txt");
}
else
{
Console.Write("\nThe RayPathAnalysis is a premium feature only\n\nPress any key to continue\n");
Console.ReadKey();
}
bool GetTextFile(String Filename)
This function provides similar functionality to the DDE and ZPL commands GETTEXTFILE.
Definition: IAS_PathAnalysis.cs:40
Definition: IAS_PathAnalysis.cs:10
AnalysisIDM
All available analysis types. See the I_Analyses interface for more information.
Definition: I_Analyses.cs:15

C++

// Save Ray Path Analysis to Text File
if (TheApplication->LicenseStatus == ZOSAPI_Interfaces::LicenseStatusType::LicenseStatusType_PremiumEdition) {
IA_Ptr RayPath = TheSystem->Analyses->New_Analysis(AnalysisIDM_PathAnalysis);
ZOSAPI_Interfaces::IAS_PathAnalysisPtr RayPath_settings = RayPath->GetSettings();
RayPath_settings->RayDatabaseFile = "e10_API_RayTrace.ZRD";
RayPath->ApplyAndWaitForCompletion();
IAR_Ptr Rays = RayPath->GetResults();
Rays->GetTextFile(TheApplication->SamplesDir + "\\API\\CPP\\e10_RayPathAnalysis.txt");
}

Matlab

% Save Ray Path Analysis to Text File
if TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition
RayPath = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PathAnalysis);
RayPath_settings = RayPath.GetSettings();
RayPath_settings.RayDatabaseFile = 'e10_API_Raytrace.ZRD';
RayPath.ApplyAndWaitForCompletion();
Rays = RayPath.GetResults();
Rays.GetTextFile(System.String.Concat(TheApplication.SamplesDir, '\API\Matlab\e10_RayPathAnalysis.txt'));
else
fprintf('\nThe RayPathAnalysis is a premium feature only\n');
end

Python

# Save Ray Path Analysis to Text File
if (TheApplication.LicenseStatus == ZOSAPI.LicenseStatusType.PremiumEdition):
# there is a bug in ZOS16.5 SP4 with COM; need to use ZOS16.5 SP5 or higher to run this code successfully
RayPath = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.PathAnalysis)
RayPath_settings = RayPath.GetSettings()
zrd = "e10_API_RayTrace.ZRD"
RayPath_settings.RayDatabaseFile = zrd
RayPath.ApplyAndWaitForCompletion()
Rays = RayPath.GetResults()
Rays.GetTextFile(TheApplication.SamplesDir + "\\API\\Python\\e10_RayPathAnalysis.txt")
Parameters
FilenameThe output filename to store the text results data.
Returns
true if the output file was successfully created; otherwise, false.
Examples
CSharpStandalone_10_NSC_ZRD_filter_string.cs.

Property Documentation

◆ CriticalRayData

IAR_CriticalRayData ZOSAPI.Analysis.Data.IAR_.CriticalRayData
get

◆ DataGrids

IAR_DataGrid [] ZOSAPI.Analysis.Data.IAR_.DataGrids
get

◆ DataGridsRgb

IAR_DataGridRgb [] ZOSAPI.Analysis.Data.IAR_.DataGridsRgb
get

◆ DataScatterPoints

IAR_DataScatterPoints [] ZOSAPI.Analysis.Data.IAR_.DataScatterPoints
get

◆ DataScatterPointsRgb

IAR_DataScatterPointsRgb [] ZOSAPI.Analysis.Data.IAR_.DataScatterPointsRgb
get

◆ DataSeries

IAR_DataSeries [] ZOSAPI.Analysis.Data.IAR_.DataSeries
get

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();
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

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()
Examples
CSharpStandalone_23_ray_fan_native_manual_comparison.cs.

◆ DataSeriesRgb

IAR_DataSeriesRgb [] ZOSAPI.Analysis.Data.IAR_.DataSeriesRgb
get

◆ HeaderData

IAR_HeaderData ZOSAPI.Analysis.Data.IAR_.HeaderData
get

◆ Messages

IMessage [] ZOSAPI.Analysis.Data.IAR_.Messages
get

◆ MetaData

IAR_MetaData ZOSAPI.Analysis.Data.IAR_.MetaData
get

◆ NSCSingleRayTraceData

IAR_NSCSingleRayTraceData ZOSAPI.Analysis.Data.IAR_.NSCSingleRayTraceData
get

◆ NumberOfDataGrids

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataGrids
get

◆ NumberOfDataGridsRgb

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataGridsRgb
get

◆ NumberOfDataScatterPoints

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataScatterPoints
get

◆ NumberOfDataScatterPointsRgb

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataScatterPointsRgb
get

◆ NumberOfDataSeries

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataSeries
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.

◆ NumberOfDataSeriesRgb

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataSeriesRgb
get

◆ NumberOfMessages

int ZOSAPI.Analysis.Data.IAR_.NumberOfMessages
get

◆ NumberOfRayData

int ZOSAPI.Analysis.Data.IAR_.NumberOfRayData
get

◆ PathAnalysisData

IAR_PathAnalysisData ZOSAPI.Analysis.Data.IAR_.PathAnalysisData
get

◆ RayData

IAR_RayData [] ZOSAPI.Analysis.Data.IAR_.RayData
get

◆ SpotData

IAR_SpotDataResultMatrix ZOSAPI.Analysis.Data.IAR_.SpotData
get

Usage (see Example 22 for a full sample)

C#

// Extract RMS & Geo spot size for field points
spot.ApplyAndWaitForCompletion();
ZOSAPI.Analysis.Data.IAR_ spot_results = spot.GetResults();
Console.WriteLine("RMS radius: {0:F3} {1:F3} {2:F3}", spot_results.SpotData.GetRMSSpotSizeFor(1, 1), spot_results.SpotData.GetRMSSpotSizeFor(2, 1), spot_results.SpotData.GetRMSSpotSizeFor(3, 1));
Console.WriteLine("GEO radius: {0:F3} {1:F3} {2:F3}", spot_results.SpotData.GetGeoSpotSizeFor(1, 1), spot_results.SpotData.GetGeoSpotSizeFor(2, 1), spot_results.SpotData.GetGeoSpotSizeFor(3, 1));
double GetRMSSpotSizeFor(int fieldN, int waveN)
double GetGeoSpotSizeFor(int fieldN, int waveN)
IAR_SpotDataResultMatrix SpotData
Definition: IAR_Base.cs:104

C++

// Extract RMS & Geo spot size for field points
spot->ApplyAndWaitForCompletion();
IAR_Ptr spot_results = spot->GetResults();
cout.precision(3);
cout << fixed << "RMS radius: \t" << spot_results->SpotData->GetRMSSpotSizeFor(1, 1) << "\t" << spot_results->SpotData->GetRMSSpotSizeFor(2, 1) << "\t" << spot_results->SpotData->GetRMSSpotSizeFor(3, 1) << endl;
cout << fixed << "GEO radius: \t" << spot_results->SpotData->GetGeoSpotSizeFor(1, 1) << "\t" << spot_results->SpotData->GetGeoSpotSizeFor(2, 1) << "\t" << spot_results->SpotData->GetGeoSpotSizeFor(3, 1) << endl;

Matlab

% extract RMS & Geo spot size for field points
spot.ApplyAndWaitForCompletion();
spot_results = spot.GetResults();
fprintf('RMS radius: %6.3f %6.3f %6.3f\n',spot_results.SpotData.GetRMSSpotSizeFor(1,1),spot_results.SpotData.GetRMSSpotSizeFor(2,1),spot_results.SpotData.GetRMSSpotSizeFor(3,1))
fprintf('GEO radius: %6.3f %6.3f %6.3f\n',spot_results.SpotData.GetGeoSpotSizeFor(1,1),spot_results.SpotData.GetGeoSpotSizeFor(2,1),spot_results.SpotData.GetGeoSpotSizeFor(3,1))

Python

# extract RMS & Geo spot size for field points
spot.ApplyAndWaitForCompletion()
#spot_results = spot.GetResults()
spot_results = spot.GetResults()
print('RMS radius: %6.3f %6.3f %6.3f' % (spot_results.SpotData.GetRMSSpotSizeFor(1, 1), spot_results.SpotData.GetRMSSpotSizeFor(2, 1), spot_results.SpotData.GetRMSSpotSizeFor(3, 1)))
print('GEO radius: %6.3f %6.3f %6.3f' % (spot_results.SpotData.GetGeoSpotSizeFor(1, 1), spot_results.SpotData.GetGeoSpotSizeFor(2, 1), spot_results.SpotData.GetGeoSpotSizeFor(3, 1)))
Examples
CSharpStandalone_22_seq_spot_diagram.cs.

Connect with Ansys