ZOSPy
ZOSPy: optical ray tracing in Python through OpticStudio - Published in JOSS (2024)
Science Score: 98.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Keywords from Contributors
Repository
Wrapper around the Zemax OpticStudio API. Provides a more pythonic and intuitive way to interact with the ZOS-API through python using a .NET connection.
Basic Info
- Host: GitHub
- Owner: MREYE-LUMC
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://zospy.readthedocs.io
- Size: 51.1 MB
Statistics
- Stars: 74
- Watchers: 7
- Forks: 16
- Open Issues: 4
- Releases: 21
Topics
Metadata Files
README.md
ZOSPy
About
Wrapper around the Ansys OpticStudio API that provides a more intuitive way to interact with the ZOS-API through Python using a .NET connection, as described in this Journal of Open Source Software paper. It thereby allows you to do more optics modelling with less coding.
In addition to full access to all the OpticStudio fucntions through the ZOS-API, ZOSPy provides the following features:
- Wrapper functions for several OpticStudio analyses in
zospy.analyses; - Easy access to solvers in
zospy.solvers; - Easy access to all API constants in
zospy.constants; - Autocomplete for all ZOS-API endpoints and constants;
- Solves common problems related to Python.NET 3 and interaction with the ZOS-API.
Installing
ZOSPy is available on PyPi
pip install zospy
And through conda:
conda install conda-forge::zospy
Example
Create and draw a simple optical system consisting of a single lens:
```python import matplotlib.pyplot as plt import zospy as zp
zos = zp.ZOS() oss = zos.connect()
Create a new, empty system
oss.new()
Set aperture and wavelength
oss.SystemData.Aperture.ApertureType = zp.constants.SystemData.ZemaxApertureType.FloatByStopSize oss.SystemData.Wavelengths.GetWavelength(1).Wavelength = 0.543 # in μm
Set the object at infinity
surfaceobject = oss.LDE.GetSurfaceAt(0) surfaceobject.Thickness = float("inf")
Add a dummy surface for visualization purposes
inputbeam = oss.LDE.InsertNewSurfaceAt(1) inputbeam.Comment = "input beam" input_beam.Thickness = 10
Use a stop diameter of 4 mm
surfacestop = oss.LDE.GetSurfaceAt(2) surfacestop.SemiDiameter = 2
Add a lens with n = 1.5
lensfront = oss.LDE.InsertNewSurfaceAt(3) lensfront.Comment = "lens front" lensfront.Radius = 20 lensfront.Thickness = 1 zp.solvers.materialmodel(lensfront.MaterialCell, refractive_index=1.5)
lensback = oss.LDE.InsertNewSurfaceAt(4) lensback.Comment = "lens back" lensback.Radius = -20 lensback.Thickness = 19.792 # System is in focus
Show the system in the 3D viewer
draw3d = zp.analyses.systemviewers.Viewer3D(surfacelinethickness="Thick", raysline_thickness="Thick").run(oss)
plt.imshow(draw_3d.Data) plt.axis("off") plt.show() ```

