STAR API Example: Deformation data

  • 16 February 2022
  • 2 replies
  • 545 views

Userlevel 4
Badge +1

I’ve attached an example of using the ZOS-API to add deformation data to a surface using STAR.

The system is a simple spherical singlet:

The (artificial) deformation data adds a 4th order aspheric term to the surface, which removes the spherical aberration from the system.  The spot diagrams before and after are shown below.

Within the API, the STAR information is mainly stored with particular surfaces in the LDE, like this:

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations

mySystem.LDE.GetSurfaceAt(3).STARData.Temperatures

 

And under Deformations, there are options for RBMs, Fits, FEAData, and CoordinateTransform.  

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.FEAData - Allows you to retrieve the raw FEA data points and information about those points.

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.Fits - Allows you to retrieve information about the fitted data, such as any {X, Y, Z, dX, dY, dZ) point.

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.RBMs - Allows you to display & manipulate any rigid-body-motions present in the FEA deformations.  Also allows you to choose whether to include the RBMs while carrying out the fit (though RBMs should almost always be removed and excluded from the fitting process; they are returned to the data set after the fit).

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.CoordinateTransform - Allows you to apply a coordinate transform to the data if the input {X, Y, Z} points are in the wrong coordinate system.  This also accurately calculates the deformations in the new coordinate system.

 

Also under Deformations, you can specify whether the FEA data set is in ZOS Local coordinates (at the vertex of the surface) or ZOS global coordinates (as specified in the System Explorer under Aperture):

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.SetDataIsLocal();

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.IsDataLocalCS()

 

The command that starts a fit and loads the deformation data into STAR is:

mySystem.LDE.GetSurfaceAt(3).STARData.Deformations.FEAData.ImportDeformations( filename )

 

The code I’ve shared is written in Mathematica.  You can also look at the .pdf version of the file to see the relevant code.  If you’re using another tool, such as Matlab, the ZOS-API parts of the code are easy to translate, as shown in the example below.  “Module” and “Table” are unique to Mathematica, but large parts of the code are from the API and can be translated directly into your favorite tool.  For example, in Mathematica, I would use startingSystem@LDE@NumberOfSurfaces.  The equivalent in Matlab would be startingSystem.LDE.NumberOfSurfaces.

 

To use the .nb file directly, you will have to manually update the paths in this section:

 


2 replies

Userlevel 4
Badge +1

Attachments are here.  This is the Mathematica version.  (We’ll add a Matlab version soon.)

Userlevel 1
Badge

For all Python users I have created a similar script. Please use the optical system and the FEA data from Erin's attachment.

Reply