Surfaces

class batoid.Surface[source]

Abstract base class representing a 2D geometric surface.

sag(x, y)[source]

The function defining the surface; z(x, y).

Parameters:

x, y (array_like, shape (n,)) – Positions at which to evaluate the surface sag.

Returns:

z (array_like, shape (n,)) – Surface height.

normal(x, y)[source]

The normal vector to the surface at (x, y, z(x, y)).

Parameters:

x, y (array_like, shape (n,)) – Positions at which to evaluate the surface normal.

Returns:

normal (array_like, shape (n, 3)) – Surface normals.

reflect(rv, coordSys=None, coating=None)[source]

Calculate intersection of rays with this surface, and immediately reflect the rays at the points of intersection.

Parameters:
  • rv (RayVector) – Rays to reflect.

  • coordSys (CoordSys, optional) – If present, then use for the coordinate system of the surface. If None (default), then assume that rays and surface are already expressed in the same coordinate system.

  • coating (Coating, optional) – Apply this coating upon surface intersection.

Returns:

outRays (RayVector) – New object corresponding to original rays propagated and reflected.

refract(rv, inMedium, outMedium, coordSys=None, coating=None)[source]

Calculate intersection of rays with this surface, and immediately refract the rays through the surface at the points of intersection.

Parameters:
  • rv (RayVector) – Rays to refract.

  • inMedium (Medium) – Refractive medium on the incoming side of the surface.

  • outMedium (Medium) – Refractive medium on the outgoing side of the surface.

  • coordSys (CoordSys, optional) – If present, then use for the coordinate system of the surface. If None (default), then assume that rays and surface are already expressed in the same coordinate system.

  • coating (Coating, optional) – Apply this coating upon surface intersection.

Returns:

outRays (RayVector) – New object corresponding to original rays propagated and refracted.

rSplit(rv, inMedium, outMedium, coating, coordSys=None)[source]

Calculate intersection of rays with this surface, and immediately split the rays into reflected and refracted rays, with appropriate fluxes.

Parameters:
  • rv (RayVector) – Rays to refract.

  • inMedium (Medium) – Refractive medium on the incoming side of the surface.

  • outMedium (Medium) – Refractive medium on the outgoing side of the surface.

  • coating (Coating) – Coating object to control transmission coefficient.

  • coordSys (CoordSys, optional) – If present, then use for the coordinate system of the surface. If None (default), then assume that rays and surface are already expressed in the same coordinate system.

Returns:

reflectedRays, refractedRays (RayVector) – New objects corresponding to original rays propagated and reflected/refracted.

refractScreen(rv, screen, coordSys=None)[source]

Calculate intersection of rays with this surface, and immediately refract the rays through the phase screen at the points of intersection.

Parameters:
  • rv (RayVector) – Rays to refract.

  • screen (Surface) – OPD to add to rays (in meters) as they cross this interface.

  • coordSys (CoordSys, optional) – If present, then use for the coordinate system of the surface. If None (default), then assume that rays and surface are already expressed in the same coordinate system.

Returns:

outRays (RayVector) – New object corresponding to original rays propagated and refracted.

class batoid.Plane[source]

Bases: Surface

Planar surface. The surface sag follows the equation:

\[z(x, y) = 0\]
class batoid.Paraboloid(R)[source]

Bases: Surface

Surface of revolution with parabolic cross-section, and where the axis of revolution is along the axis of the parabola. The surface sag follows the equation

\[z(x, y) = z(r) = \frac{r^2}{2 R}\]

where \(r = \sqrt{x^2 + y^2}\) and R is the radius of curvature at the paraboloid vertex.

Parameters:

R (float) – Radius of curvature at paraboloid vertex.

class batoid.Sphere(R)[source]

Bases: Surface

Spherical surface. The surface sag follows the equation:

\[z(x, y) = z(r) = R \left(1 - \sqrt{1-\frac{r^2}{R^2}}\right)\]

where \(r = \sqrt{x^2 + y^2}\) and R is the radius the sphere. Note that the center of the sphere is a distance R above the vertex.

Parameters:

R (float) – Sphere radius.

class batoid.Quadric(R, conic)[source]

Bases: Surface

Surface of revolution where the cross section is a conic section. The surface sag follows the equation:

