Skip to main content

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?

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 Fget]
IAS_Surface  Surface uget]
IAS_Wavelength  Wavelength eget]
SampleSizes  Sampling Sget, set]
ShowAs  ShowAs cget, set]
Beam  Beam_1 gget, set]
Beam  Beam_2 uget, set]
bool  Ref_Beam_1_To_Vertex _get, set]
bool  Ref_Beam_2_To_Vertex mget, set]
bool  UseExitPupil "get, set]
bool  ConsiderOPL gget, set]
double  ScaleFactor uget, set]
double  X_Tilt oget, set]
double  Y_Tilt fget, set]
double  Subaperture_X get, set]
double  Subaperture_Y wget, set]
double  Subaperture_R oget, set]
String  ContourFormat lget, set]

I hope this helps, and take care,

 

David


Reply