Minor improvements to the file IO system#688
Open
8bit-Dude wants to merge 1 commit into
Open
Conversation
- 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?
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This are minor changes, just to get warmed up:
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()``