\[z(x, y) = z(r) = \frac{r^2}{R \left(1 + \sqrt{1 - \frac{r^2}{R^2} (1 + \kappa)}\right)}\]

where \(r = \sqrt{x^2 + y^2}\), R is the radius of curvature at the surface vertex, and \(\kappa\) is the conic constant. Different ranges of \(\kappa\) indicate different categories of surfaces:

  • \(\kappa > 0\) => oblate ellipsoid

  • \(\kappa = 0\) => sphere

  • \(-1 < \kappa < 0\) => prolate ellipsoid

  • \(\kappa = -1\) => paraboloid

  • \(\kappa < -1\) => hyperboloid

Parameters:
  • R (float) – Radius of curvature at vertex.

  • conic (float) – Conic constant \(\kappa\)

class batoid.Asphere(R, conic, coefs)[source]

Bases: Surface

Surface of revolution where the cross section is a conic section plus an even polynomial. Represents the equation

The surface sag follows the equation:

\[z(x, y) = z(r) = \frac{r^2}{R \left(1 + \sqrt{1 - \frac{r^2}{R^2} (1 + \kappa)}\right)} + \sum_i \alpha_i r^{2 i}\]

where \(r = \sqrt{x^2 + y^2}\), R is the radius of curvature at the surface vertex, \(\kappa\) is the conic constant, and \(\left\{\alpha_i\right\}\) are the even polynomial coefficients. Different ranges of \(\kappa\) produce different categories of surfaces (where alpha==0):

  • \(\kappa > 0\) => oblate ellipsoid

  • \(\kappa = 0\) => sphere

  • \(-1 < \kappa < 0\) => prolate ellipsoid

  • \(\kappa = -1\) => paraboloid

  • \(\kappa < -1\) => hyperboloid

Parameters:
  • R (float) – Radius of curvature at vertex.

  • conic (float) – Conic constant \(\kappa\).

  • coefs (list of float) – Even polynomial coefficients \(\left\{\alpha_i\right\}\)

class batoid.Zernike(coef, R_outer=1.0, R_inner=0.0)[source]

Bases: Surface

Surface defined by Zernike polynomials. The surface sag follows the equation:

\[z(x, y) = \sum_j a_j Z_j\left(\epsilon; \frac{x}{R_{outer}}, \frac{y}{R_{outer}}\right)\]

where \(Z_j(\epsilon, u, v)\) are the annular Zernike polynomials (Mahajan) with central obscuration \(\epsilon = \frac{R_{inner}}{R_{outer}}\) indexed by the Noll (1976) convention, \(R_{outer}\) is the outer radius of the annulus, \(R_{inner}\) is the inner radius of the annulus, and \(\left\{a_j\right\}\) are the annular coefficients.

Note that the Noll convention starts at j=1, so the \(a_0\) = coef[0] value has no effect on the surface.

Parameters:
  • coef (list of float) – Annular Zernike polynomial coefficients.

  • R_outer (float) – Outer radius of annulus.

  • R_inner (float) – Inner radius of annulus.

class batoid.Bicubic(xs, ys, zs, dzdxs=None, dzdys=None, d2zdxdys=None, nanpolicy='nan')[source]

Bases: Surface

Surface defined by interpolating from a grid.

Parameters:
  • xs, ys (array_like) – 1d uniform-spaced arrays indicating the grid points.

  • zs (array_like) – 2d array indicating the surface.

  • dzdxs (array_like, optional) – 2d array indicating derivatives dz/dx at grid points.

  • dzdys (array_like, optional) – 2d array indicating derivatives dz/dy at grid points.

  • d2zdxdys (array_like, optional) – 2d array indicating mixed derivatives d^2 z / (dx dy) at grid points.

  • nanpolicy ({‘zero’, ‘nan’}) – Return zero or nan for requests outside input domain?

class batoid.Sum(*args)[source]

Bases: Surface

Composite surface combining two or more other Surfaces through addition. The surface sag follows the equation:

\[z(x, y) = \sum_i S_i(x, y)\]

where \(S_i\) is the ith input Surface.

Note that Sum-Ray intersection calculations will use the intersection of the ray with the first surface in the list as an initial guess for the intersection with the full Sum surface. Thus it is usually a good idea to place any surface with an analytic intersection (Quadric or simpler) first in the list, and any small perturbations around that surface after.

Parameters:

surfaces (list of Surface) – Surface s to add together.