CircularSectorAperture#

class optika.apertures.CircularSectorAperture(radius=<Quantity 0. mm>, angle_start=<Quantity 0. deg>, angle_stop=<Quantity 180. deg>, *, samples_wire=101, active=True, inverted=False, transformation=None, kwargs_plot=None)[source]#

Bases: AbstractAperture

A circular sector aperture.

Examples

Plot a single circular aperture sector

import matplotlib.pyplot as plt
import astropy.units as u
import astropy.visualization
import named_arrays as na
import optika

# Define a circular aperture sector
aperture = optika.apertures.CircularSectorAperture(
    radius=50 * u.mm,
    angle_start=-11 * u.deg,
    angle_stop=40 * u.deg,
)

# Define points to sample the aperture with
points = na.Cartesian3dVectorLinearSpace(
    start=aperture.bound_lower,
    stop=aperture.bound_upper,
    axis=na.Cartesian3dVectorArray("x", "y", "z"),
    num=na.Cartesian3dVectorArray(11, 11, 1),
)

# Compute which points are inside the aperture
where = aperture(points)

# Plot the circular aperture sector
with astropy.visualization.quantity_support():
    plt.figure()
    plt.gca().set_aspect("equal")
    aperture.plot(components=("x", "y"), color="black")
    na.plt.scatter(
        points.x,
        points.y,
        c=where.astype(float)
    )
../_images/optika.apertures.CircularSectorAperture_0_0.png

Attributes

active

Whether the aperture is active and can clip rays.

angle_start

The starting angle of the circular sector.

angle_stop

The ending angle of the circular sector.

bound_lower

The lower-left corner of the aperture's rectangular footprint

bound_upper

The upper-right corner of the aperture's rectangular footprint

inverted

Whether this object is being used as an aperture or obscuration.

kwargs_plot

Extra keyword arguments that will be used in the call to named_arrays.plt.plot() within the plot() method.

radius

The radius of the cirucular sector.

samples_wire

The default number of samples used for wire().

shape

The array shape of this object.

transformation

The transformation between the local surface coordinates and the aperture.

vertices

The vertices of the polygon representing this aperture

Methods

__init__([radius, angle_start, angle_stop, ...])

clip_rays(rays)

Given a set of input rays, update the unvignetted to be False if the ray is blocked by the aperture.

plot([ax, transformation, components, sag])

Plot the selected components onto the given axes.

to_dxf(file, unit[, transformation])

to_string([prefix])

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

wire([num])

The sequence of points representing this aperture

Inheritance Diagram

Inheritance diagram of optika.apertures.CircularSectorAperture
Parameters:
clip_rays(rays)#

Given a set of input rays, update the unvignetted to be False if the ray is blocked by the aperture.

Parameters:

rays (RayVectorArray) – The input rays to clip.

plot(ax=None, transformation=None, components=None, sag=None, **kwargs)#

Plot the selected components onto the given axes.

Parameters:
Return type:

None | ScalarArray[ndarray[tuple[Any, …], dtype[None | Line2D]]]

to_dxf(file, unit, transformation=None)#
Parameters:
to_string(prefix=None)#

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Parameters:

prefix (None | str) – an optional string, the length of which is used to calculate how much whitespace to add to the result.

Return type:

str

wire(num=None)[source]#

The sequence of points representing this aperture

Parameters:

num (None | int) – The total number of samples that will be used to represent this wire.

Return type:

Cartesian3dVectorArray

active: bool | AbstractScalar = True#

Whether the aperture is active and can clip rays.

angle_start: Quantity | AbstractScalar = <Quantity 0. deg>#

The starting angle of the circular sector. Must be between \(-2 \pi\) and \(+2 \pi\) radians.

angle_stop: Quantity | AbstractScalar = <Quantity 180. deg>#

The ending angle of the circular sector. Must be between \(-2 \pi\) and \(+2 \pi\) radians and counterclockwise from angle_start.

property bound_lower: Cartesian3dVectorArray#

The lower-left corner of the aperture’s rectangular footprint

property bound_upper: Cartesian3dVectorArray#

The upper-right corner of the aperture’s rectangular footprint

inverted: bool | AbstractScalar = False#

Whether this object is being used as an aperture or obscuration.

If True, the interior of the aperture allows light to passthrough. If False, the exterior of the aperture allows light to pass through.

kwargs_plot: None | dict = None#

Extra keyword arguments that will be used in the call to named_arrays.plt.plot() within the plot() method.

radius: Quantity | AbstractScalar = <Quantity 0. mm>#

The radius of the cirucular sector.

samples_wire: int = 101#

The default number of samples used for wire().

property shape: dict[str, int]#

The array shape of this object.

transformation: None | AbstractTransformation = None#

The transformation between the local surface coordinates and the aperture.

property vertices: None#

The vertices of the polygon representing this aperture