Multiple Ray Buffers
By nature, FRED does not save data at each intersection as a ray makes its way through an optical system. FRED achieves maximum performance in terms of raytrace speed by allowing each ray to trace to its termination and saving only the final state thus eliminating accounting overhead involved in logging each intersection.
This approach also avoids potentially overwhelming storage requirements involved in tracing large numbers of rays and/or rays which encounter large numbers of intersections. However, there are cases in which storing ray data on selected surfaces is desirable. For instance, the user may be interested in plotting the beam footprint on each surface in a lens system or computing the cumulative irradiance on a specific surface after numerous intersections with the surface.
The tools provided herein enable the user to perform such calculations with ease and clarity.
When using FRED’s GUI interface, all ray data is stored/traced/manipulated/analyzed in a single ray buffer called the “Active” buffer. The GUI has access to this buffer only. FRED’s scripting language allows the user to create/delete additional buffers, copy rays from one buffer to another and switch between buffers.
There are two Embedded Scripts in the associated file which can be applied to virtually any optical system. Prior to running the first script, selectentity_multiplebuffers.frs, the user designates the surfaces of interest by selecting them in the Object Tree. Hold down the Ctrl key to select multiple surfaces. If this script is an Embedded script, it must be run using a Toolbar button in order to preserve the surface designations in the Object Tree.
The script initially identifies the selected surfaces and creates a temporary buffer for each. Next, an Advanced Raytrace steps the source rays through the system one intersection at a time. After each intersection, rays are queried and stored in the appropriate ray buffer based upon their current location. To ensure rays are counted only once, the ray attribute .intersect is compared to the number of steps and stored only when these quantities are equal.
The second script, select_active_buffer.frs is designed to present the user with a dialog allowing selection of the desired surface name from a list as shown in Figure 2. Upon making a selection, the appropriate buffer is activated. All available analysis functions can then be performed on the rays in that buffer. (Note: you will have to add and configure your own Analysis Surface(s).)
The user also has the option to select the Main buffer where the original raytrace was performed or delete all temporary buffers.