rayoptics.seq.interface module

Base class for Interfaces

class Interface(interact_mode='transmit', delta_n=0.0, max_ap=1.0, decenter=None, phase_element=None, **kwargs)[source]

Bases: object

Basic part of a sequential model

The SequentialModel is a sequence of Interfaces and Gaps. The Interface class is a boundary between two adjacent Gaps and their associated media. It specifies several methods that must be implemented to model the optical behavior of the interface.

The Interface class addresses the following use cases:

  • support for ray intersection calculation during ray tracing
    • interfaces can be tilted and decentered wrt the adjacent gaps

  • support for getting and setting the optical power of the interface

  • support for various optical properties, i.e. does it reflect or transmit

  • supports a basic idea of size, the max_aperture

interact_mode

‘transmit’ | ‘reflect’ | ‘dummy’ | ‘phantom’

delta_n

refractive index difference across the interface

decenter

DecenterData for the interface, if specified

max_aperture

the maximum aperture radius on the interface

listobj_str() str[source]
update()[source]
interface_type() str[source]
ifc_token() str[source]
sync_to_restore(opt_model)[source]
property profile_cv: float
set_optical_power(pwr: float, n_before: float, n_after: float)[source]
surface_od() float[source]
edge_pt_target(rel_dir: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) ndarray[tuple[Any, ...], dtype[float64]][source]

Get a target for ray aiming to aperture boundaries.

The main use case for this function is iterating a ray to the internal edge of a surface.

Although rel_dir is given as a 2d vector, in practice only the 4 quadrant axes are handled in the implementation, a 1D directional search along a coordinate axis.

Parameters:

rel_dir – 2d vector encoding coord axis and direction for edge sample

Returns:

intersection point of rel_dir with the aperture boundary

Return type:

edge_pt

point_inside(x: float, y: float, fuzz: float = 1e-05) bool[source]

Returns True if the point (x, y) is inside the clear aperture.

Parameters:
  • x – x coodinate of the test point

  • y – y coodinate of the test point

  • fuzz – tolerance on test pt/aperture comparison, i.e. pt fuzzy <= surface_od

set_max_aperture(max_ap: float)[source]

max_ap is the max aperture radius

get_y_aperture_extent() _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str][source]

default behavior is returning +/-max_aperture

intersect(p0: ndarray[tuple[Any, ...], dtype[float64]], d: ndarray[tuple[Any, ...], dtype[float64]], z_dir: Literal[-1, 1] = 1, eps: float = 1e-12) tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]

Intersect an Interface, starting from an arbitrary point.

Parameters:
  • p0 – start point of the ray in the interface’s coordinate system

  • d – direction cosine of the ray in the interface’s coordinate system

  • z_dir – +1 if propagation positive direction, -1 if otherwise

  • eps – numeric tolerance for convergence of any iterative procedure

Returns:

distance to intersection point s1, intersection point p

Return type:

tuple

Raises:

TraceMissedSurfaceError

normal(p: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Returns the unit normal of the interface at point p.

phase(pt: ndarray[tuple[Any, ...], dtype[float64]], in_dir: ndarray[tuple[Any, ...], dtype[float64]], srf_nrml: ndarray[tuple[Any, ...], dtype[float64]], ifc_cntxt: tuple) tuple[ndarray[tuple[Any, ...], dtype[float64]], float] | None[source]

Returns a diffracted ray direction and phase increment.

Parameters:
  • pt – point of incidence in Interface coordinates

  • in_dir – direction cosine of incident ray

  • srf_nrmlInterface surface normal at pt

  • ifc_cntxt

    a tuple containing

    z_dir: -1 if after an odd # of reflections, +1 otherwise wl: wavelength in nm for ray, defaults to ref_wl n_in: refractive index preceding the interface n_out: refractive index following the interface interact_mode: ‘transmit’ or ‘reflect’

Returns:

(out_dir, dW)

  • out_dir: direction cosine of the out going ray

  • dW: phase added by diffractive interaction

apply_scale_factor(scale_factor: float)[source]
update_following_reflection()[source]

Notification that incident light is following reflection.