rayoptics.parax.paraxialdesign module

First order paraxial design space

bbox_from_poly(poly)[source]
calculate_slope(x, y, line_type)[source]

x=ybar, y=y

class ParaxialModel(opt_model, opt_inv=1.0, seq_mapping=None, **kwargs)[source]

Bases: object

sync_to_restore(opt_model)[source]
update_model(**kwargs)[source]
sync_to_seq(seq_model)[source]
set_from_specsheet(specsheet)[source]
build_lens()[source]
parax_from_dgms(dgm_list, opt_inv, rndx_and_imode=None)[source]

Construct a diagram using dgm_list, a list of diagram vertices.

get_num_nodes()[source]
parax_to_nodes(type_sel)[source]

render the paraxial model into a node list

update_parax_to_dgms()[source]

use the ax and pr to update the diagram and obj/pupil definition.

replace_node_with_dgm(e_node, dgm, **kwargs)[source]

Update the parax model from the node list, nodes.

nodes_to_parax(node_list, type_sel)[source]

Update the parax model from the node list, nodes.

get_pt(idx, type_sel=0)[source]
get_pt_np(idx, type_sel=0)[source]
set_pt(idx, pt, type_sel=0)[source]
apply_scale_factor(scale_factor)[source]

Apply scale factor to height diagram and update parax_model.

get_gap_for_node(node_idx, dgm_type)[source]
add_node(node, new_vertex, type_sel, sys_data)[source]

Add a node in the paraxial data structures

assign_object_to_node(node, new_node, type_sel, factory, **inputs)[source]

create a new element from factory and replace node with it

compute_signed_rindx()[source]

Reset the state of the refractive index array.

This method resets the signs of the refractive indices so that they are negative following an odd number of reflections, but positive otherwise.

replace_node_with_seq(node, sys_seq, pp_info)[source]

replaces the data at node with sys_seq

get_object_for_node(node)[source]

basic 1:1 relationship between seq and parax model sequences

delete_node(surf)[source]

delete the node at position surf

apply_ht_dgm_data(surf, new_vertex=None)[source]

This routine calculates all data dependent on the input height coordinates (y,ybar) at surface surf.

apply_slope_dgm_data(surf, new_vertex=None)[source]

This routine calculates all data dependent on the input slope coordinates (nu,nubar) at surface surf.

process_seq_mapping(nodes)[source]

The composite nodes are mapped and applied to the ifcs layer.

update_composite_node_fct(type_sel)[source]

returns the appropriate ‘apply’ fct for the type_sel.

update_rindex(surf)[source]

Update the refractive index using the gap at surf.

paraxial_trace()[source]

regenerate paraxial axial and chief rays from power and reduced distance

list_model()[source]

list the paraxial axial and chief rays, and power, reduced distance

list_lens()[source]

list the paraxial axial and chief rays, and power, reduced distance

list_sys_seq()[source]
first_order_data()[source]

List out the first order imaging properties of the model.

seq_path_to_paraxial_lens(path)[source]

returns lists of power, reduced thickness, signed index and refract mode

paraxial_lens_to_seq_model()[source]

Applies a paraxial lens spec (power, reduced distance) to the model

lens_from_dgm(idx: int, bending=0.0, th=None, sd=1.0, **kwargs)[source]

Return single lens constructional parameters from parax_model.

This method uses a method for thickening a lens element developed by Lopez-Lopez in his PhD dissertation The application of the Delano \(y-\overline{y}\) diagram to optical design.

The variables are named following the notation in the thesis. He used z for the \(y-\overline{y}\) coordinates; the reduced slopes and system parameters include a (inverse) factor of the optical invariant, and are capitalized here: T, W, Pwr

calc_object_and_pupil(idx: int)[source]

calculate axial intercepts of line between idx and idx+1

pwr_slope_solve(ray, surf: int, slp_new)[source]
pwr_ht_solve(ray, surf: int, ht_new)[source]
thi_ht_solve(ray, surf: int, ht_new)[source]
compute_principle_points_from_dgm(os_idx=0, is_idx=-2)[source]

Calculate focal points and principal points.

Parameters:
  • os_idx – object space gap index

  • is_idx – image space gap index

Returns:

(power, efl, fl_obj, fl_img, pp1, ppk, pp_sep, ffl, bfl)

  • power: optical power of system

  • efl: effective focal length

  • fl_obj: object space focal length, f

  • fl_img: image space focal length, f’

  • pp1: distance from the 1st interface to the front principle plane

  • ppk: distance from the last interface to the rear principle plane

  • pp_sep: distance from the front principle plane to the rear

    principle plane

  • ffl: front focal length, distance from the 1st interface to the

    front focal point

  • bfl: back focal length, distance from the last interface to the back

    focal point

apply_conjugate_shift(nodes, k, mat, line_type)[source]
calc_conjugate_shift(nodes, k, mat, line_type)[source]
match_pupil_and_conj(prx, **kwargs)[source]
paraxial_vignetting(rel_fov=1)[source]

Calculate the vignetting factors using paraxial optics.

dgm_sketch_to_parax_model(Z, opt_inv, *args, **inputs)[source]
nodes_to_new_model(*args, **inputs)[source]

