Skip to content

Minor improvements to the file IO system#688

Open
8bit-Dude wants to merge 1 commit into
optiland:masterfrom
8bit-Dude:file-io-improvements
Open

Minor improvements to the file IO system#688
8bit-Dude wants to merge 1 commit into
optiland:masterfrom
8bit-Dude:file-io-improvements

Conversation

@8bit-Dude

@8bit-Dude 8bit-Dude commented Jul 18, 2026

Copy link
Copy Markdown

This are minor changes, just to get warmed up:

  • Added support for paraxial (thin lens) import/export with CodeV, OSLO and Zemax.
  • Added fix for zemax files missing the FTYP information blob (for example, files exported from Optalix).
  • Fixed formatting of exported OSLO files (indentation matching exports from OSLO).

Note 1: The contents of "encoder.py" and "formatter.py" seem to be inverted between OSLO and CODEV writers. This is confusing and should be fixed at some point...

Note 2: The IO for Zemax uses a different approach that the other 2 systems. Any reason for this?

To test these changes, you can run the following round-trip read/writes with the attached file (the output has been checked to load in relevant target softwares):

paraxial_system.json

``from optiland.fileio import (load_optiland_file, load_zemax_file, load_codev_file, load_oslo_file,
save_optiland_file, save_zemax_file, save_codev_file, save_oslo_file)

filename = "paraxial_system"

optic = load_optiland_file("JSON/"+filename+".json")
optic.draw()

save_zemax_file(optic, "ZEMAX/"+filename+".zmx")
save_codev_file(optic, "CODEV/"+filename+".seq")
save_oslo_file(optic, "OSLO/"+filename+".len")

optic = load_zemax_file("ZEMAX/"+filename+".zmx")
optic.draw()

optic = load_codev_file("CODEV/"+filename+".seq")
optic.draw()

optic = load_oslo_file("OSLO/"+filename+".len")
optic.draw()``

- Added support for paraxial (thin lens) import/export with CodeV, OSLO and Zemax.
- Added fix for zemax files missing the FTYP information blob (for example, files exported from Optalix).
- Fixed formatting of exported OSLO files (indentation matching exports from OSLO).

Note 1: The contents of "encoder.py" and "formatter.py" seem to be inverted between OSLO and CODEV writers. This is confusing and should be fixed!
Note 2: The IO for Zemax clearly uses a different approach that the other 2 systems. Any reason for this?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant