ZOSPy

ZOSPy: optical ray tracing in Python through OpticStudio - Published in JOSS (2024)

https://github.com/mreye-lumc/zospy

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

optics optics-simulation opticstudio python zemax zos-api

Keywords from Contributors

mesh
Last synced: 4 months ago · JSON representation ·

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
Statistics
  • Stars: 74
  • Watchers: 7
  • Forks: 16
  • Open Issues: 4
  • Releases: 21
Topics
optics optics-simulation opticstudio python zemax zos-api
Created over 4 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

ZOSPy

PyPI - Version Python Version from PEP 621 TOML Conda Version GitHub Actions Workflow Status Documentation Status JOSS Zenodo

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() ```

Full example system

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

JOSS Publication

ZOSPy: optical ray tracing in Python through OpticStudio
Published
April 04, 2024
Volume 9, Issue 96, Page 5756
Authors
Luc van Vught ORCID
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
Corné Haasjes ORCID
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
Jan-Willem M. Beenakker ORCID
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
Editor
Paul La Plante ORCID
Tags
Ray tracing OpticStudio Zemax

Citation (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

All Time
  • Total Commits: 236
  • Total Committers: 9
  • Avg Commits per committer: 26.222
  • Development Distribution Score (DDS): 0.576
Past Year
  • Commits: 34
  • Committers: 4
  • Avg Commits per committer: 8.5
  • Development Distribution Score (DDS): 0.206
Top Committers
Name Email 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)
lumc.nl: 2

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
bug (4) not a bug (2) open science fund (2) skip changelog (2) documentation (1) question (1)
Pull Request Labels
skip changelog (88) open science fund (27) bug (26) documentation (19) enhancement (12) from-gitlab (8) CI (7) analysis (6) dependencies (4) on hold (1)

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
  • Versions: 19
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 809 Last month
Rankings
Dependent packages count: 10.1%
Stargazers count: 11.8%
Forks count: 11.9%
Average: 15.9%
Dependent repos count: 21.5%
Downloads: 23.9%
Maintainers (3)
Last synced: 4 months ago

Dependencies

setup.py pypi
  • numpy *
  • pandas *
  • pythonnet *