The Source File object can be used to directly specify the coordinates, cosines, and intensities for a set of source rays in non-sequential mode. This object has a number of applications to system modeling in ZEMAX. For example, fluorescent sources can be modeled by using the Ray Database Viewer to save ray data into a Source File (via the “Save Rays on Object n As” flag). LEDs and other complex sources may also be modeled with the Source File object.

ZEMAX supports two formats for the Source File object: binary and ASCII. More information about these formats is available in the chapter of the ZEMAX manual entitled “Non-Sequential Components”. The binary format used by ZEMAX is also supported by the ProSource program available from Radiant Imaging. The compact nature of the binary format allows large ray data sets to be stored in small files. However, without access to a hex editor, source files present in the binary format cannot be inspected by the interested user.

A simple piece of C code can be used to convert the binary source files into ASCII text files. This allows data present in the source files to be interrogated by the interested user. Once generated, the text files may also be used in the Source File object. However, we always recommended that the binary files are used for purposes of ray tracing in ZEMAX, whenever possible; ray tracing speed can be significantly slower when using a text file rather than a binary file to represent the ray data.

The code used for conversion of binary source files into ASCII text files provides a template for how to read the binary data files used by ZEMAX into C. This can be useful not only for interpreting the binary files used with the Source File object, but also for interpreting Ray Database (ZRD) files.