Sketch a 2d polyline and populate an opt_model from it.

populate_model_from_parax(opt_model, factory, type_sel)[source]
create_diagram_for_key(opm, key, type_sel)[source]
update_diagram_for_key(opm, key, type_sel)[source]
generate_mapping_for_key(opm, key)[source]

generate all of the mappings, ht and slp, for key.

air_gaps_to_node_defs(air_gap_list)[source]

generate the node defs for composite layers, based on airgaps.

get_valid_ht_nodes(parax_model, node_defs_in)[source]

given the input node defs, replace non-physical thin lenses as needed.

ht_nodes_from_node_defs(parax_model, node_defs)[source]

produce a list of ht nodes given the parax_model and node_defs.

node_defs is a list of tuples, each with either one or two indices. if there is a single index, it is to a node in parax_model. if there are 2 indices, the first is to the gap preceding the element; the second is to the gap following the element (also the last interface of the element). The node is calculated from the intersection of the diagram edges corresponding to these gaps.

There is no guarentee that the nodes calculated here represent a physically realizable system, i.e. there may be virtual airspaces.

slp_nodes_from_node_defs(parax_model, node_defs)[source]

produce a list of slopes given the parax_model and node_defs.

node_defs is a list of tuples, each with either one or two indices. if there is a single index, it is to a node in parax_model. if there are 2 indices, the first is to the gap preceding the element; the second is to the gap following the element (also the last interface of the element). The node is calculated from the intersection of the diagram edges corresponding to these gaps.

There is no guarentee that the nodes calculated here represent a physically realizable system, i.e. there may be virtual airspaces.

scan_nodes(parax_model, node_defs, nodes)[source]

scan node defs for any invalid thin elements

Replace the first invalid thin element found with two 3 element tuples, signifying a thick node. The first tuple element is the index to the node in the parax_model and the last two elements are the range of indices in the parax_model covered by the thick element.

Return the updated node_def list.

build_from_yybar(opm, dgm_list, type_sel, seq_mapping)[source]

Returns a parax_model for the input nodes and seq_mapping.

gen_ifcs_node_mapping(parax_model, node_defs, nodes)[source]

Create mapping between composite diagram and interface based diagram.

Each node in the composite diagram is associated with one or a range of nodes in parax_model.layer[‘ifcs’]. node_defs and nodes define the composite diagram.

node_defs is a list of tuples, one per composite node, of length 1, 2, or 3. The number of entries is as follows:

  1. the composite node maps directly to node idx in the ‘ifcs’ layer

  2. the composite node is generated from the previous and following gap indices

  3. the composite node is part of a thick node

A thick node is what is used when reducing a range of interfaces to a single node requires virtual propagation distances. In this case, the first and last nodes in the range are retained in the composite diagram; interior nodes are scaled according to how the thick edge is stretched.

Changes in the composite diagram are propagated to the underlying ‘ifcs’ layer by applying a 2D stretch to the nodes in the ‘ifcs’ layer. The ‘ifcs’ node is parameterized by the calculating the intersection of the composite edge with the vector from the origin through the composite node. The scale factors are:

  • t1: parametric distance of the intersection point along the composite edge

  • t2: fractional distance of the composite node to the intersection point

The map_to_ifcs list connects the edge in the composite diagram to the ‘ifcs’ node and the scale factors needed to update the ‘ifcs’ node position when the composite diagram changes.

opt_inv_from_dgm_and_osp(Z, osp, efl=1, t=None)[source]

Use the osp database to update the diagram data

calc_object_and_pupil_from_dgm(Z, idx: int)[source]

calculate axial intercepts of line between idx and idx+1

compute_principle_points_from_dgm(Z, sys, opt_inv, os_idx=0, is_idx=-2)[source]

Calculate focal points and principal points.

Parameters:
  • Z – array of diagram points

  • sys – the system data for the diagram

  • opt_inv – optical invariant

  • os_idx – object space gap index

  • is_idx – image space gap index

Returns:

(power, efl, fl_obj, fl_img, pp1, ppk, pp_sep, ffl, bfl)

  • power: optical power of system

  • efl: effective focal length

  • fl_obj: object space focal length, f

  • fl_img: image space focal length, f’

  • pp1: distance from the 1st interface to the front principle plane

  • ppk: distance from the last interface to the rear principle plane

  • pp_sep: distance from the front principle plane to the rear

    principle plane

  • ffl: front focal length, distance from the 1st interface to the

    front focal point

  • bfl: back focal length, distance from the last interface to the back

    focal point

specsheet_from_dgm(parax_model, optical_spec, specsheet)[source]

update specsheet to contents of parax_model, while preserving inputs

update_from_dgm(Z, opt_inv, osp)[source]

Given a \(y-\overline{y}\) diagram Z, generate the dual and params.

parax_to_dgms(ax, pr, sys, opt_inv)[source]

convert paraxial rays to normalized diagram.

dgms_to_parax(Z, T, W, Pwr, opt_inv, rndx_and_imode=None)[source]

convert normalized diagrams to paraxial ray and first order system.