Skip to main content

Zemax OpticStudio ZOS-API 2026 R1

Interface ZOSAPI::Analysis::Data::IAR_

Last update: 13.03.2026

Definition:

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.

Members

Properties

Property MetaData

Definition:

IAR_MetaData ZOSAPI.Analysis.Data.IAR_.MetaData

Return type: IAR_MetaData

Property HeaderData

Definition:

IAR_HeaderData ZOSAPI.Analysis.Data.IAR_.HeaderData

Return type: IAR_HeaderData

Property NumberOfDataGrids

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataGrids

Return type: int

Property DataGrids

Definition:

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

Return type: IAR_DataGrid[]

Property NumberOfDataGridsRgb

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataGridsRgb

Return type: int

Property DataGridsRgb

Definition:

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

Return type: IAR_DataGridRgb[]

Property NumberOfDataSeries

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataSeries

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])        

Return type: int

Property DataSeries

Definition:

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

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);
            ZOSAPI.Analysis.Settings.Fans.IAS_Fan ray_settings = (ZOSAPI.Analysis.Settings.Fans.IAS_Fan)ray.GetSettings();
            ray_settings.NumberOfRays = max_rays / 2;
            ray_settings.Field.UseAllFields();
            ray_settings.Wavelength.UseAllWavelengths();

            ray.ApplyAndWaitForCompletion();
            ZOSAPI.Analysis.Data.IAR_ ray_results = ray.GetResults();

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

Return type: IAR_DataSeries[]

Property NumberOfDataSeriesRgb

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataSeriesRgb

Return type: int

Property DataSeriesRgb

Definition:

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

Return type: IAR_DataSeriesRgb[]

Property NumberOfDataScatterPoints

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataScatterPoints

Return type: int

Property DataScatterPoints

Definition:

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

Return type: IAR_DataScatterPoints[]

Property NumberOfDataScatterPointsRgb

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfDataScatterPointsRgb

Return type: int

Property DataScatterPointsRgb

Definition:

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

Return type: IAR_DataScatterPointsRgb[]

Property NumberOfRayData

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfRayData

Return type: int

Property RayData

Definition:

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

Return type: IAR_RayData[]

Property CriticalRayData

Definition:

IAR_CriticalRayData ZOSAPI.Analysis.Data.IAR_.CriticalRayData

Return type: IAR_CriticalRayData

Property PathAnalysisData

Definition:

IAR_PathAnalysisData ZOSAPI.Analysis.Data.IAR_.PathAnalysisData

Return type: IAR_PathAnalysisData

Property SpotData

Definition:

IAR_SpotDataResultMatrix ZOSAPI.Analysis.Data.IAR_.SpotData

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

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

Return type: IAR_SpotDataResultMatrix

Property NSCSpotData

Definition:

IAR_NSCSpotResults ZOSAPI.Analysis.Data.IAR_.NSCSpotData

Return type: IAR_NSCSpotResults

Property NSCSingleRayTraceData

Definition:

IAR_NSCSingleRayTraceData ZOSAPI.Analysis.Data.IAR_.NSCSingleRayTraceData

Return type: IAR_NSCSingleRayTraceData

Property NumberOfMessages

Definition:

int ZOSAPI.Analysis.Data.IAR_.NumberOfMessages

Return type: int

Property Messages

Definition:

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

Return type: IMessage[]

Public functions

Function GetDataGrid

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

Parameters:

  • int index

Return type: IAR_DataGrid

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

            ZOSAPI.Analysis.Settings.RayTracing.IAS_DetectorViewer d4_settings = d4.GetSettings() as ZOSAPI.Analysis.Settings.RayTracing.IAS_DetectorViewer;
            d4_settings.Detector.SetDetectorNumber(4);
            d4_settings.ShowAs = ZOSAPI.Analysis.DetectorViewerShowAsTypes.TrueColor;
            d4.ApplyAndWaitForCompletion();

            ZOSAPI.Analysis.Data.IAR_ d4_Results = d4.GetResults();
            ZOSAPI.Analysis.Data.IAR_DataGridRgb d4_raw = d4_Results.GetDataGridRgb(0) as ZOSAPI.Analysis.Data.IAR_DataGridRgb;

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)

Parameters:

  • int index

Return type: IAR_DataGridRgb

Function GetDataSeries

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

Parameters:

  • int index

Return type: IAR_DataSeries

Function GetDataSeriesRgb

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

Parameters:

  • int index

Return type: IAR_DataSeriesRgb

Function GetDataScatterPoint

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

Parameters:

  • int index

Return type: IAR_DataScatterPoints

Function GetDataScatterPointRgb

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

Parameters:

  • int index

Return type: IAR_DataScatterPointsRgb

Function GetRayData

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

Parameters:

  • int index

Return type: IAR_RayData

Function GetMessageAt

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

Parameters:

  • int index

Return type: IMessage

Function 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);
                ZOSAPI.Analysis.RayTracing.IAS_PathAnalysis RayPath_settings = RayPath.GetSettings() as ZOSAPI.Analysis.RayTracing.IAS_PathAnalysis;
                RayPath_settings.RayDatabaseFile = "e10_API_RayTrace.ZRD";
                RayPath.ApplyAndWaitForCompletion();
                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();
            }

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:

  • Filename: The output filename to store the text results data.

Returns:

true if the output file was successfully created; otherwise, false.

Parameters:

  • String Filename

Return type: bool

Connect with Ansys