rayoptics.elem.surface module

Module for optical surface related classes

Surface

Container of profile, extent, position and orientation information of the surface

DecenterData

Maintains data and actions to support 4 types of position and orientation changes.

  • DEC: pos and orientation applied prior to surface

  • REV: pos and orientation applied following surface in reverse

  • DAR: pos and orientation applied prior to surface and then returned to initial frame

  • BEN: used for fold mirrors, orientation applied before and after surface

Aperture
  • Circular

  • Rectangular

  • Elliptical

class InteractionMode(value)[source]

Bases: Enum

enum for different interact_mode specifications

Retained to restore old files

Deprecated since version 0.4.5.

Transmit = 1

propagate in transmission at this interface

Reflect = 2

propagate in reflection at this interface

class Surface(lbl='', profile=None, clear_apertures=None, edge_apertures=None, **kwargs)[source]

Bases: Interface

Container of profile, extent, position and orientation.

label

optional label

profile

SurfaceProfile

clear_apertures

list of Aperture

edge_apertures

list of Aperture

interface_type()[source]
listobj_str()[source]
update()[source]
sync_to_restore(opt_model)[source]
property profile_cv
property optical_power
set_optical_power(pwr, n_before, n_after)[source]
apply_scale_factor(scale_factor)[source]
from_first_order(nu_before, nu_after, y)[source]
update_following_reflection()[source]

Notification that incident light is following reflection.

z_sag(pt)[source]
set_z_sag(pt)[source]
calc_cv_from_zsag(pt)[source]
flip()[source]
set_max_aperture(max_ap)[source]

max_ap is the max aperture radius

surface_od()[source]
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

edge_pt_target(rel_dir)[source]

Get a target for ray aiming to aperture boundaries.

get_y_aperture_extent()[source]

returns [y_min, y_max] for the union of apertures

full_profile(edge_extent, flat_id=None, dir=1, steps=6)[source]
intersect(p0, d, eps=1e-12, z_dir=1.0)[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)[source]

Returns the unit normal of the interface at point p.

class DecenterData(dtype, x=0.0, y=0.0, alpha=0.0, beta=0.0, gamma=0.0)[source]

Bases: object

Maintains data and actions for position and orientation changes.

  • ‘decenter’: pos and orientation applied prior to surface

  • ‘reverse’: pos and orientation applied following surface in reverse

  • ‘dec and return’: pos and orientation applied prior to surface and then returned to initial frame

  • ‘bend’: used for fold mirrors, orientation applied before and after surface

listobj_str()[source]
property dtype
update()[source]
apply_scale_factor(scale_factor)[source]
tform_before_surf()[source]
tform_after_surf()[source]
class Aperture(x_offset=0.0, y_offset=0.0, rotation=0.0)[source]

Bases: object

sync_to_restore(opt_model)[source]
listobj_str()[source]
dimension()[source]
set_dimension(x, y)[source]
max_dimension()[source]
point_inside(x: float, y: float, fuzz: float = 1e-05) bool[source]
bounding_box()[source]
apply_scale_factor(scale_factor)[source]
tform(x, y)[source]
class Circular(radius=1.0, **kwargs)[source]

Bases: Aperture

listobj_str()[source]
dimension()[source]
set_dimension(x, y)[source]
max_dimension()[source]
point_inside(x: float, y: float, fuzz: float = 1e-05) bool[source]
edge_pt_target(rel_dir)[source]

Get a target for ray aiming to aperture boundaries.

apply_scale_factor(scale_factor)[source]
class Rectangular(x_half_width=1.0, y_half_width=1.0, **kwargs)[source]

Bases: Aperture

listobj_str()[source]
dimension()[source]
set_dimension(x, y)[source]
point_inside(x: float, y: float, fuzz: float = 1e-05) bool[source]
edge_pt_target(rel_dir)[source]

Get a target for ray aiming to aperture boundaries.

apply_scale_factor(scale_factor)[source]
class Elliptical(x_half_width=1.0, y_half_width=1.0, **kwargs)[source]

Bases: Aperture

listobj_str()[source]
dimension()[source]
set_dimension(x, y)[source]
apply_scale_factor(scale_factor)[source]