Skip to main content

Optical Design Integrated Network

Project description

ODIN is a demo Python package for optical engineers. We believe in a straightforward path to great design and tolerancing. Let the best wavefront win😄

Requirements

  • Python 3.x, ZOSAPI, NumPy, clr, os, winreg, random

Math Module

Interferometry Math Utilities

Lightweight Python helpers for common interferometry conversions. Convert surface irregularity and optical power between fringes, millimeters, and radius of curvature.

Features

  • Irregularity conversion: fringes ↔ millimeters
  • Optical power conversion: fringes ↔ millimeters
  • Supports concave (CC) and convex (CX) surfaces
  • NumPy-only dependency
  • Simple random value generator for simulation/testing

Main Class

Math()
  • Main interface for using Math functions.

Functions

irrFrToMm(fringes, wavelength_nm)
  • Convert surface irregularity from fringes to millimeters.
irrMmToFr(irregularity_mm, wavelength_nm)
  • Convert surface irregularity from millimeters to fringes.
powFrToMm(diameter_mm, nominal_radius_mm, surface_type, fringes, wavelength_nm)
  • Convert power in fringes to corrected radius in millimeters.
powMmToFr(diameter_mm, nominal_radius_mm, surface_type, power_mm, wavelength_nm)
  • Convert power in millimeters to fringes.
randomValue(distribution="uniform")
  • Generate a random value between -1 and 1.
    • Distributions: uniform, gauss, parabolic

ZOSpy Module

A demo Python wrapper for Zemax OpticStudio (ZOS-API)

ZOSpy – OpticStudio Automation Utilities

Lightweight Python interface for connecting to Zemax OpticStudio, manipulating lens data, merit functions, and running tolerancing analyses via ZOS-API.

Features

  • Offline ZMX file read/write/edit without OpticStudio
  • Connect to OpticStudio (Interactive or Standalone)
  • Open, save, and modify ZMX/ZOS files
  • Lens Data Editor (LDE) surface and parameter control
  • Merit Function Editor (MFE) access
  • Local optimization control
  • Monte Carlo tolerancing utilities

Main Class

ZOSpy()
  • Main interface for connecting to and controlling OpticStudio.

File Handling

readOfflineZmx(pathToZmx)
  • Read a .zmx file as text into memory.
writeOfflineZmx(pathToZmxWithNewName)
  • Write modified offline .zmx content to file.
openFile(path)
  • Open a ZMX or ZOS file in OpticStudio.
saveFile()
  • Save the current system.
saveAsFile(pathWithName)
  • Save the system under a new name.

Connections

connectOS()
  • Connect via Interactive Extension.
connectOSSA()
  • Connect via Standalone Application.
disconnectOS()
  • Close OpticStudio and release the connection.

OfflineLDE

OfflineLDE.getParameter(surface, parameter)
  • Read a surface parameter from offline ZMX text.
OfflineLDE.setParameter(surface, parameter, value)
  • Modify a surface parameter in offline ZMX text.

LDE (Lens Data Editor)

LDE.getSurfaceByComment(comment)
  • Find a surface index by comment.
LDE.addSurfaceAfter(surface)
LDE.addSurfaceBefore(surface)
  • Add new surfaces relative to an existing one.
LDE.removeSurfaces(first_surface, last_surface)
  • Remove a range of surfaces.
LDE.setSurfaceType(surface, type)
  • Change the surface type.
LDE.setParameter(surface, parameter, value)
  • Set a surface parameter.
LDE.getParameter(surface, parameter)
  • Get a surface parameter value.
LDE.ignoreSurface(surface, bool)
  • Enable or ignore a surface.
LDE.setUiUpdate(bool)
  • Enable or disable live UI updates.
LDE.removeAllVariable()
  • Remove all variables from the system.
LDE.setCoordinateBreakToElement(surface_1, surface_2, color)
  • Group surfaces into an element using coordinate breaks.

MFE (Merit Function Editor)

MFE.loadMeritFunction(path)
  • Load a merit function file.
MFE.calculateMeritFunction()
  • alculate the current merit function.
MFE.getTarget(line)
MFE.setTarget(line, target)
  • Get or set merit function targets.
MFE.getWeight(line)
MFE.setWeight(line, weight)
  • Get or set merit function weights.
MFE.getValue(line)
  • Read a merit function value.

TDE (Tolerance Data Editor)

TDE.loadTDE(path)

Tolerancing

Tolerancing.getMonteCarlo()
  • Run a single Monte Carlo tolerancing analysis.
Tolerancing.runMonteCarlos(cores, ScriptIndex, NumberOfRuns, NumberToSave)
  • Run multiple Monte Carlo simulations.
Tolerancing.getData(column)
  • Extract a column of Monte Carlo result data.

Analysis

Analysis.getUnitNormalizedSensitivityMatrix(input_array)
  • Calculate the sensitivity of MFE operands relative to specific parameter perturbations and record nominal states.
Analysis.plotSensitivityMatrix(sensitivity_matrix, input_array)
  • Generate a heatmap visualization of the sensitivity data with dynamic scaling and parameter labeling.

Database Module

SQL Server Database Utilities

Lightweight Python helper class for connecting to and interacting with a Microsoft SQL Server database. Provides simple methods for connection handling, table inspection, and filtered data retrieval. Uses a config.ini file for credential management.

Features

  • Connect / disconnect using config file
  • List all database tables
  • Show table structure (columns, types, length)
  • Display full table content
  • Filtered data retrieval (pn, sn)
  • Table whitelist for basic SQL injection protection
  • Uses pymssql

Main Class

Database()
  • Main interface for managing database operations.

Functions

connect(config_path)
  • Connect to the database using a config.ini file.
disconnect()
  • Close the active database connection.
listTables()
  • List all base tables in the database.
showTableStructure(table_name)
  • Display column structure of a selected table.
showTableData(table_name)
  • Display all rows from a selected table.
getData(table, pn, sn)
  • Retrieve rows filtered by part number (pn) and serial number (sn).
  • Table must be in the allowed whitelist.

Example config.ini

[database]
server = YOUR_SERVER
database = YOUR_DATABASE
username = YOUR_USERNAME
password = YOUR_PASSWORD

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

meodin-0.1.4.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meodin-0.1.4-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file meodin-0.1.4.tar.gz.

File metadata

  • Download URL: meodin-0.1.4.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for meodin-0.1.4.tar.gz
Algorithm Hash digest
SHA256 150384cc351c4683d6304b71fe17670d33113ca621af2f1cc36f89d9057e0491
MD5 0d8f00433568ea4a5a58de017592ef5a
BLAKE2b-256 418df067345d210aa14810a7e01955b810776d0fd20ab80eb97810f315006360

See more details on using hashes here.

File details

Details for the file meodin-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: meodin-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for meodin-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 99215054746815b3e3ba68124b35405de2d4a47f57f657a7b03d0522f22c7443
MD5 ee0ec3257bbeb1830f0ae17b1e84139e
BLAKE2b-256 b5d752fcc9021fc01934b23fd035f9bb80419f18d8a2b9295be88d8831c6d692

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page