Toolkit to read Zemax OpticStudio files.
Project description
ZmxTools
A toolkit to read Zemax files.
Currently, this is limited to unpacking ZAR archives. For further processing of the archive's contents, e.g. ZMX or AGF glass files, please check the list of related software below.
Features
- Unpack a Zemax OpticStudio® Archive ZAR file using the
unzar
command. - Repack a ZAR file as a standard zip file using the
unzar -z
command. - Use as a pure Python 3 library.
- Fully typed with annotations and checked with mypy, PEP561 compatible
Installation
Prerequisites
- Python 3.8 or higher
- pip, the Python package manager
To install zmxtools
, just run the following command in a command shell:
pip install zmxtools
The zmxtools
library will color-code test output when the coloredlogs
package is installed. You can optionally
install it with
pip install coloredlogs
Usage
This package can be used directly from a terminal shell or from your own Python code. Example files can be found on manufacturer's sites such as Thorlabs Inc.
Command line shell
The command unzar
is added to the path upon installation. It permits the extraction of the zar-file to a sub-directory
as well as its conversion to a standard zip-file. For example, extracting to the sub-directory mylens
is done using
unzar mylens.zar
Repacking the same zar-archive as a standard zip-archive mylens.zip
is done with:
unzar mylens.zar -z
Multiple input files and an alternative output directory can be specified:
unzar -i *.zar -o some/where/else/
Find out more information and alternative options using:
unzar -h
As a Python library
Extraction and repacking can be done programmatically as follows:
from zmxtools import zar
zar.extract('mylens.zar')
zar.repack('mylens.zar')
zar.read('mylens.zar')
Python pathlib.Path
objects can be used instead of strings.
Online documentation
The latest version of the API Documentation is published on https://zmxtools.readthedocs.io/. The documentation is generated automatically in the docs/ directory from the source code.
Contributing to the source code
The complete source code can be found on github: https://github.com/tttom/zmxtools. Check out Contributing for details.
License
This code is distributed under the agpl3: GNU Affero General Public License
Credits
- Wouter Vermaelen for decoding the ZAR header and finding LZW compressed contents.
- Bertrand Bordage for sharing this gist.
- This project was generated with
wemake-python-package
. Current template version is: cfbc9ea21c725ba5b14c33c1f52d886cfde94416. See what is updated since then.
Related Software
- Optical ToolKit reads Zemax .zmx files.
- RayTracing reads Zemax .zmx files.
- Zemax Glass reads Zemax .agf files.
- RayOptics reads Zemax .zmx and CODE-V .seq files.
- RayOpt reads Zemax .zmx as well as OSLO files.
- OpticsPy does not read Zemax .zmx files but reads CODE-V .seq files and glass information from data downloaded from https://www.refractiveindex.info/.
- OpticalGlass reads glass manufacturer Excel sheets.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zmxtools-0.1.5.tar.gz
.
File metadata
- Download URL: zmxtools-0.1.5.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.7 Linux/5.19.0-38-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3635f077939b754073e8612be78bf3e22a0c5bb855eeb14f48a146825839a97e |
|
MD5 | f24cf0d7cbe864bf37e143655aa95820 |
|
BLAKE2b-256 | 9e7571ac464a533af4f378e24739690b561879626bd8b1a472f24dc28be945ca |
File details
Details for the file zmxtools-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: zmxtools-0.1.5-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.10.7 Linux/5.19.0-38-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc4f63e986bc22315c0dac1f34064dbdcf8f44fb401b03e2b6ca5c6318c4bea9 |
|
MD5 | f3db27191e16a42082f909aa92d5f320 |
|
BLAKE2b-256 | e6c047d130b4fd943d9607db8045722dcd413b8f23d1cd54012ea0631f2b9224 |