Can I reformat data output from analysis windows?

  • 28 May 2020
  • 1 reply
  • 207 views

Userlevel 5
Badge +1

I have some data (such as the text output from a Surface Sag or Surface Phase window). I would like to save this data, but with a different representation of the significant digits. Is there any way to accomplish this?


1 reply

Userlevel 5
Badge +1

While we do have a Copy button in the toolbar for any analysis window with text output, it might be more efficient to instead approach this by outputting the values for the associated Merit Function Editor operand in a text file. For example, let's say we wanted to save the Surface Phase data for the following Zernike Fringe Phase surface:



The text output itself will always be in scientific notation with six digits following the decimal point:



To get this same set of data, what we could instead do is leverage the ZPL with the OCOD/OPEV functions to read in Surface Phase data and save it to an array. Once the data is saved to the array, we can then use the FORMAT keyword to re-define how we want the number data represented and the OUTPUT keyword to define a text file name to save the file to. For further information on the syntax for these keywords, we recommend you take a look at our Help File documentation.


An example ZPL file is provided here for your reference as well as this demo file. Please note that if you run the ZPL with no modifications, the resulting text file will be saved to your {Zemax}\Macros folder, since no file path is specified. The following is the output TXT file:



Feel free to reply to this thread if there are any follow up questions!


~ Angel

Reply