rayoptics.zemax.zmxread module

read_lens_file(filename, **kwargs)[source]

given a Zemax .zmx filename, return an OpticalModel

It appears that Zemax .zmx files are written in UTF-16 encoding. Test against what seem to be common encodings. If other encodings are used in ‘files in the wild’, please add them to the list.

Parameters:
  • filename (pathlib.Path) – a Zemax .zmx file path

  • kwargs (dict) – keyword args passed to the reader functions

Returns:

an OpticalModel instance and a info tuple

read_lens_url(url, **kwargs)[source]

given a url to a Zemax file, return an OpticalModel

read_lens(filename, inpt, **kwargs)[source]

given inpt str of a Zemax .zmx file, return an OpticalModel

process_line(opt_model, line, line_no)[source]
post_process_input(opt_model, filename, **kwargs)[source]
log_cmd(label, cmd, inputs)[source]
handle_types_and_params(optm, cur, cmd, inputs)[source]
handle_aperture_data(optm, cur, cmd, inputs)[source]
pupil_data(optm, cmd, inputs)[source]
field_spec_data(optm, cmd, inputs)[source]
class ZmxGlassHandler(filename)[source]

Bases: GlassHandlerBase

Handle glass restoration during Zemax zmx import.

This class relies on GlassHandlerBase to provide most of the functionality needed to find the requested glass or a substitute.