Please refer to the documentation for more information on how to use ZOSPy. More elaborate examples can be found in the example gallery.
Warranty and liability
The code is provided as is, without any warranty. It is solely intended for research purposes. No warranty is given and no rights can be derived from it, as is also stated in the MIT license.
Dependencies
ZOSPy officially supports Python 3.10 - 3.13. It may work with older Python versions, but support is not provided for these versions. Furthermore, a working installation of Ansys Zemax OpticStudio is required.
Compatibility
See the documentation for the most up-to-date compatibility information.
Referencing
When publishing results obtained with this package, please cite our paper in the Journal of Open Source Software:
Vught, L. van, Haasjes, C. & Beenakker, J.W.M. (2024). ZOSPy: Optical ray tracing in Python through OpticStudio. Journal of Open Source Software, 9(96), 5756. https://doi.org/10.21105/joss.05756
Contributing
Please read our contribution guidelines prior to opening a Pull Request.
Contact
Feel free to contact us via e-mail at zospy@mreye.nl for any inquiries, or visit mreye.nl to discover our research.
Owner
- Name: MREYE
- Login: MREYE-LUMC
- Kind: organization
- Repositories: 2
- Profile: https://github.com/MREYE-LUMC
JOSS Publication
ZOSPy: optical ray tracing in Python through OpticStudio
Authors
Department of Ophthalmology, Leiden University Medical Center, Leiden, the Netherlands, Department of Radiology, C.J. Gorter MRI Center, Leiden University Medical Center, Leiden, the Netherlands
Department of Ophthalmology, Leiden University Medical Center, Leiden, the Netherlands, Department of Radiology, C.J. Gorter MRI Center, Leiden University Medical Center, Leiden, the Netherlands, Department of Radiation Oncology, Leiden University Medical Center, Leiden, the Netherlands
Department of Ophthalmology, Leiden University Medical Center, Leiden, the Netherlands, Department of Radiology, C.J. Gorter MRI Center, Leiden University Medical Center, Leiden, the Netherlands, Department of Radiation Oncology, Leiden University Medical Center, Leiden, the Netherlands
Tags
Ray tracing OpticStudio ZemaxCitation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Vught
given-names: Luc
name-particle: van
orcid: "https://orcid.org/0000-0001-8290-9071"
- family-names: Haasjes
given-names: Corné
orcid: "https://orcid.org/0000-0003-0187-4116"
- family-names: Beenakker
given-names: Jan-Willem M.
orcid: "https://orcid.org/0000-0003-0479-5587"
contact:
- family-names: Vught
given-names: Luc
name-particle: van
orcid: "https://orcid.org/0000-0001-8290-9071"
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Vught
given-names: Luc
name-particle: van
orcid: "https://orcid.org/0000-0001-8290-9071"
- family-names: Haasjes
given-names: Corné
orcid: "https://orcid.org/0000-0003-0187-4116"
- family-names: Beenakker
given-names: Jan-Willem M.
orcid: "https://orcid.org/0000-0003-0479-5587"
date-published: 2024-04-04
doi: 10.21105/joss.05756
issn: 2475-9066
issue: 96
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 5756
title: "ZOSPy: optical ray tracing in Python through OpticStudio"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.05756"
volume: 9
title: "ZOSPy: optical ray tracing in Python through OpticStudio"
repository-code: 'https://github.com/MREYE-LUMC/ZOSPy'
license: MIT
GitHub Events
Total
- Create event: 72
- Issues event: 8
- Release event: 9
- Watch event: 24
- Delete event: 62
- Issue comment event: 120
- Push event: 305
- Pull request event: 112
- Pull request review event: 137
- Pull request review comment event: 63
- Fork event: 8
Last Year
- Create event: 72
- Issues event: 8
- Release event: 9
- Watch event: 24
- Delete event: 63
- Issue comment event: 120
- Push event: 306
- Pull request event: 113
- Pull request review event: 138
- Pull request review comment event: 63
- Fork event: 8
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| crnh | 3****h | 100 |
| Luc van Vught | l****t@l****l | 66 |
| chaasjes | c****s@l****l | 39 |
| Andi Barg | 4****g | 12 |
| Jan-Willem Beenakker | 9****r | 10 |
| David Nguyen | 6****c | 6 |
| dependabot[bot] | 4****] | 1 |
| PParant | 1****n | 1 |
| Noah Rubin | n****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 18
- Total pull requests: 194
- Average time to close issues: 21 days
- Average time to close pull requests: 5 days
- Total issue authors: 9
- Total pull request authors: 8
- Average comments per issue: 4.39
- Average comments per pull request: 1.84
- Merged pull requests: 161
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 6
- Pull requests: 137
- Average time to close issues: 4 days
- Average time to close pull requests: 5 days
- Issue authors: 3
- Pull request authors: 4
- Average comments per issue: 1.33
- Average comments per pull request: 1.78
- Merged pull requests: 107
- Bot issues: 0
- Bot pull requests: 2
Top Authors
Issue Authors
- crnh (7)
- brandondube (2)
- Omnistic (2)
- julian-irwin-tfs (2)
- laser-axel (1)
- Lupatran (1)
- Astrotech89 (1)
- LucVV (1)
- andibarg (1)
Pull Request Authors
- crnh (138)
- LucVV (40)
- andibarg (4)
- dependabot[bot] (3)
- jwmbeenakker (3)
- laser-axel (2)
- Lupatran (2)
- Omnistic (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 809 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 19
- Total maintainers: 3
pypi.org: zospy
A Python package used to communicate with Zemax OpticStudio through the API
- Documentation: https://mreye-lumc.github.io/ZOSPy
- License: MIT License Copyright (c) 2023 Beenakker and members of the LUMC-MReye research group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 2.1.2
published 6 months ago
Rankings
Maintainers (3)
Dependencies
- numpy *
- pandas *
- pythonnet *