Solved

MODIFYSETTINGS for Interferograms

  • 18 February 2023
  • 1 reply
  • 99 views

When getting a text file with Zemax-generated data (e.g. a wavefront map) using a ZPL macro, one could specify certain settings such as sampling resolution. While OpticStudio User Manual gives these settings for wavefront map, surface sag, Huygens PSF, etc. in the MODIFYSETTINGS section, it does not have anything given for Interferograms.

 

If I have a multi-configuration file, how am I supposed to specify to obtain interferogram between, say, configuration 2 and 3? How should I specify the sampling resolution? Is there a way to specify these settings at all?

icon

Best answer by David.Nguyen 28 February 2023, 12:41

View original

1 reply

Userlevel 7
Badge +2

Hi ISHFM,

 

If you didn’t find these settings in the MODIFYSETTINGS section, then they probably aren’t implement. In this case, you’d have to ask Zemax whether and when they plan to implement those settings. However, in ZOS-API, the Interferogram analysis is fully implemented: it has specific settings and returns a DataGrid (instead of a text file that you then have to parse).

There’s a bit of a learning curve to using the ZOS-API but in case you’r still interested, I wrote a small snipet for you in Python (and Pythonnet 2.5.2, do not use Pythonnet 3.0 yet):

import numpy as np
import matplotlib.pyplot as plt


# Change the system configuration
TheSystem.MCE.SetCurrentConfiguration(2)

# Open new Interferogram analysis
Interferogram = TheSystem.Analyses.New_Interferogram()

# Retrieve Interferogram settings
InterferogramSettings = Interferogram.GetSettings()

# Change Interferogram settings
# (not exhaustive, the list of settings available can be found in the ZOS-API syntax help file)
InterferogramSettings.Field.SetFieldNumber(1) # Field
InterferogramSettings.Sampling = ZOSAPI.Analysis.SampleSizes.S_128x128 # Sampling

# Apply settings and run analysis
Interferogram.ApplyAndWaitForCompletion()

# Retrieve DataGrid
InterferogramDataGrid = Interferogram.GetResults().GetDataGrid(0).Values

# Transform DataGrid into array
InterferogramArray = reshape(InterferogramDataGrid,
InterferogramDataGrid.GetLength(0),
InterferogramDataGrid.GetLength(1))

# Plot Interferogram
plt.figure()
plt.imshow(InterferogramArray)
plt.show()

The “reshape” method should be in any template generated by OpticStudio from the Programming tab. You could change the configuration number in a For-loop and rerun your interferogram analysis everytime. This is the result that it gives me:

This is the full list of settings from the Syntax Help:

IAS_Field  Field [get]
IAS_Surface  Surface [get]
IAS_Wavelength  Wavelength [get]
SampleSizes  Sampling [get, set]
ShowAs  ShowAs [get, set]
Beam  Beam_1 [get, set]
Beam  Beam_2 [get, set]
bool  Ref_Beam_1_To_Vertex [get, set]
bool  Ref_Beam_2_To_Vertex [get, set]
bool  UseExitPupil [get, set]
bool  ConsiderOPL [get, set]
double  ScaleFactor [get, set]
double  X_Tilt [get, set]
double  Y_Tilt [get, set]
double  Subaperture_X [get, set]
double  Subaperture_Y [get, set]
double  Subaperture_R [get, set]
String  ContourFormat [get, set]

I hope this helps, and take care,

 

David

Reply