pyoptools.raytrace.system package

Module contents

class pyoptools.raytrace.system.System

Bases: pyoptools.misc.picklable.picklable.Picklable

Class to define an optical system.

The System class defines an optical system as a list of optical components, the coordinates of the component origin, and the rotation angles of such components. To define a system the refraction index, or the material surrounding the components must also be given in the n attribute.

ARGUMENTS:

complist contains a tuple list that defines the optical system. The first component of the tuple is an instance of the component to include in the system. The second is tuple with the with the component location (X,Y,Z) The third is a tuple with the rotation around each axis (rx,ry,rz) the rotations ar applied first rz, then ry and then rx.
n contains the refraction index of the media where the system is immersed.

EXAMPLE:

Example of a system containing a doublet and a CCD detector:

# Definition of a doublet type lens
DB1=Doublet(radius=12.5,
    curvature_as =1./61.47,
    curvature_ms =-1./44.64,
    curvature_ps =-1./129.94,
    thickness_al = 6.,
    thickness_pl = 2.5,
    material_al  = N_BK7,
    material_pl  = SF5)

# Definition of a ccd type detector
ccd=CCD()

# Definition of a system
os=System(complist=[(DB1,(20,0,200),(0,0,0)),(ccd,(20,0,400),(0,0,0)),],n=1)
clear()
clear_ray_list()

Clear the ray lists of the system

complist
distance()

Distance length from a ray origin to a subsystem, following the ray path.

Method that calculates the distance traveled by a ray from its origin to the next surface of the component. It returns the physical distance, not the optical distance

Return value
A tuple with the distance, the point of intersection using the coordinate system of the surface, and a pointer to the surface that is closest to the ray (distance,point of intersection, surface)
get_component()

Return the component thatis defined using the surface described by path

get_surf_paths()

Method that returns a list that contains the path for each surface.

A path here is a list containing the keys needed to read each surface.

This method is an auxiliary method so this works when called from a System

get_surface()

Return a surface, given a path.

A path is given as a list of keys

items()
iter()
iteritems()
iterkeys()
itervalues()
keys()
merge()

Method to merge simulation systems. Useful for joining raytraces that where split for parallel processing.

n
pop()
popitem()
prop_ray
propagate()

Propagates all the rays in the non propagated list.

propagate_ray()

Method to propagate the ray in the system. It creates the nexts rays and links them using the Ray.parent, and Ray.childs attributes. It calls itself recurrently.

Arguments:

ri
Ray to propagate

Return Value

It returns ri

propagate_ray_ns()

Method to propagate the ray in the system.

Arguments

gr Guide ray previously propagated in the system using the non sequential algorithm. This ray contains the surface sequence that the rays must follow.
dpath Path (key) of the destination surface.

This method uses the same n as the calculated in the non sequential propagation. If the wavelength change, assertion error is raised

ray_add()

Rutina que adiciona un rayo a la lista de rayos primarios del sistema optico. Recibe como parametro una rayo o una lista de rayos. Genera un error si se le pasa algo diferente a un rayo (instancia de la clase Ray, genera una excepcion ‘’’

reset()

Run the reset method on all the components used to create the system

setdefault()
update()
update_ids()

Update the ids for all the surfaces in the system.

This should be done before running a propagation.

values()
viewitems()
viewkeys()
viewvalues()
class pyoptools.raytrace.system.IdealThickLens

Bases: pyoptools.raytrace.system.system.System

Class defined to create an Ideal ThickLens.

Is is created as a subsystem because the propagation inside has multiple rays entrance-> principal plane1 principal plane1 -> principal plane2 principal plane 2 -> exit fl -> focal length

ARGUMENTS

shape Shape of the lens (Entrance and exit surface’s shape).
thickness Thinckness of the lens (Distance between the entrance and exit surfaces)
princ_planes Tuple with the principal planes position. The position of each principal plane is measured from its corresponding entrance surface.
pupils

(pupil_pos, pupil_diam,pupil_rs) pupil_pos: pupil position measured from the active side pupil_shape: pupil shape pupil_rs: pupil reference surface. If true the reference surface will be E1. If false it will be E2 (see the source code). If True it will be an entrance pupil for the rays entering through surface E1, and an exit pupil for rays exiting through E1, or an exit pupil for rays entering through E2, and and an entrance pupil exiting through E2.

If false, E1 and E2 are switched. None if no pupil is defined

complete_trace If set to false the trace between the principal rays will not be shown. Still the trace from and to the entrance and exit surfaces will be exact

The origin of the component is located in the middle point between the entrance and exit surface.

distance

Solo se tienen en cuenta C1 y C2, que son los limites de entrada y salida del sistema.

propagate_ray