Solved

Zygo DAT file import for grid phase surface?

  • 10 October 2022
  • 1 reply
  • 767 views

  • Single Emitter
  • 3 replies

I’m trying to import a Zygo generated WFE (phase -- saved as a .DAT file) file provided by a vendor as a grid phase surface. When I select the file and click “import” I get the error “Grid files must have at least 5 rows and 5 columns.” The file appears to be a binary metropro dat format, it’s unclear how to reformat the data to make it more friendly for import. I am using version 21.2.2 Premium. Is there a way to import these files or convert them such that they can be imported?

icon

Best answer by David.Nguyen 11 October 2022, 12:36

View original

1 reply

Userlevel 7
Badge +2

Hi asdf,

 

The format for grid files is described in the Help File of the Grid Sag surface:

 

Importing Grid Data

All of this data must be computed and tabulated outside of OpticStudio, arranged in the proper file format, and then read using the Import section of the Surface Properties. The proper file format is as follows:

 nx ny delx dely unitflag xdec ydec z dz/dx dz/dy d2z/dxdy nodata... 

The first line in the file contains seven values, which define the (integer) number of points in the x and y directions, the (floating point) increment in the x and y directions (positive values are assumed, only the absolute values of delx and dely are taken into account), an (integer) flag indicating the units of the data: 0 for mm, 1 for cm, 2 for in, and 3 for meters, and the (floating point) decenter of the grid points relative to the base surface in x and y. Any required scaling to the current lens units will be performed. Note that sag and cross derivative values have dimensions, and are therefore scaled, but first derivative values are dimensionless, and are not scaled.

The remaining nx*ny lines of the file contain four (floating point) numbers and (optionally) one integer each. The four floating point values are the sag, the x derivative of the sag, the y derivative of the sag, and the cross derivative d/dxdy. The optional fifth data entry is an integer flag that indicates if the data is invalid. Valid measured data should either have a zero or blank space for the nodata flag. Points for which the data is not valid should have a nodata value of unity.

If the nodata value is unity, the whole line of entries will be replaced with zeros and only the base portion of the sag will be used for calculations. If any entry in the grid sag table is not a number, the entry is replaced with zero.

The first data line in the file corresponds to the upper left corner of the surface, that is, the corner defined by -x and +y limits. Each point that follows is read across the face of the surface from left to right. After nx points, the nx+1 point is read in as the first value in row 2, and so on until nx*ny points have been read in. The file must be in ASCII and end in the extension .DAT (for files used by NSC objects, the extension should be .GRD).

The derivative values are required for smooth bicubic interpolation of the sag between the data points. The derivative values are not used by the linear interpolation algorithm. If all of the derivative values (dz/dx, dz/dy, and d2z/dxdy) are zero for every point in the file, then OpticStudio will automatically estimate the derivatives using a finite difference method.

The grid sag file format also supports comment lines. Any line starting with the "!" character is ignored.

 

The key format differences are indicated in the Help File of the Grid Phase surface:

 

Grid Phase

 

This surface is nearly identical to the Grid Sag surface (see “Grid Sag”). The key differences are:

  • The units of sag are radians of phase instead of units of length.
  • The unitflag data is only used to scale the delx, dely, and derivative values.
  • The surface shape is a plane.
  • A diffraction order is supported. The diffraction order is a multiplier on the phase values. A value of zero will turn "off" the phase effects. Setting the order to -1 will reverse the sign of all defined phase values.
  • A "shear distance" is supported. See "Using the shear distance" below.

The Interpolate column determines the interpolation method used between the data points. Use 0 for bicubic spline, 1 for linear, and 2 for pixelated. For interpolation methods 0 and 1 the phase and phase slope vary continuously over the surface. When using interpolation method 2, the Grid Phase surface will have distinct pixels. The phase change is determined based on the individual pixel. The phase slope will be determined based on the derivatives (dz/dx, dz/dy, and d2z/dxdy) present in the .dat file. If all derivative values are zero for every point in the file, then OpticStudio will automatically estimate the derivatives based on the pixel and the neighboring values.

The file format and general information provided in the grid sag description is otherwise valid.

 

If your grid phase file is a binary file, you need to get the format of that file from the vendor such that you can then transform it to the OpticStudio format.

I hope that makes sense.

Take care,

 

 

David

Reply