rayoptics.elem.elements module
Module for element modeling
- class GraphicsHandle(polydata, tfrm, polytype, color)
Bases:
tuple
- color
RGBA for the polydata or None for default
- polydata
poly data in local coordinates
- polytype
‘polygon’ (for filled) or ‘polyline’
- tfrm
global transformation for polydata
- create_mirror(c=0.0, r=None, cc=0.0, ec=None, power=None, profile=None, sd=None, **kwargs)[source]
Create a sequence and element for a mirror.
- Parameters:
c – vertex curvature
r – vertex radius of curvature
cc – conic constant
ec – = 1 + cc
power – optical power of the mirror
sd – semi-diameter
profile – Spherical or Conic type, or a profile instance
- create_lens(power=0.0, bending=0.0, th=None, sd=1.0, med=None, lens=None, **kwargs)[source]
Create a lens element chunk of sm, em, pt tree, and \(y-\overline{y}\) entry
- Parameters:
kwargs –
keyword arguments including:
idx: insertion point in the sequential model
t: the thickness following a chunk when inserting
lens: tuple of cv1, cv2, th, glass_name_catalog, sd where:
cv1: front curvature
cv2: rear curvature
th: lens thickness
glass_input: a str, e.g. ‘N-BK7, Schott’ or index (+V-number)
sd: lens semi-diameter
- create_lens_from_dgm(prx=None, **kwargs)[source]
Use diagram points to create a lens.
Adds a \(y-\overline{y}\) component to the descriptor tuple. dgm = prx, dgm_pkg
prx = parax_model, node_idx, type_sel dgm_pkg = node_list, sys_data
sys_data = list([rndx, ‘transmit’|’reflect’])
- achromat(power, Va, Vb)[source]
Compute lens powers for a thin doublet achromat, given their V-numbers.
- create_cemented_doublet(power=0.0, bending=0.0, th=None, sd=1.0, glasses=('N-BK7,Schott', 'N-F2,Schott'), **kwargs)[source]
- render_lens_shape(s1, profile1, s2, profile2, thi, extent, sd, is_flipped, hole_sd=None, apply_tfrm=True, flat1_pkg=None, flat2_pkg=None)[source]
- full_profile(profile, is_flipped, edge_extent, flat_id=None, hole_id=None, dir=1, steps=6)[source]
Produce a 2d segmented approximation to the profile.
In the case of a hole, 2 polyline segments are returned. Otherwise, a single polyline is returned (as a tuple of len=1)
- Parameters:
profile – optical profile to be sampled
is_flipped – the flipped state of the profile
edge_extent – tuple with symmetric or asymetric bounds
flat_id – if not None, inside diameter of flat zone
hole_id – if not None, inside diameter of centered surface hole
dir – sampling direction, +1 for up, -1 for down
steps – number of profile curve samples
- Returns:
a tuple of 2d coord lists. a tuple is returned even in the case of a single coord list
- class Part(*args, **kwargs)[source]
Bases:
Protocol
Abstract base class for all types of elements.
- abstract sync_to_seq(seq_model: SequentialModel)[source]
- abstract sync_to_ele_def(seq_model, ele_def)[source]
Update idx_list and gap_list according to ele_def.
ele_def: (ele_type, idx_list, gap_list)
- abstract profile_list() List[SurfaceProfile] [source]
- abstract render_shape() List[GraphicsHandle] [source]
return a polyline that is representative of the Part.
- abstract render_handles(opt_model) Dict[str, GraphicsHandle] [source]
- do_flip_with_part_list(part_list: List[Part], flip_pt_tfrm) None [source]
Flip a list of parts around a flip_pt.
- class Element(sg_def=None, ele_def_pkg=None, tfrm=None, idx=0, idx2=1, sd=1.0, label=None)[source]
Bases:
Part
Lens element domain model. Manage rendering and selection/editing.
An Element consists of 2 Surfaces, 1 Gap, and edge_extent information.
- tfrm
global transform to element origin, (Rot3, trans3)
- medium_name
the material filling the gap
- flat1, flat2
semi-diameter of flat or None. Setting to None will result in re-evaluation of flat ID
- do_flat1, do_flat2
‘if concave’, ‘always’, ‘never’, ‘if convex’
- handles
dict of graphical entities
- actions
dict of actions associated with the graphical handles
- clut = <rayoptics.util.rgbtable.RGBTable object>
- serial_number = 0
- default_ele_token = 'lens'
- property sd
Semi-diameter
- class SurfaceInterface(ifc=None, ele_def_pkg=None, tfrm=None, idx=0, sd=1.0, z_dir=1.0, label=None)[source]
Bases:
Part
- serial_number = 0
- default_ele_token = 'surface'
- class Mirror(ifc=None, ele_def_pkg=None, thi=None, label=None, **kwargs)[source]
Bases:
SurfaceInterface
- serial_number = 0
- default_ele_token = 'mirror'
- class CementedElement(ifc_list=None, ele_def_pkg=None, label=None)[source]
Bases:
Part
Cemented element domain model. Manage rendering and selection/editing.
A CementedElement consists of 3 or more Surfaces, 2 or more Gaps, and edge_extent information.
- idxs
list of seq_model interface indices (depends on is_flipped)
- tfrm
global transform to element origin, (Rot3, trans3)
- medium_name
the material filling the gap
- flats
semi-diameter of flat if ifc is concave, or None
- handles
dict of graphical entities
- actions
dict of actions associated with the graphical handles
- clut = <rayoptics.util.rgbtable.RGBTable object>
- serial_number = 0
- default_ele_token = 'cemented'
- property sd
Semi-diameter
- sync_to_ele_def(seq_model, ele_def)[source]
Update idx_list and gap_list according to ele_def.
ele_def: (ele_type, idx_list, gap_list)
- compute_inner_flat(idx, sd, k)[source]
compute flats, if needed, for the inner cemented surfaces.
- Parameters:
idx – index of inner surface in profile list
sd – the semi-diameter of the cemented element
k – final, k-th, profile index
This function is needed to handle the cases where one of the outer surfaces has a flat and the inner surface would intersect this flat. All inner cemented surfaces are assumed to be spherical. See model US007277232_Example04P.roa See also cv_fisheye.roa
- render_shape()[source]
return a tuple of polylines of the lenses of the cemented element.
Flats on the outer surfaces of the cemented assembly are checked for intersections with the internal surfaces. The first outer surface is the zeroth interface; the other outer surface is interface k. In the case of the mangin assembly, the k-th surface is in the middle of the interface list.
- class ThinElement(ifc=None, ele_def_pkg=None, tfrm=None, idx=0, sd=None, label=None)[source]
Bases:
Part
- serial_number = 0
- default_ele_token = 'thin_lens'
- class DummyInterface(ifc=None, ele_def_pkg=None, idx=0, sd=None, tfrm=None, label=None)[source]
Bases:
Part
- serial_number = 0
- default_ele_token = 'dummy'
- class Space(label=None, g=None, ele_def_pkg=None, idx=0, tfrm=None, z_dir=1, **kwargs)[source]
Bases:
Part
- serial_number = 0
- default_ele_token = 'space'
- sync_to_ele_def(seq_model, ele_def)[source]
Update idx_list and gap_list according to ele_def.
ele_def: (ele_type, idx_list, gap_list)
- class AirGap(g=None, ele_def_pkg=None, label=None, **kwargs)[source]
Bases:
Space
- serial_number = 0
- default_ele_token = 'air'
- class Assembly(part_list, idx=0, tfrm=None, label=None)[source]
Bases:
Part
- serial_number = 0
- default_ele_token = 'asm'