pyoptools.raytrace.shape.shape module

Module that defines the Shape superclass

class pyoptools.raytrace.shape.shape.Shape

Bases: pyoptools.misc.picklable.picklable.Picklable

Abstract superclass for all optical surfaces shapes

Description:

Shape is an abstract superclass to define the different surfaces shapes (circular, rectangulas, etc.). This class defines an API that all subclasses must support.

The methods that must be overloaded in the subclasses are:

Shape.hit
This method must return TRUE if an X,Y point is inside the surface aperture if not it must return FALSE
Shape.polylist
This method should return a point_list, and a poly_list. The point list is a list of tuples (X,Y,Z) containing the coordinates of the points used to build the surface mesh. The poly_list is a list of tuples (n1,n2,n3,n3) containing the indices of the points in the polylist used to build each polygon that will be used to visualize the mesh.

This methods will be called by the Shape.hit method, and to create the Shape.polylist tuple, that will a point_list and a poly_list. The point_list is a list of tuples (X,Y,Z) containing the coordinates of the points used to build the surface mesh. The poly_list is a list of tuples (n1,n2,n3,n3) containing the indices of the points in the polylist used to build each polygon that will be used to visualize the mesh.

The attribute topo, will be initialized for each instance of the class with a function Z(x,y).

fhit()

This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast.

It must be overloaded.

hit()

This method must return TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This must work for a list of points.

It must be overloaded.

limits()

Returns the minimum limits for the aperture It must be overloaded, for each shape

mesh()

The X,Y are a mesh limited by size=(xi,xf,yi,yf) if size is not given (size=None), the size is given by the aperture. topo is the topography function of the surface under study. if not given, a 0 will be returned for points outside the aperture, and 1 inside the aperture

The ndat tuple, gives the number of points in the mesh.

pointlist()

This method should return a point_list that samples adecuately the shape.

The return value must be a tuple (X,Y) where X contains the X coordinates of the points, and Y the y coordinates. It must be overloaded, for each shape