Metadata-Version: 2.4
Name: visisipy
Version: 0.4.0
Summary: Accessible vision simulations in Python.
Project-URL: Documentation, https://visisipy.readthedocs.io
Project-URL: Repository, https://github.com/MREYE-LUMC/visisipy
Project-URL: Issues, https://github.com/MREYE-LUMC/visisipy/issues
Author: Corné Haasjes, Jan-Willem Beenakker
Maintainer-email: MReye research group <zospy@mreye.nl>
License-Expression: MIT
License-File: LICENSE.txt
Keywords: OpticStudio,ophthalmology,optics,simulation,vision science
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: <3.14,>=3.10
Requires-Dist: matplotlib
Requires-Dist: numba>=0.60.0
Requires-Dist: numpy<2.4.0
Requires-Dist: optiland<0.7.0,>=0.6.0
Requires-Dist: scipy
Requires-Dist: typing-extensions>=4.12.2; python_full_version < '3.13'
Requires-Dist: zospy>=2.1.2; sys_platform == 'win32'
Provides-Extra: torch
Requires-Dist: torch; extra == 'torch'
Description-Content-Type: text/markdown

# Visisipy: accessible vision simulations in Python

[![PyPI - Version](https://img.shields.io/pypi/v/visisipy)](https://pypi.org/project/visisipy/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/visisipy)](https://anaconda.org/conda-forge/visisipy)
![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FMREYE-LUMC%2Fvisisipy%2Fmain%2Fpyproject.toml)
![GitHub License](https://img.shields.io/github/license/MREYE-LUMC/visisipy)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/MREYE-LUMC/visisipy/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/visisipy/badge/?version=latest)](https://visisipy.readthedocs.io/en/latest/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15423159.svg)](https://doi.org/10.5281/zenodo.15423159)

Visisipy (pronounced `/ˌvɪsəˈsɪpi/`, like Mississippi but with a V) is a Python library for optical simulations of the eye.
It provides an easy-to-use interface to define and build eye models, and to perform common ophthalmic analyses on these models.

## Goals

1. Provide a uniform interface to define, build and analyze various types of eye models, using abstractions that are relevant in a clinical context.
2. Provide a collection of ready-to-use eye models, such as the Navarro model[^navarro], that can be customized as needed.
3. Provide an accessible interface to clinically relevant analyses on these models, such as off-axis refraction calculations.
4. Modular design with support for multiple backends, both open-source and commercial.

## Contributing

Visisipy aims to be a community-driven project and warmly accepts contributions.
If you want to contribute, please email us (visisipy@mreye.nl) or [open a new discussion](https://github.com/MREYE-LUMC/visisipy/discussions).

## Installation

Visisipy can be installed through [`pip`](https://pypi.org/project/visisipy/):

```bash
pip install visisipy
```

Visisipy is also available on [Conda Forge](https://anaconda.org/conda-forge/visisipy):

```bash
conda install -c conda-forge visisipy
```

## Example

```python
import matplotlib.pyplot as plt
import seaborn as sns

import visisipy

# Uncomment the following line to use the open-source Optiland backend instead of OpticStudio
# visisipy.set_backend("optiland")

# Initialize the default Navarro model
model = visisipy.EyeModel()
model.geometry.pupil.thickness = 2.0

# Build the model in OpticStudio
model.build()

# Perform a raytrace analysis
coordinates = [(0, 0), (0, 10), (0, 20), (0, 30), (0, 40)]
raytrace = visisipy.analysis.raytrace(coordinates=coordinates)

# Alternatively, the model can be built and analyzed in one go:
# raytrace = visisipy.analysis.raytrace(model, coordinates=zip([0] * 5, range(0, 60, 10)))

# Visualize the model
fig, ax = plt.subplots()
visisipy.plots.plot_eye(ax, model.geometry, lens_edge_thickness=0.5)

sns.lineplot(raytrace, x="z", y="y", hue="field", ax=ax)

plt.show()
```

## Documentation

Read the full documentation at [visisipy.readthedocs.io](https://visisipy.readthedocs.io).

[//]: # (References)
[^navarro]: Escudero-Sanz, I., & Navarro, R. (1999). Off-axis aberrations of a wide-angle schematic eye model. JOSA A, 16(8), 1881–1891. https://doi.org/10.1364/JOSAA.16.001881