pyoptools.raytrace.surface.surface module¶
-
class
pyoptools.raytrace.surface.surface.
Surface
¶ Bases:
pyoptools.misc.picklable.picklable.Picklable
Surface
is an abstract superclass for all optical surface objects. This class defines an API that all subclasses must support.All Surface subclasses share the attributes reflectivity, and shape, that are defined as follows:
reflectivity Float point number between 0 and 1. 0 indicates a completely transparent surface, 1 a completely reflective surface. A value between are beam spliters. shape Instance of the Shape
, that indicates the surface’s aperture shape.Each surface stores a hit_list, so the ray impact information can be obtained. This list records the point of impact in the surface reference system, and a pointer to the hitting ray so intensity, wavelength, and other information about the ray can be retrieved. The reset method, clear this lists.
-
distance
()¶ Distance propagated by a ray until intersection with a surface.
This method returns the distance propagated by a ray since its origin and its point of intersection with a surface.
Args:
iray
- Incident ray, iray must be in the coordinate system of the surface
Returns:
A tuple
(distance,point_of_intersection, surface)
, where:distance
- The distance from the ray origin to the point of intersection with the surface
point_of_intersection
- The point of intersection using the coordinate system of the surface
surface
- a pointer to the surface
-
distance_s
()¶ Distance propagated by a ray until intersection with a surface.
This method returns the distance propagated by a ray since its origin and its point of intersection with a surface. This method returns positive and negative distances, and does not check for apertures.
Parameters: -- incident ray (iray) – iray must be in the coordinate system of the surface
Return value:
A tuple with the distance, the point of intersection using the coordinate system of the surface, and a pointer to the surface (distance,point of intersection, surface)
-
hit_list
¶
-
id
¶
-
int_nor
()¶ Point of intersection between a ray and a surface and the normal.
Method that returns the point of intersection between a surface and a ray, and the vector normal to this point. I must return a tuple of the form
((ix,iyi,z),(nx,ny,nz))
, whereix,iy,iz
are the coordinates of the intersection point, and nx,ny,nz are the components of the vector normal to the surface.Arguments:
iray – incident ray in the coordinate system of the surface.This method uses surface.intersection, surface.normal, and surface.shape.hit
-
intersection
()¶ Point of intersection between a ray and a surface.
This method returns the point of intersection between the surface and the ray. This intersection point is calculated in the coordinate system of the surface.
If there is not a point of intersection ie: ray is outside of the element aperture, it must return (numpy.inf,numpy.inf,numpy.inf)
Arguments:
iray – incident ray
iray must be in the coordinate system of the surface
Returns:
A vector [x,y,z] containing the coordinates of the point of intersection between the ray and the surface. If there is no intersection returns [Inf, Inf, Inf].
Note
This method does not need to be overloaded. Overload
surface._intersection()
instead.
-
normal
()¶ Normal vector at the point ip.
This method returns the normal vector at a specific intersection point, given by ip. The normal vector must be normalized.
This method must be overloaded in all Surface subclasses. It contains the geometric specific code.
Arguments:
iray – incident ray in the coordinate system of the surface.
Returns:
An array [dx,dy,dz] indicating the vector normal to the surface
-
polylist
()¶
-
propagate
()¶ Method to calculate the ray refracted on a surface.
This method calculates the ray refracted (or rays refracted and reflected)on a surface.
Parameters: - -- incident ray (ri) –
- -- refraction index in the incident media n. (ni) –
- -- refraction index in the refracted media (nr) –
ri must be in the coordinate system of the surface
-
pw_cohef
()¶ Method to generate the taylor polinomial coheficients that can be used to obtain the phase and intensity for different plane wave inclinations.
Notes
- The pupil is normalized to the radius of the lens
- This method assumes a circular shaped pupil
- The phase is returned as an optical path
- The intensity is normalized to 1
Arguments:
ni,nr Refraction index from the incident and refracted sides ilimit Inferior limit for incidence angle of the plane wave in radians slimit Superior limit for incidence angle of the plane wave in radians step Step to be used to generate the interpolation data order Order of the Taylor interpolation used rsamples Tuple containing the number of ray samples to be used in each direction zb Z position of the plane where the measurementas are made. The origin is the vertex of the surface. If None, an estimate position is taken.
-
pw_propagate
()¶ Method to calculate wavefront emerging from the surface
This method calculates the wavefront emerging from the optical surface when illuminated by an unity amplitude plane wave. The k vector of the incoming PW is given by the direction of ri. The wavelength of the PW is given by the wavelength of ri. The origin of ri is not used at all.
Parameters: - -- surface incident ray (ri) –
- -- refraction index in the incident media n. (ni) –
- -- refraction index in the refracted media (nr) –
- -- number of rays used to sample the surface (rsamples) –
- -- shape of the output wavefront (shape) –
- -- order of the polynomial fit (order) –
- -- Z position of the input and output plane. The origin is the surface vertex (z) –
ri must be in the coordinate system of the surface Note: The ray comes from the negative side. Need to change this
-
pw_propagate1
()¶ Method to calculate wavefront emerging from the surface
Note
This method needs to be checked, because the incoming plane wave has not a constant intensity. The ray distribution is affected by the surface topography. it is better to use the slow version pw_propagate.
This method calculates the wavefront emerging from the optical surface when illuminated by an unity amplitude plane wave. The k vector of the incoming PW is given by the direction of ri. The wavelength of the PW is given by the wavelength of ri. The origin of ri is not used at all.
The input and output planes are located at z=0 in the surface coordinated system.
Note: this method needs to be checked, because the incoming plane wave has not a constant intensity. The ray distribution is affected by the surface topography. it is better to use the slow version pw_propagate1.
Note: The ray comes from the negative side. Need to change this
Parameters: - -- isurface.pyncident ray (ri) –
- -- refraction index in the incident media n. (ni) –
- -- refraction index in the refracted media (nr) –
ri must be in the coordinate system of the surface
-
pw_propagate_list
()¶ Method to calculate wavefront emerging from the surface
This method calculates samples of the wavefront emerging from the optical surface when illuminated by an unity amplitude plane wave. The k vector of the incoming PW is given by the direction of ri. The wavelength of the PW is given by the wavelength of ri. The origin of ri is not used at all.
The returned value is a list containing the x,y coordinates of the ray list in the output surface, and the optical path at such point.
To create an output matrix, this values must be interpolated.
Parameters: - -- incident ray (ri) –
- -- refraction index in the incident media n. (ni) –
- -- refraction index in the refracted media (nr) –
- -- number of rays used to sample the surface (rsamples) –
- -- Z position of the input and output plane. The origin is the surface vertex (z) –
ri must be in the coordinate system of the surface Note: The ray comes from the negative side. Need to change this
-
reflectivity
¶
-
reset
()¶ Remove information from the hit_list
-
shape
¶
-
topo
()¶ Method that returns the topography of the surface
The matrix returned is . This method mus be overloaded in all subclasses of Surface.
-
wf_propagate
()¶ Method to calculate wavefront emerging from the surface
This method calculates the wavefront emerging from the optical surface when illuminated by an arbitrary wavefront.
The input and output planes are located at z=0 in the surface coordinated system.
Parameters: - -- Field instance containing the incoming wavefront (wf) –
- -- refraction index in the incident media n. (ni) –
- -- refraction index in the refracted media. (nr) –
- -- Tuple containing the number of rays used to sample the field. (samples) –
- -- Tuple containing the shape of the output field (shape) –
-