Question

New ZRD file format


There used to be the possiblity to export ray trace data into a Ray Database File (ZRD) file with well documented binary file format. I used this a lot to read the data into a python numpy array for further analysis.
Documentation still states: “thus the first integer will be 2002 for UFD format, 12002 for CBD format, and 22002 for CFD format ZRD files.”

But with Opticstudion 2024.1 when selecting “uncompressed full data” the first integer number in the file is 2003. And the format of the file has changed. 

Is there a way to make zemax export to the old 2002-Format or at least a documentation for the new format?


3 replies

Userlevel 4
Badge

Hi,

I stumbled on that problem a few weeks ago. Here is what I found, if you want to change your python code:

At the end of the float section, 2 doubles (64 bits) and what looks like 2 integers (2* 32 bits) have been added. Comparing ZRD file reader between an old and a new opticstudio (and also the release notes), the two doubles are “Optical Path Length in Waves” and “Optical Path Length in Lens Units”. For the last 2 integers, I don’t know, but they do not not look like a double, although they are located in the float section. Could be related to the diffraction orders or perhaps the sensor size. So you can e.g., skip 3 doubles from each segment to be able to read format 2003.

 

A few hours ago I also found that there is a 24 Bytes offset at the end of each segment.
Adding this offset in the read does the job. Good to know, that you found what the data is.

Still it is a little anoying that the file format changed, while the documentation is unchanged.

Userlevel 4
Badge

For reference, here is the release notes post which help to identify the new entries. This release also has a much improved path analysis.

 

Reply