| |
- __builtin__.list(__builtin__.object)
-
- ParaxialSystem
- RayPencil
- __builtin__.object
-
- ParaxialMatrix
-
- DielectricMatrix
- ParaxialGroup
-
- ParaxialAperture
- PropagationMatrix
- ThickLensMatrix
- ThinLensMatrix
- Ray
-
- IntensityRay
- ParaxialRay
-
- GaussianBeam
- RayPath
- Angle
- vector.Vector3d(__builtin__.object)
-
- Director
- Position
-
- SourcePoint
class Angle |
|
Class Angle to give phi,theta angle. |
|
Methods defined here:
- __init__(self, theta_or_d=0.0, psi=0.0)
- Constructor to set two angles
param theta_or_d the theta angle wrt to z-axis in radians (default = 0.0)
param psi the psi angle wrt to x-axis in radians (default = 0.0)
OR
param theta_or_d is a Director
- __repr__(self)
- Implement the repr() method to format Angle with 8.4e fomat and class name.
- __str__(self)
- Implement the str() method to format theta and psi with 8.4e format.
|
class DielectricMatrix(ParaxialMatrix) |
|
DielectricMatrix for flat or curved interface |
|
- Method resolution order:
- DielectricMatrix
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, nl, nr, c=0.0)
- Constructor with three parameters
param nl float refractive index on left of interface
param nr float refractive index on right of interface
param c float curvature of interface. (default = 0.0)
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- __repr__(self)
- Convert to a string
- backFocalLength(self)
- Method to get the back focal length
- backFocalPlane(self)
- Method to get the back focal plane (relative to output plane)
- backPower(self)
- Method to get the back power
- backPrincipalPlane(self)
- Method to get the back principal plane (relative to the output plane)
- copy(self)
- Method to make a copy of the ParaxialMatrix
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontFocalPlane(self)
- Method to get the front focal plane (relative to input plane)
- frontPower(self)
- Method to get the front power
- frontPrincipalPlane(self)
- Method to get the front principal plane (refaltive to the input plane)
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- scale(self, a)
- Method to scale the matrix by a factor a
element B and thickness as scaled by a, C is dvided by a, A/D not changed
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Director(vector.Vector3d) |
|
Director class to hold a unit vector, being the Ray Director.
This is Unit vector3d with additional methods. |
|
- Method resolution order:
- Director
- vector.Vector3d
- __builtin__.object
Methods defined here:
- __init__(self, x_or_v=0.0, y=0.0, z=0.0)
- Constructor to create and set Director.
param x_or_v float the component (default = 0.0)
param y float the y component (default = 0.0)
param z float the z component (default = 0.0)
OR
x_or_v Vector3d / or Director all three componets copied.
OR
x_or_v list, [0] = 1, [1] = y, [2] = z
If parameter is NOT a Director it is automatically normalsied to unit.
Note is (0,0,0)
or () suppled, the Director will be set to inValid
- __repr__(self)
- Implement repr() to give a formatted string represenation.
- copy(self)
- Return copy of current Director.
- reflection(self, n)
- Method to refect current Director from a surface specified by its
surface normal.
param n Director the surface normal.
returns True of all isValid()
- refraction(self, n, ratio)
- Method to refract the current Director through a suface with surface
specified by its surface normal.
param n Director, the surface normal of the surface.
param ratio the ration of refractice index at the boundary.
return True, if all successful, False if fails. current will be set
inValid is n is inValid
but NOT if failure is due to exceeding critical angle.
Methods inherited from vector.Vector3d:
- __abs__(self)
- Implement abs() to return the abs length of Vector3d as a float.
- __add__(self, b)
- Implement c = self + b for Vector3d, if b is float, then it will be added to
each component.
returns new Vector3d
- __div__(self, b)
- Implement c = self / b for Vector3d, if b is float it will divide each element
- __ge__(self, b)
- Implement >= to compare abs() of each vector
- __getitem__(self, key)
- Implement indexing on read in [i] syntax.
- __gt__(self, b)
- Implement > to compare abs() of each vectors
- __iadd__(self, v)
- Method to implement the += to add Vector3d to current in place, if v is a
Vectord3d the components will be added, while if it is a float it will be
added to each component.
- __idiv__(self, v)
- Method to implement the /= to divide current vector in place, if v is a
Vectord3d the components will be devided, while if it is a float it will
divide each component.
- __imul__(self, v)
- Method to implement the *= to multiply Vector3d by current in place, if v is a
Vectord3d the components will be multiplied, while if it is a float it will
multiply each component.
- __isub__(self, v)
- Method to implement the -= to subtract Vector3d from current in place, if v is
a Vectord3d the components will be subtrated, while if it is a float it will
be subrtacted from each component.
- __le__(self, b)
- Implement <= to compare abs() of each vector.
- __len__(self)
- Get len() defined at 3
- __lt__(self, b)
- Implement < to compare abs() of each vector.
- __mul__(self, b)
- Implement c = self * b for Vectors3d, if b is float it will multiply each element.
return new Vector3d
- __neg__(self)
- Implement the __neg__ method to return a new vector being the -ve of the current.
Note current not changed.
- __nonzero__(self)
- Implement the logical no-zero test if a vector is valid. True is self.n != Nan
- __radd__(self, b)
- Impement c = b + self for b not a Vector3d, (typically a float)
returns new Vector3d
- __rdiv__(self, b)
- Implement c = b / self for Vector3d, if b is float it will divide each element
- __rmul__(self, b)
- Implement c = b * self for Vector3d, if b is float it will multiply each element.
- __rsub__(self, b)
- Implement c = b - self for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- __setitem__(self, key, value)
- Implement indexing on write in s[i] syntax.
- __str__(self)
- Implement str() with componets fommatted with 8.4e
- __sub__(self, b)
- Implement c = self - b for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- abs(self)
- Return the abs of the Vector3d as a float.
- absCube(self)
- Return the absCube of the Vector3d as a float defined as
abs(x**3) + abs(y**3) + abs(z**3). Note does NOT use pow or **3
- absNormalised(self)
- Method to return abs() and normalsied copy of current vector as a
list pair (current vector not changed)
return [a,n] where a abs() and n is normalsied Vector3d
- absSquare(self)
- Return the absSquare of the vector3d as a float. Note does NOT use pow or **2
- angleBetween(self, b)
- Method to get the angle between two Vector3d
param b Vector3d second Vector3d
return float, angle in range -pi/2 and pi
Note: is abs(current) and abs(b) is zero, zero is returned.
- areaBetween(self, b)
- Method to get the area between two Vectors3d defined by a = 0.5 * abs (self x b)
param b Vector3d second Vector3d
return float, area defined by triangle formed by the two vectors
- cross(self, b)
- Method to form the cross product c = self x b
return Vector3d the cross product
- distance(self, b)
- Method to det the distance between two Vector3d
param b second Vector3d
return float distance between two vectors.
- distanceCube(self, b)
- Method to get distanceCube between two Vector3d, defined by sum |a.i - b.i|^3.
Note does NOT use **2 or pow.
param b the second Vector3d
return float the cube of the distance between vectors.
- distanceSquare(self, b)
- Method to get distanceSquare between two Vector3d, Note does NOT use **2 or pow.
param b the second Vector3d
return float the square of the distance between vectors
- dot(self, b)
- Method to form the .dot product of self . b
returns float the dot product.
- errorSquare(self, b)
- Method to get the normalsied square error between two Vector3d
param b Vector3d, the second vector
return float the normalsied square error
- inverseSquare(self, b)
- Method to get the Vector3d from current to Vector3d b scaled by inverse square of
the distance between them, for implementation of inverse square law forces.
Formula implements is v = (b - self) |b - self |^3
param b Vector3d, the second vector.
returned Vectors3d the scaled vector
- isValid(self)
- Method to test if vector is Valid
returns True for Valid, else False
- negate(self)
- Method to negate the current vector in place.
- normalise(self)
- Method to normalised vector in place.
Note: if abs() = 0, the current vector will be set inValid()
- polar(self)
- Return a copy of current vector in polar (r,theta,psi) form.
- rect(self)
- Return a copy of the current vector in rect (x,y,z) form from current assume to
be in polar (r,theta,psi) form.
Note: there is no error checking, so if the current Vector is NOT in polar
form you will get rubbish.
- rotate(self, alpha, beta, gamma)
- Method to implmeent general Rotate about x , y, z in place.
The rotation order is x,y then z.
param alpha rotation about x axis in radians
param beta rotation about y axis in radians
param gamma rotation about z axis in radians
- rotateAboutX(self, alpha)
- Method to implementate rotation about x axis in place.
param alpha rotatian about x axis in radians
- rotateAboutY(self, beta)
- Method to implementate a rotation about y axis in place.
param beta rotatian about y axis in radians.
- rotateAboutZ(self, gamma)
- Method to implementate a rotation about z axis in place.
param gamma rotatian about z axis in radians.
- round(self, figs=0)
- Method to round the current Vector2d to number of decimal figures.
param figs number of figures to round to (default is 0)
- set(self, x_or_v=0.0, y=0.0, z=0.0)
- Method to set vector with various augument types.
param x_or_v float x component (default = 0.0)
param y float y component (default = 0.0)
param z float z component (default = 0.0)
OR
param x_or_v Vector3d, all three componets copied
OR
param x_or_v list, [0] = 1, [1] = y, [2] = z
- setInvalid(self)
- Method to set current vector3d to Invalid by setting all three
compoents to float("nan").
- setLength(self, d)
- Method to set the length (or abs) of the current vector to specified length
by scaling.
param d float length vector is set to.
Data descriptors inherited from vector.Vector3d:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class GaussianBeam(ParaxialRay) |
|
Class to work with Gaussian Beams |
|
- Method resolution order:
- GaussianBeam
- ParaxialRay
- Ray
- __builtin__.object
Methods defined here:
- __init__(waist, wave=0.55, intensity=1.0)
- Construct Gaussan beam
param waist beam waist in mm
param wave wavelength in micoms
param intesity the intensity
- getCurvature(self)
- The beam curvature
- getDivergence(self)
- Get the divergence angle
- getRadius(self)
- Get the current beam radius
- getWaist(self)
- Get the minumum beam waist
- getWaistLocation(self)
- Get the waist location in global coordinates
Methods inherited from ParaxialRay:
- __repr__(self)
- Implement repr() details with full name
- __str__(self)
- Implment str() print parameters
- copy(self)
- Method to make a deep copy of a current ParaxialRay
- crosses(self, other)
- Method to locate where two ParaxialRays cross in global coordinates
other is other ParaxialRay
- crossesZero(self)
- Method to locate where ray crosses optical axis is global coordinates
- isValid(self)
- Method to test of a Paraxial Ray is valid
- mult(self, m)
- Method to multiply ParaxialRay by ParaxialMatrix and
return new ParaxialRay
- multBy(self, m)
- Method to multiply ParaxialRay by ParaxialMatrix in place.
- propagate(self, distance)
- Method to propagate a ray a specified distance
param distance, the distance the ray is propagated
returns True is sucessful, False is Ray is invalid
- propagateThrough(self, pg)
- # Method to propagate a ray throgh and ParaxialGroup or
# list or ParaxialGroups
# pg the ParaxialGroup or list of ParaxialGroups
- propagateToPlane(self, plane)
- Method to propagate the rays to a specified plane
param plane, the location of plane
return True is sucessful, False if Ray is invalid
- setInvalid(self)
- Method to set an ParaxialRay to inValid
Methods inherited from Ray:
- __add__(self, d)
- Impement __add__ to implement a = self + d
- __iadd__(self, d)
- Implement _iadd_ to propagate a distance d
- __imul__(self, surface)
- Implement ___rmul__ to multiply by a suraface
- __mul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __nonzero__(self)
- Implement logical __nonzero__ test of Ray is valid
- __radd__(self, d)
- Impement __add__ to implement a = self + d
- __rmul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- addMonitor(self, mon)
- Method to add a RayMonitor to the ray
- draw(self)
- Implemeent a draw if there is a RayPath minotor in place
Data descriptors inherited from Ray:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class IntensityRay(Ray) |
|
Class to form a Intensity Ray for general ray tracing |
|
- Method resolution order:
- IntensityRay
- Ray
- __builtin__.object
Methods defined here:
- __init__(self, pos, dirn, wavelength=0.55, intensity=1.0, index=None)
- Consctructor for to set parameters
param pos Position, the starting position of the ray
param dirn Director or Angle, the starting direction of the ray
param wavelength float (defaults to Default)
param intensity float or Spectrum (defaults = 1.0)
param index RefractiveIndex, (defaults to AirIndex())
- __repr__(self)
- Implement repr() to give detailed report an all variables for checking.
- copy(self)
- Return a (deep) copy of the current IntesnityRay.
- getPhaselength(self)
- Method to get the phase length, being 2*pi*pathelength/wavelength
- isValid(self)
- Method to check the ray is Valid (checks the Director is valid)
- pointInPlane(self, plane)
- Method to calcualte where this ray striked an optical place
This does NOT alter othe current ray.
param plane, the OpticalPlane or z the location on the optical axis
- propagate(self, distance)
- Method to propagate the ray a specifed distance using its own current direction.
This also upadtes the pathlength and is the main method to propgate rays.
param distance float the distance to propagate the ray.
return boolean, True for success, False if failed due to inValid self or direction.
- propagateThrough(self, surface)
- Method to propagate a ray through surface, or list of ray surfaces.
This is the main methof that does most of the work, it first propagaes the
ray to the surface and then depending on the surface it will block, reflect, block
or refract the ray depending on the type of surface. If the ray is refracted its
refratcive index is also updated.
param surface, Surface or list of list(Surface), if list each one is dealt with in order.
return boolean, true is passed through, false if blocked. If blocked the ray will
be invalid and it position will be set to the intersetcion point here it was blocked.
- setInvalid(self)
- Method to set the ray to inValid (sets the Director as invalid)
Methods inherited from Ray:
- __add__(self, d)
- Impement __add__ to implement a = self + d
- __iadd__(self, d)
- Implement _iadd_ to propagate a distance d
- __imul__(self, surface)
- Implement ___rmul__ to multiply by a suraface
- __mul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __nonzero__(self)
- Implement logical __nonzero__ test of Ray is valid
- __radd__(self, d)
- Impement __add__ to implement a = self + d
- __rmul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __str__(self)
- Implement srt() to give basic imformation, typically overloaded by extending class.
- addMonitor(self, mon)
- Method to add a RayMonitor to the ray
- draw(self)
- Implemeent a draw if there is a RayPath minotor in place
Data descriptors inherited from Ray:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ParaxialAperture(ParaxialGroup) |
|
# Class to make a ParaxialAperture |
|
- Method resolution order:
- ParaxialAperture
- ParaxialGroup
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, p, h)
- # Constuctor with only position and height
Methods inherited from ParaxialGroup:
- __repr__(self)
- Implment repr()
- backFocalPlane(self)
- Method to get the back focal plane in global coodinates
- backNodalPoint(self)
- Get the back Nodal point, (normally same as back principal plane)
- backPrincipalPlane(self)
- Method to get the back principal plane
- cardinalPoints(self)
- Method to get the 6 cardinal points as a list, order is:
0: Front Focal Point
1: Back Focal Point
2: Front principal plane
3: Back principal plane
4: Front nodal point (front principal plane for system in air)
5: Back nodal point (back principal plane for system in air)
- copy(self)
- # Method to make a deep copy of the current Paraxial Group
- draw(self)
- Draw 4 cardinal planes to plot
- frontFocalPlane(self)
- Method to get the front focal plane in global coodinates
- frontNodalPoint(self)
- Get Front Modal point, (normall the same as front Prinicpal Plane)
- frontPrincipalPlane(self)
- Method to get the front principal plane in global coordinates
- getInputPlane(self)
- Method to get input plane
- getOutputPlane(self)
- Method to get output plane
- imagePlane(self, op)
- Method to get the image plane for specified object plane using geometric lens fomula
and properties of the current group.
param op float location on object plane on optical axis
return float position on image plane.
- imagePoint(self, op)
- Method to three-dimensional image of a point in obejct space in global coordinates
geometric optics.
param op Position, object point, can also ve Director or Angle where it will assume an onfinite object
return Position the image point.
- planePair(self, mag)
- Calcualte the object image plane pair for specifed magnification in global coordinates.
param mag float the magnification (note most imaging system mag is -ve)
return list of [op,ip] being the location of the obeect and image places respectively
- scale(self, a)
- Method to scale the matrix and plane heights
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- backFocalLength(self)
- Method to get the back focal length
- backPower(self)
- Method to get the back power
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontPower(self)
- Method to get the front power
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ParaxialGroup(ParaxialMatrix) |
|
ParaxialGroup class to represent paraxial group with input plane, ParaxialMatrix and input and outplane heights. |
|
- Method resolution order:
- ParaxialGroup
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, p=0.0, matrix=ParaxialMatrix : [1.00000,0.00000]
[0.00000,1.00000] t: 0.00000, inh=inf, outh=None)
- Create the ParaxialGroup,
param p float the input plane of the matrix (default = 0.0)
param matrix the paraxial matrix, (defaults to unit matrix)
param inh float height of input plane, (defaults to float("inf"))
param inh float height of outut plane, (deafults to None, which is copy of input)
- __repr__(self)
- Implment repr()
- backFocalPlane(self)
- Method to get the back focal plane in global coodinates
- backNodalPoint(self)
- Get the back Nodal point, (normally same as back principal plane)
- backPrincipalPlane(self)
- Method to get the back principal plane
- cardinalPoints(self)
- Method to get the 6 cardinal points as a list, order is:
0: Front Focal Point
1: Back Focal Point
2: Front principal plane
3: Back principal plane
4: Front nodal point (front principal plane for system in air)
5: Back nodal point (back principal plane for system in air)
- copy(self)
- # Method to make a deep copy of the current Paraxial Group
- draw(self)
- Draw 4 cardinal planes to plot
- frontFocalPlane(self)
- Method to get the front focal plane in global coodinates
- frontNodalPoint(self)
- Get Front Modal point, (normall the same as front Prinicpal Plane)
- frontPrincipalPlane(self)
- Method to get the front principal plane in global coordinates
- getInputPlane(self)
- Method to get input plane
- getOutputPlane(self)
- Method to get output plane
- imagePlane(self, op)
- Method to get the image plane for specified object plane using geometric lens fomula
and properties of the current group.
param op float location on object plane on optical axis
return float position on image plane.
- imagePoint(self, op)
- Method to three-dimensional image of a point in obejct space in global coordinates
geometric optics.
param op Position, object point, can also ve Director or Angle where it will assume an onfinite object
return Position the image point.
- planePair(self, mag)
- Calcualte the object image plane pair for specifed magnification in global coordinates.
param mag float the magnification (note most imaging system mag is -ve)
return list of [op,ip] being the location of the obeect and image places respectively
- scale(self, a)
- Method to scale the matrix and plane heights
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- backFocalLength(self)
- Method to get the back focal length
- backPower(self)
- Method to get the back power
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontPower(self)
- Method to get the front power
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ParaxialMatrix(__builtin__.object) |
|
ParaxialMartrix for propagation between input and output planes |
|
Methods defined here:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __init__(self, a_or_m=1.0, b=0.0, c=0.0, d=1.0, t=0.0)
- Constructor with five parameters, the four matrix elements and thickness
a (default to 1.0)
b (defaults to 0.0)
c (defaults to 0.0)
d (defaults to 1.0)
t (defaults to 0.0)
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- __repr__(self)
- Convert to a string
- backFocalLength(self)
- Method to get the back focal length
- backFocalPlane(self)
- Method to get the back focal plane (relative to output plane)
- backPower(self)
- Method to get the back power
- backPrincipalPlane(self)
- Method to get the back principal plane (relative to the output plane)
- copy(self)
- Method to make a copy of the ParaxialMatrix
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontFocalPlane(self)
- Method to get the front focal plane (relative to input plane)
- frontPower(self)
- Method to get the front power
- frontPrincipalPlane(self)
- Method to get the front principal plane (refaltive to the input plane)
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- scale(self, a)
- Method to scale the matrix by a factor a
element B and thickness as scaled by a, C is dvided by a, A/D not changed
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ParaxialRay(Ray) |
|
Class for Paraxial Rays |
|
- Method resolution order:
- ParaxialRay
- Ray
- __builtin__.object
Methods defined here:
- __init__(self, height=0.0, angle=0.0, plane=0.0, wavelength=0.55, intensity=1.0)
- Constuctor with 5 optional arguments
param height (defaults to 0.0) height from optical axis
param angle (defaults to 0.0) angle in radians from optical axis
param plane (defaults to 0.0) location of plane along optical axis
param wavelength (defaults to Default) wavelength in microns
paramintensity (defaults to 1.0) intensity of ray
- __repr__(self)
- Implement repr() details with full name
- __str__(self)
- Implment str() print parameters
- copy(self)
- Method to make a deep copy of a current ParaxialRay
- crosses(self, other)
- Method to locate where two ParaxialRays cross in global coordinates
other is other ParaxialRay
- crossesZero(self)
- Method to locate where ray crosses optical axis is global coordinates
- isValid(self)
- Method to test of a Paraxial Ray is valid
- mult(self, m)
- Method to multiply ParaxialRay by ParaxialMatrix and
return new ParaxialRay
- multBy(self, m)
- Method to multiply ParaxialRay by ParaxialMatrix in place.
- propagate(self, distance)
- Method to propagate a ray a specified distance
param distance, the distance the ray is propagated
returns True is sucessful, False is Ray is invalid
- propagateThrough(self, pg)
- # Method to propagate a ray throgh and ParaxialGroup or
# list or ParaxialGroups
# pg the ParaxialGroup or list of ParaxialGroups
- propagateToPlane(self, plane)
- Method to propagate the rays to a specified plane
param plane, the location of plane
return True is sucessful, False if Ray is invalid
- setInvalid(self)
- Method to set an ParaxialRay to inValid
Methods inherited from Ray:
- __add__(self, d)
- Impement __add__ to implement a = self + d
- __iadd__(self, d)
- Implement _iadd_ to propagate a distance d
- __imul__(self, surface)
- Implement ___rmul__ to multiply by a suraface
- __mul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __nonzero__(self)
- Implement logical __nonzero__ test of Ray is valid
- __radd__(self, d)
- Impement __add__ to implement a = self + d
- __rmul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- addMonitor(self, mon)
- Method to add a RayMonitor to the ray
- draw(self)
- Implemeent a draw if there is a RayPath minotor in place
Data descriptors inherited from Ray:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ParaxialSystem(__builtin__.list) |
|
# ParaxialSystem with extends list |
|
- Method resolution order:
- ParaxialSystem
- __builtin__.list
- __builtin__.object
Methods defined here:
- __init__(self, pg=None)
- # Constructor with optional single ParaxialGroup
- getInputPlane(self)
- # Method to get input plane (input plane of first group)
- getOutputPlane(self)
- # Method to get the output plane (output plane of last element)
- getParaxialGroup(self)
- # Method to get the overall ParaxialGroup of the system.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from __builtin__.list:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __delslice__(...)
- x.__delslice__(i, j) <==> del x[i:j]
Use of negative indices is not supported.
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __iadd__(...)
- x.__iadd__(y) <==> x+=y
- __imul__(...)
- x.__imul__(y) <==> x*=y
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __reversed__(...)
- L.__reversed__() -- return a reverse iterator over the list
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
- x.__setslice__(i, j, y) <==> x[i:j]=y
Use of negative indices is not supported.
- __sizeof__(...)
- L.__sizeof__() -- size of L in memory, in bytes
- append(...)
- L.append(object) -- append object to end
- count(...)
- L.count(value) -> integer -- return number of occurrences of value
- extend(...)
- L.extend(iterable) -- extend list by appending elements from the iterable
- index(...)
- L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
- insert(...)
- L.insert(index, object) -- insert object before index
- pop(...)
- L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- remove(...)
- L.remove(value) -- remove first occurrence of value.
Raises ValueError if the value is not present.
- reverse(...)
- L.reverse() -- reverse *IN PLACE*
- sort(...)
- L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
cmp(x, y) -> -1, 0, 1
Data and other attributes inherited from __builtin__.list:
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Position(vector.Vector3d) |
|
Position class to hold a 3d position. In extends Vector3d to add
a coupple of methods. |
|
- Method resolution order:
- Position
- vector.Vector3d
- __builtin__.object
Methods defined here:
- __init__(self, x_or_v=0.0, y=0.0, z=0.0)
- Constructor to create and set a Position
param x_or_v float the x component (default = 0.0)
param y float the y component (default = 0.0)
param z float the z component (default = 0.0)
OR
param x_or_v Vector3d / Position, all three componets copied.
OR
x_or_v list, [0] = 1, [1] = y, [2] = z
- __repr__(self)
- Implement repr() to give a formatted string represenation.
- copy(self)
- Return a copy of the current Position.
- propagate(self, u, d)
- Propagate current Position a distance directions specifed by Director.
param u the Director
param d float the distance
param return True if successful, else False if either current or
Director is inValid.
Methods inherited from vector.Vector3d:
- __abs__(self)
- Implement abs() to return the abs length of Vector3d as a float.
- __add__(self, b)
- Implement c = self + b for Vector3d, if b is float, then it will be added to
each component.
returns new Vector3d
- __div__(self, b)
- Implement c = self / b for Vector3d, if b is float it will divide each element
- __ge__(self, b)
- Implement >= to compare abs() of each vector
- __getitem__(self, key)
- Implement indexing on read in [i] syntax.
- __gt__(self, b)
- Implement > to compare abs() of each vectors
- __iadd__(self, v)
- Method to implement the += to add Vector3d to current in place, if v is a
Vectord3d the components will be added, while if it is a float it will be
added to each component.
- __idiv__(self, v)
- Method to implement the /= to divide current vector in place, if v is a
Vectord3d the components will be devided, while if it is a float it will
divide each component.
- __imul__(self, v)
- Method to implement the *= to multiply Vector3d by current in place, if v is a
Vectord3d the components will be multiplied, while if it is a float it will
multiply each component.
- __isub__(self, v)
- Method to implement the -= to subtract Vector3d from current in place, if v is
a Vectord3d the components will be subtrated, while if it is a float it will
be subrtacted from each component.
- __le__(self, b)
- Implement <= to compare abs() of each vector.
- __len__(self)
- Get len() defined at 3
- __lt__(self, b)
- Implement < to compare abs() of each vector.
- __mul__(self, b)
- Implement c = self * b for Vectors3d, if b is float it will multiply each element.
return new Vector3d
- __neg__(self)
- Implement the __neg__ method to return a new vector being the -ve of the current.
Note current not changed.
- __nonzero__(self)
- Implement the logical no-zero test if a vector is valid. True is self.n != Nan
- __radd__(self, b)
- Impement c = b + self for b not a Vector3d, (typically a float)
returns new Vector3d
- __rdiv__(self, b)
- Implement c = b / self for Vector3d, if b is float it will divide each element
- __rmul__(self, b)
- Implement c = b * self for Vector3d, if b is float it will multiply each element.
- __rsub__(self, b)
- Implement c = b - self for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- __setitem__(self, key, value)
- Implement indexing on write in s[i] syntax.
- __str__(self)
- Implement str() with componets fommatted with 8.4e
- __sub__(self, b)
- Implement c = self - b for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- abs(self)
- Return the abs of the Vector3d as a float.
- absCube(self)
- Return the absCube of the Vector3d as a float defined as
abs(x**3) + abs(y**3) + abs(z**3). Note does NOT use pow or **3
- absNormalised(self)
- Method to return abs() and normalsied copy of current vector as a
list pair (current vector not changed)
return [a,n] where a abs() and n is normalsied Vector3d
- absSquare(self)
- Return the absSquare of the vector3d as a float. Note does NOT use pow or **2
- angleBetween(self, b)
- Method to get the angle between two Vector3d
param b Vector3d second Vector3d
return float, angle in range -pi/2 and pi
Note: is abs(current) and abs(b) is zero, zero is returned.
- areaBetween(self, b)
- Method to get the area between two Vectors3d defined by a = 0.5 * abs (self x b)
param b Vector3d second Vector3d
return float, area defined by triangle formed by the two vectors
- cross(self, b)
- Method to form the cross product c = self x b
return Vector3d the cross product
- distance(self, b)
- Method to det the distance between two Vector3d
param b second Vector3d
return float distance between two vectors.
- distanceCube(self, b)
- Method to get distanceCube between two Vector3d, defined by sum |a.i - b.i|^3.
Note does NOT use **2 or pow.
param b the second Vector3d
return float the cube of the distance between vectors.
- distanceSquare(self, b)
- Method to get distanceSquare between two Vector3d, Note does NOT use **2 or pow.
param b the second Vector3d
return float the square of the distance between vectors
- dot(self, b)
- Method to form the .dot product of self . b
returns float the dot product.
- errorSquare(self, b)
- Method to get the normalsied square error between two Vector3d
param b Vector3d, the second vector
return float the normalsied square error
- inverseSquare(self, b)
- Method to get the Vector3d from current to Vector3d b scaled by inverse square of
the distance between them, for implementation of inverse square law forces.
Formula implements is v = (b - self) |b - self |^3
param b Vector3d, the second vector.
returned Vectors3d the scaled vector
- isValid(self)
- Method to test if vector is Valid
returns True for Valid, else False
- negate(self)
- Method to negate the current vector in place.
- normalise(self)
- Method to normalised vector in place.
Note: if abs() = 0, the current vector will be set inValid()
- polar(self)
- Return a copy of current vector in polar (r,theta,psi) form.
- rect(self)
- Return a copy of the current vector in rect (x,y,z) form from current assume to
be in polar (r,theta,psi) form.
Note: there is no error checking, so if the current Vector is NOT in polar
form you will get rubbish.
- rotate(self, alpha, beta, gamma)
- Method to implmeent general Rotate about x , y, z in place.
The rotation order is x,y then z.
param alpha rotation about x axis in radians
param beta rotation about y axis in radians
param gamma rotation about z axis in radians
- rotateAboutX(self, alpha)
- Method to implementate rotation about x axis in place.
param alpha rotatian about x axis in radians
- rotateAboutY(self, beta)
- Method to implementate a rotation about y axis in place.
param beta rotatian about y axis in radians.
- rotateAboutZ(self, gamma)
- Method to implementate a rotation about z axis in place.
param gamma rotatian about z axis in radians.
- round(self, figs=0)
- Method to round the current Vector2d to number of decimal figures.
param figs number of figures to round to (default is 0)
- set(self, x_or_v=0.0, y=0.0, z=0.0)
- Method to set vector with various augument types.
param x_or_v float x component (default = 0.0)
param y float y component (default = 0.0)
param z float z component (default = 0.0)
OR
param x_or_v Vector3d, all three componets copied
OR
param x_or_v list, [0] = 1, [1] = y, [2] = z
- setInvalid(self)
- Method to set current vector3d to Invalid by setting all three
compoents to float("nan").
- setLength(self, d)
- Method to set the length (or abs) of the current vector to specified length
by scaling.
param d float length vector is set to.
Data descriptors inherited from vector.Vector3d:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PropagationMatrix(ParaxialMatrix) |
|
ParaxialMatrix for propagation |
|
- Method resolution order:
- PropagationMatrix
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, d)
- param d float the propagation distance
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- __repr__(self)
- Convert to a string
- backFocalLength(self)
- Method to get the back focal length
- backFocalPlane(self)
- Method to get the back focal plane (relative to output plane)
- backPower(self)
- Method to get the back power
- backPrincipalPlane(self)
- Method to get the back principal plane (relative to the output plane)
- copy(self)
- Method to make a copy of the ParaxialMatrix
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontFocalPlane(self)
- Method to get the front focal plane (relative to input plane)
- frontPower(self)
- Method to get the front power
- frontPrincipalPlane(self)
- Method to get the front principal plane (refaltive to the input plane)
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- scale(self, a)
- Method to scale the matrix by a factor a
element B and thickness as scaled by a, C is dvided by a, A/D not changed
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Ray(__builtin__.object) |
|
Base Ray class whih just hold wavelength and intensity all other (useful)
classes extend this Base class |
|
Methods defined here:
- __add__(self, d)
- Impement __add__ to implement a = self + d
- __iadd__(self, d)
- Implement _iadd_ to propagate a distance d
- __imul__(self, surface)
- Implement ___rmul__ to multiply by a suraface
- __init__(self, wavelength=0.55, intensity=1.0)
- Constuctor with two optional arguments
param wavelength float in microns (defaults to Default (0.55um))
param intensity with float OR Spectrum, (defaults to 1.0)
- __mul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __nonzero__(self)
- Implement logical __nonzero__ test of Ray is valid
- __radd__(self, d)
- Impement __add__ to implement a = self + d
- __repr__(self)
- Implement repr() to give more detailed information, typiaclly overloaded by extending class.
- __rmul__(self, surface)
- Implement ___mul__ to multiply by a suraface
- __str__(self)
- Implement srt() to give basic imformation, typically overloaded by extending class.
- addMonitor(self, mon)
- Method to add a RayMonitor to the ray
- draw(self)
- Implemeent a draw if there is a RayPath minotor in place
- isValid(self)
- Method to test if Ray is valid, needs to be defined in extending classes.
- setInvalid(self)
- Method to set Ray as inValid, need to be defined in extending classes.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class RayPath(__builtin__.object) |
|
Class to record a ray path. the path in held in three lists x[], y[] and z[] |
|
Methods defined here:
- __init__(self, ray=None)
- __str__(self)
- copy(self)
- Method to form a copy of itself
- draw(self)
- Do a plot to pyplot
- update(self, ray)
- udate method, records the x,y,z position of the ray is lists
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class RayPencil(__builtin__.list) |
|
Class to hold a list of rays and implement methods to propagate on-mass |
|
- Method resolution order:
- RayPencil
- __builtin__.list
- __builtin__.object
Methods defined here:
- __imul__(self, surface)
- Implement ___rmul__ to multiply by a suraface
- __init__(self, *args)
- Make a ray pencil with optional set of rays
- addCollimatedBeam(self, ca, u, key='vl', nrays=10, wave=0.55, intensity=1.0)
- Method to add a collimated beam
param ca circular aperture to fill
param u direction of rays
param key method of fill, allowed keys as "vl", "hl" and "array",(default is "vl")
param nrays, number or rays aross radius, (default = 10)
param wave, the wavelength, (default = wl.Default)
param intensity, the ray intensity, (default = 1.0)
- addMonitor(self, monitor)
- Method to add a copy of the monitor to each ray
- addSourceBeam(self, ca, source, key='vl', nrays=10, wave=0.55)
- Method to add beam from a source
param ca circular aperture to fill
param u direction of rays
param key method of fill, allowed keys as "vl", "hl" and "array",(default is "vl")
param nrays, number or rays aross radius, (default = 10)
param wave, the wavelength, (default = wl.Default)
- draw(self)
- Draw each ray
- propagate(self, distance)
- Method to propagate all rays a equals distance
- propagateThrough(self, sur)
- Propagate he whole pencil hrough the surface
- removeInvalid(self)
- Method to remove invalid rays from the pencil
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from __builtin__.list:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __delslice__(...)
- x.__delslice__(i, j) <==> del x[i:j]
Use of negative indices is not supported.
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __iadd__(...)
- x.__iadd__(y) <==> x+=y
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __reversed__(...)
- L.__reversed__() -- return a reverse iterator over the list
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- __setslice__(...)
- x.__setslice__(i, j, y) <==> x[i:j]=y
Use of negative indices is not supported.
- __sizeof__(...)
- L.__sizeof__() -- size of L in memory, in bytes
- append(...)
- L.append(object) -- append object to end
- count(...)
- L.count(value) -> integer -- return number of occurrences of value
- extend(...)
- L.extend(iterable) -- extend list by appending elements from the iterable
- index(...)
- L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
- insert(...)
- L.insert(index, object) -- insert object before index
- pop(...)
- L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- remove(...)
- L.remove(value) -- remove first occurrence of value.
Raises ValueError if the value is not present.
- reverse(...)
- L.reverse() -- reverse *IN PLACE*
- sort(...)
- L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
cmp(x, y) -> -1, 0, 1
Data and other attributes inherited from __builtin__.list:
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class SourcePoint(Position) |
|
Class implement a source poin, being a 3d point wih an attched specum |
|
- Method resolution order:
- SourcePoint
- Position
- vector.Vector3d
- __builtin__.object
Methods defined here:
- __init__(self, pos, s_or_i)
- Create a 3d source point
param pos, Position, the three-D Posistion
param spectrum the attched spectrum
- getIntensity(self, wave)
- Get the intensity as specified wavelength
Methods inherited from Position:
- __repr__(self)
- Implement repr() to give a formatted string represenation.
- copy(self)
- Return a copy of the current Position.
- propagate(self, u, d)
- Propagate current Position a distance directions specifed by Director.
param u the Director
param d float the distance
param return True if successful, else False if either current or
Director is inValid.
Methods inherited from vector.Vector3d:
- __abs__(self)
- Implement abs() to return the abs length of Vector3d as a float.
- __add__(self, b)
- Implement c = self + b for Vector3d, if b is float, then it will be added to
each component.
returns new Vector3d
- __div__(self, b)
- Implement c = self / b for Vector3d, if b is float it will divide each element
- __ge__(self, b)
- Implement >= to compare abs() of each vector
- __getitem__(self, key)
- Implement indexing on read in [i] syntax.
- __gt__(self, b)
- Implement > to compare abs() of each vectors
- __iadd__(self, v)
- Method to implement the += to add Vector3d to current in place, if v is a
Vectord3d the components will be added, while if it is a float it will be
added to each component.
- __idiv__(self, v)
- Method to implement the /= to divide current vector in place, if v is a
Vectord3d the components will be devided, while if it is a float it will
divide each component.
- __imul__(self, v)
- Method to implement the *= to multiply Vector3d by current in place, if v is a
Vectord3d the components will be multiplied, while if it is a float it will
multiply each component.
- __isub__(self, v)
- Method to implement the -= to subtract Vector3d from current in place, if v is
a Vectord3d the components will be subtrated, while if it is a float it will
be subrtacted from each component.
- __le__(self, b)
- Implement <= to compare abs() of each vector.
- __len__(self)
- Get len() defined at 3
- __lt__(self, b)
- Implement < to compare abs() of each vector.
- __mul__(self, b)
- Implement c = self * b for Vectors3d, if b is float it will multiply each element.
return new Vector3d
- __neg__(self)
- Implement the __neg__ method to return a new vector being the -ve of the current.
Note current not changed.
- __nonzero__(self)
- Implement the logical no-zero test if a vector is valid. True is self.n != Nan
- __radd__(self, b)
- Impement c = b + self for b not a Vector3d, (typically a float)
returns new Vector3d
- __rdiv__(self, b)
- Implement c = b / self for Vector3d, if b is float it will divide each element
- __rmul__(self, b)
- Implement c = b * self for Vector3d, if b is float it will multiply each element.
- __rsub__(self, b)
- Implement c = b - self for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- __setitem__(self, key, value)
- Implement indexing on write in s[i] syntax.
- __str__(self)
- Implement str() with componets fommatted with 8.4e
- __sub__(self, b)
- Implement c = self - b for Vector3d, if b is float it will be subtracted
from each element.
returns new Vector3d
- abs(self)
- Return the abs of the Vector3d as a float.
- absCube(self)
- Return the absCube of the Vector3d as a float defined as
abs(x**3) + abs(y**3) + abs(z**3). Note does NOT use pow or **3
- absNormalised(self)
- Method to return abs() and normalsied copy of current vector as a
list pair (current vector not changed)
return [a,n] where a abs() and n is normalsied Vector3d
- absSquare(self)
- Return the absSquare of the vector3d as a float. Note does NOT use pow or **2
- angleBetween(self, b)
- Method to get the angle between two Vector3d
param b Vector3d second Vector3d
return float, angle in range -pi/2 and pi
Note: is abs(current) and abs(b) is zero, zero is returned.
- areaBetween(self, b)
- Method to get the area between two Vectors3d defined by a = 0.5 * abs (self x b)
param b Vector3d second Vector3d
return float, area defined by triangle formed by the two vectors
- cross(self, b)
- Method to form the cross product c = self x b
return Vector3d the cross product
- distance(self, b)
- Method to det the distance between two Vector3d
param b second Vector3d
return float distance between two vectors.
- distanceCube(self, b)
- Method to get distanceCube between two Vector3d, defined by sum |a.i - b.i|^3.
Note does NOT use **2 or pow.
param b the second Vector3d
return float the cube of the distance between vectors.
- distanceSquare(self, b)
- Method to get distanceSquare between two Vector3d, Note does NOT use **2 or pow.
param b the second Vector3d
return float the square of the distance between vectors
- dot(self, b)
- Method to form the .dot product of self . b
returns float the dot product.
- errorSquare(self, b)
- Method to get the normalsied square error between two Vector3d
param b Vector3d, the second vector
return float the normalsied square error
- inverseSquare(self, b)
- Method to get the Vector3d from current to Vector3d b scaled by inverse square of
the distance between them, for implementation of inverse square law forces.
Formula implements is v = (b - self) |b - self |^3
param b Vector3d, the second vector.
returned Vectors3d the scaled vector
- isValid(self)
- Method to test if vector is Valid
returns True for Valid, else False
- negate(self)
- Method to negate the current vector in place.
- normalise(self)
- Method to normalised vector in place.
Note: if abs() = 0, the current vector will be set inValid()
- polar(self)
- Return a copy of current vector in polar (r,theta,psi) form.
- rect(self)
- Return a copy of the current vector in rect (x,y,z) form from current assume to
be in polar (r,theta,psi) form.
Note: there is no error checking, so if the current Vector is NOT in polar
form you will get rubbish.
- rotate(self, alpha, beta, gamma)
- Method to implmeent general Rotate about x , y, z in place.
The rotation order is x,y then z.
param alpha rotation about x axis in radians
param beta rotation about y axis in radians
param gamma rotation about z axis in radians
- rotateAboutX(self, alpha)
- Method to implementate rotation about x axis in place.
param alpha rotatian about x axis in radians
- rotateAboutY(self, beta)
- Method to implementate a rotation about y axis in place.
param beta rotatian about y axis in radians.
- rotateAboutZ(self, gamma)
- Method to implementate a rotation about z axis in place.
param gamma rotatian about z axis in radians.
- round(self, figs=0)
- Method to round the current Vector2d to number of decimal figures.
param figs number of figures to round to (default is 0)
- set(self, x_or_v=0.0, y=0.0, z=0.0)
- Method to set vector with various augument types.
param x_or_v float x component (default = 0.0)
param y float y component (default = 0.0)
param z float z component (default = 0.0)
OR
param x_or_v Vector3d, all three componets copied
OR
param x_or_v list, [0] = 1, [1] = y, [2] = z
- setInvalid(self)
- Method to set current vector3d to Invalid by setting all three
compoents to float("nan").
- setLength(self, d)
- Method to set the length (or abs) of the current vector to specified length
by scaling.
param d float length vector is set to.
Data descriptors inherited from vector.Vector3d:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ThickLensMatrix(ParaxialMatrix) |
|
ParaxialMatrix for a thick lens. |
|
- Method resolution order:
- ThickLensMatrix
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, cl, n, t, cr)
- Constructor with 4 parameters, all reqired
param cl float left curvature
param n float refractive index
param t float thickness of lens
param cr float right curvature
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- __repr__(self)
- Convert to a string
- backFocalLength(self)
- Method to get the back focal length
- backFocalPlane(self)
- Method to get the back focal plane (relative to output plane)
- backPower(self)
- Method to get the back power
- backPrincipalPlane(self)
- Method to get the back principal plane (relative to the output plane)
- copy(self)
- Method to make a copy of the ParaxialMatrix
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontFocalPlane(self)
- Method to get the front focal plane (relative to input plane)
- frontPower(self)
- Method to get the front power
- frontPrincipalPlane(self)
- Method to get the front principal plane (refaltive to the input plane)
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- scale(self, a)
- Method to scale the matrix by a factor a
element B and thickness as scaled by a, C is dvided by a, A/D not changed
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ThinLensMatrix(ParaxialMatrix) |
|
ParaxialMatrix for a thin lens |
|
- Method resolution order:
- ThinLensMatrix
- ParaxialMatrix
- __builtin__.object
Methods defined here:
- __init__(self, f_or_cl, n=None, cr=None)
- Constuctor with one or three paramters
param f_or_cl float flocal length or left curvature
param n refractive index (defaults None)
param cr reight curvaure
Methods inherited from ParaxialMatrix:
- __add__(self, d)
- Short hand to implement a propagation matrix
param d float the distance
- __iadd__(self, d)
- Short hand to implement a propagation martix in place
param d the distance
- __imul__(self, m)
- Method to pre-multiply the currenr matrix by a another Paraxialmatrix in place
- __mul__(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix, or if a float
it is scaled
return new ParaxialMatrix
- __repr__(self)
- Convert to a string
- backFocalLength(self)
- Method to get the back focal length
- backFocalPlane(self)
- Method to get the back focal plane (relative to output plane)
- backPower(self)
- Method to get the back power
- backPrincipalPlane(self)
- Method to get the back principal plane (relative to the output plane)
- copy(self)
- Method to make a copy of the ParaxialMatrix
- determinant(self)
- Return the determinant of the matrix
- frontFocalLength(self)
- Method to get the front focal length
- frontFocalPlane(self)
- Method to get the front focal plane (relative to input plane)
- frontPower(self)
- Method to get the front power
- frontPrincipalPlane(self)
- Method to get the front principal plane (refaltive to the input plane)
- mult(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix
return new ParaxialMatrix
- multBy(self, m)
- Method to pre-multiply the current matrix by a another Paraxialmatrix in place
- scale(self, a)
- Method to scale the matrix by a factor a
element B and thickness as scaled by a, C is dvided by a, A/D not changed
- setBackFocalLength(self, f)
- Method to set the back focal length by scaling
- setFrontFocalLength(self, f)
- Method to set the front focal length by scaling
- trace(self)
- Return the trace of the matrix
Data descriptors inherited from ParaxialMatrix:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |