ZOSPy v1.0.0 is out!

Userlevel 3

We recently released ZOSPy 1.0.0, our open source library for easy communication between Python and OpticStudio. It uses the ZOS-API, but takes care of most of the programming, such as establishing the communication with OpticStudio and running and parsing analyses.

The main new features included in this version are:

  • Support for Python.NET 3.0
  • A uniform and pythonic interface to analyses:
    from zp.analyses.mtf import fft_through_focus_mtf

    mtf = fft_through_focus_mtf(oss, sampling='64x64', deltafocus=0.1)
  • Autocomplete for the complete ZOS-API


Check out the new version on GitHub.


4 replies

Userlevel 1

Can you verify that this works with the Ansys Zemax 2023 R2.0?

Userlevel 3

Yes, we ran the unit tests of ZOSPy 1.1.0 on Ansys OpticStudio R2.01 and they passed. This means that ZOSPy should work with this OpticStudio version with Python versions 3.9, 3.10 and 3.11. Please note that Python 3.9 or newer is required by ZOSPy. If you are running an older version, e.g. Python 3.8, pip will automatically install an older version of ZOSPy (most likely 0.6.2).

As for the specific combination of ZOSPy 1.0.0 with OpticStudio 2023 R2.0, I didn't test that, but these versions should be compatible with OpticStudio 2023 R2.01.

Userlevel 3

ZOSPy's compatibility information has been updated with this information: https://zospy.readthedocs.io/en/latest/compatibility.html

Userlevel 7
Badge +3

This is great work! Thank you, Jan-Willem and others who contributed to this project. I can see this was originally posted 4 months ago, but I either missed it or failed to grasp its significance.

Back in ‘my day’ we considered a Python interface (which would have been called ZPL2) but decided to make the API as language-agnostic as we could so users could use whatever they wanted. It is absolutely fantastic to see that you have taken the API and done this. Seriously, this has made my day!

I have only one comment on your paper. In the summary and elsewhere, you make statements like “It offers an Application Programming Interface (API) but interacting with this API is complex. Consequently, current ray tracing simulations generally require substantial manual user interaction, which in turn hampers the sharing of methods between scientists.

That is true, but I don’t think it conveys the programmers’ intentions, which was to provide a low level, language agnostic platform for any COM/NET application to connect to. To that extent, it is aimed at programmers rather than optical engineers, although obviously some (many?) optical engineers are programmers as well. I’d prefer to see something like

It offers an Application Programming Interface (API) to provide low-level language-agnostic support to any .COM or .NET application. However, many scientists are not familiar with this level of programming, and so we have developed ZOSPy which performs all needed low level functionality specifically for Python. The package provides an accessible Python interface as well as …

Just a small change to respect the original programmers who were not intending to build a ‘Python package’ as such.

But once again, great work and very well done!

  • Mark