This python ZOS-API interactive extension creates a ray file based on batch ray tracing in a sequential system. This allows import of image-space ray data from a sequential model into NS mode, including black-boxed lens systems.
For a user selected field coordinate, rays are randomly selected in the pupil and traced to the image plane. The image plane intercept ray data are saved as a ray file (.dat) into the ...\Zemax\Objects\Sources\Source Files\ directory. After loading into an NS system, the “pre-propagation” source setting can be used to back the rays off from the image plane.
Note that is merely intended as an example. The implementation of the function is very basic; the tool should be adapted and validated based on individual cases.