visisipy.models#

Optical eye models.

This module provides the base classes for eye models and surfaces.

Submodules#

Classes#

EyeModel

Optical model of the eye.

BaseSurface

Abstract class that must be implemented by backend-specific surface classes.

BaseEye

Abstract class that must be implemented by backend-specific eye model classes.

Package Contents#

class visisipy.models.EyeModel#

Optical model of the eye.

Visisipy’s eye models consist of two parts: the geometry and the material model. The geometry defines the shape of the eye, while the material model defines the optical properties of the materials in the eye. By default, this model uses the geometry and materials of the Navarro wide-field eye model [1]. The default material model has been fitted to the refractive indices reported by Escudero-Sanz and Navarro [1]. This model will work with all visible wavelengths, but could deviate slightly from the values provided in the literature for the specified wavelengths.

Attributes#

geometryEyeGeometry

Geometry of the eye. Defaults to the geometry of the Navarro eye model.

materialsEyeMaterials

Properties of the materials of the eye. Defaults to the materials of the Navarro eye model.

See Also#

NavarroGeometry : Geometry of the Navarro eye model. NavarroMaterials : Materials of the Navarro eye model.

References#

build(*, start_from_index: int = 0, replace_existing: bool = False, object_distance: float = float('inf'), **kwargs) BaseEye#

Build the eye model in the backend.

If no backend has yet been initialized, the default backend is used. The eye model is built in the backend starting from the surface at index start_from_index. The cornea front surface will be located at start_from_index + 1. If replace_existing is set to True, the existing model in the backend will be overwritten. The object_distance parameter is used to set the distance between the cornea front and the surface preceding the eye model.

Parameters#

start_from_indexint

Index of the surface after which the eye model will be built.

replace_existingbool

If True, the existing model in the backend will be overwritten.

object_distancefloat

Distance between the cornea front and the surface preceding the eye model.

static clear() None#

Clear the model in the backend.

static save(filename: str | os.PathLike | None = None) None#

Save the model definition to a file.

Saving is done by the backend. As a consequence, the file format depends on the backend used.

Parameters#

filenamestr | PathLike | None

Name of the file to save the model. If None, the model will be saved in the default location. The file format depends on the backend used.

class visisipy.models.BaseSurface(comment: str, radius: float = float('inf'), thickness: float = 0.0, semi_diameter: float | None = None, conic: float = 0.0, material: Any | None = None, *, is_stop: bool | None = None)#

Bases: abc.ABC

Abstract class that must be implemented by backend-specific surface classes.

abstractmethod build(*args, position: int, replace_existing: bool = False) int#

Build the surface in the backend.

class visisipy.models.BaseEye(model: EyeModel)#

Bases: abc.ABC

Abstract class that must be implemented by backend-specific eye model classes.

abstractmethod build(*args, start_from_index: int = 0, replace_existing: bool = False, object_distance: float = float('inf'), **kwargs)#

Build the eye model in the backend.

If no backend has yet been initialized, the default backend is used. The eye model is built in the backend starting from the surface at index start_from_index. The cornea front surface will be located at start_from_index + 1. If replace_existing is set to True, the existing model in the backend will be overwritten. The object_distance parameter is used to set the distance between the cornea front and the surface preceding the eye model.

Parameters#

start_from_indexint

Index of the surface after which the eye model will be built.

replace_existingbool

If True, the existing model in the backend will be overwritten.

object_distancefloat

Distance between the cornea front and the surface preceding the eye model.

property surfaces: dict[str, BaseSurface]#

Dictionary with surface names as keys and surfaces as values.

update_surfaces(attribute: str, value: Any, surface_names: list[str] | None = None) None#

Batch update all surfaces.

Set attribute to value for multiple surfaces. If surfaces is not specified, all surfaces of the eye model are updated.

Parameters#

attributestr

Name of the attribute to update

valueAny

New value of the surface attribute

surfaceslist[str]

List of surfaces to be updated. If not specified, all surfaces are updated.

Returns#