That example is a Python script to convert source file between Zemax and SPEOS. To learn more about that converter, check our article: https://support.zemax.com/hc/en-us/articles/4416068530579-SPEOS-and-Zemax-Source-file-converter
For more information about Ansys optical_automation, click here.
It’s possible that we get an error message:
Non binary files not supported.
This happens when the file is not stored in form of ones and zeros, or in some other binary (two-state) sequence.
Zemax source file
For Zemax source file, the extension SDF is recommended, and DAT is supported only for backward compatibility. The file format may be either text or binary. This is mentioned in The Setup Tab > Editors Group (Setup Tab) > Non-sequential Component Editor > Non-sequential Sources > Source File. You can put a detector close to this source file and save the ray tracing data as new source file to convert the non-binary source to a binary one.
Speos source file
As for Speos, it’s possible that ray files are written in non-binary format and get file type changed to .ray. It’s mentioned in Speos Labs User's Guide220.127.116.11 that contents of Ray files can be .ray, .txt or .tm25ray files. We can convert the source to binary format by clicking the Save As button in Speos Ray File Editor.
If you see any format issues with Speos .ray files, you may open and save the rayfile with the Ray File Editor to fix the conversion issue for Speos.