Soon, we will launch a new and updated customer portal, which is an important step toward providing our customers with one place to learn, interact, and get help.
Learn more.

What are the .SES and .CFG Files?

This article explains what the the session (.SES) and configuration (.CFG) files are, and what they do.
 
Dan Hill
08/02/2006
Frequently Asked Questions

Using Session Files

There are a number of different file types which are used by Zemax, but perhaps the most commonly misunderstood functionality/purpose of these files is that of the configuration (.CFG) and session (.SES) files.  Each serve a specific purpose, and will be explained in detail in the following paragraphs of this article.



The .SES file extension, or the “session” file, are those which define the display configuration and open windows and settings for each saved .ZMX lens file.  By default, whenever you save your lens file, Zemax also creates a session file with the same filename as the lens file, but just a different extension:  .SES.  Then, the next time the lens file is opened, all of the analysis windows and editors appear in the exact same location as they were when the file was saved.  In addition, the session files contain the setting information for each of these open analysis windows, so the designer may better recall the analysis which was being performed upon last saving the file.

The use and creation of session files may be turned on or off under the File menu within Zemax:

Use Session Files

If this option is unchecked, then no session file is created upon saving the lens file.  In addition, even if a previously saved lens file has an associating session file, none of the analysis windows will be recalled.

When sending a colleague/customer your lens file, it is often useful to send the session file as well.  This is especially true when sending your file for review to Zemax technical support.  By sending your session file along with your Zemax file, our support staff can immediately assess the question at hand, and review the appropriate analyses without having to ask for specific setting information.

Throughout the Zemax online knowledgebase, sample files are included for download at the end of an article.  Often times, the .ZMX and .SES files are included.  As long as both files reside in the same directory, then upon opening the lens file, the appropriate analysis windows will also be displayed.



In addition to the lens and session files are the configuration files.  Configuration files serve a different, unique purpose from that of the lens and session files, which is discussed on the following page.

The Configuration File

In the settings window of nearly every analysis feature in Zemax, there exists a “SAVE” button.  

Save Button - Spot Diagram Settings

Clicking this button will execute the analysis, but will also save the settings chosen to a configuration file, or .CFG file.  The configuration files are the files which describe the user-selected options for analysis windows and other settings from within Zemax.  The configuration file “remembers” the saved settings, so that the next time you open a new analysis window of the same type, the saved settings will be used as the defaults.

If the SAVE button is used at any time while working on a lens file, Zemax will construct a configuration file which is specific to that lens file.  In addition, these settings will be saved globally, either to the Zemax.CFG (discussed in more detail on page 3) or its own configuration file in the main Zemax directory.

As an example, assume you make some modifications to the Spot Diagram Settings, and press the SAVE button.  If one does not already exist, Zemax will construct a .CFG file specific to your lens file.  Now, each time you open a new Spot Diagram window from within the same lens file, those saved settings will be used.

In addition, Zemax also creates a SPT.CFG located in your main Zemax directory:

SPT.CFG File

It is this configuration file which controls the global default settings for the Spot Diagram.  So, if within adifferent lens file you open the Spot Diagram, the last set of saved settings will be used for that feature.  That is, of course, if the lens file does not have its own specific configuration file associated with it!

So, it works like this.  Any time a new analysis feature is opened, Zemax checks to see if there is a .CFG file with the same name as the lens file located in the same directory.  If so, then it checks to see if that configuration file contains any saved information which is specific to the analysis feature chosen.

If so, then the settings information stored in this local configuration file are used.  If not, Zemax will then check the global configuration file for that analysis feature, and use this information if available.  If there is not a configuration file specific to that analysis feature, then the original Zemax defaults are used for the settings of the chosen analysis.

The Zemax.CFG File and Use of the .CFG File in ZPL

The Zemax.CFG file, located in the main Zemax directory, serves as the main configuration file which describes the user-selected options on the environment dialog box, or the File > Preferences dialog.  Any user-preferences which are applied using this dialog are saved to this configuration file.  It is important to note that this configuration file, or any other configuration file, is NOT overwritten by Zemax upon a new installation.  Therefore, you may install newer updates of Zemax on top of the existing version on your computer without affecting any of your preferences, whether they be color assignments, button bar arrangements, or saved settings within the analysis features themselves.

Configuration files are also vital to the way some optimization operands work.  Some operands, such as IMAE and POPD, use the saved settings (from the lens-specific configuration file or the last globally saved settings) to perform the calculation.  The main reason for this is because these complex analysis features require many different setting options, not all of which can be presented in the Merit Function Editor.  Therefore, in order to properly use these operands, the corresponding analysis feature must first be opened, the settings be modified, and the SAVE button be pressed.

In addition to optimization operands, some ZPL keywords rely on the use of the configuration files.  For example, the GETTEXTFILE keyword (which creates an ASCII text file from any Zemax analysis window which supports text) calls for a “settingsfilename.”  The settingsfilename is the configuration file which Zemax will use for the default settings of the desired analysis feature.  For more details, please refer to the discussion of the GETTEXTFILE keyword in the Zemax Programming Language chapter of the Zemax User’s Guide.

Summary and References

In addition to the Zemax Lens Files (.ZMX), the configuration (.CFG) and session (.SES) files have unique purposes.  In summary, the session file contains information about the window arrangement in a lens file, and is restored upon subsequent openings of the lens file.  The configuration file on the other hand, contains the saved setting information for analysis windows, and serves various purposes in determining the default settings for an analysis feature or window.


References

Zemax Optical Design Program User’s Guide, Zemax Development Corporation