elliptical_footprint

astroimtools.filtering.elliptical_footprint(a, b, theta=0, dtype=<class 'int'>)[source]

Create an elliptical footprint.

A pixel is considered to be entirely in or out of the footprint depending on whether its center is in or out of the footprint. The size of the output array is the minimal bounding box for the footprint.

Parameters:
aint

The semimajor axis.

bint

The semiminor axis.

thetafloat, optional

The rotation angle in radians of the semimajor axis. The angle is measured counterclockwise from the positive x axis.

dtypedata-type, optional

The data type of the output ndarray.

Returns:
footprintndarray

A footprint where array elements are 1 within the footprint and 0 otherwise.

Examples

>>> import numpy as np
>>> from astroimtools import elliptical_footprint
>>> elliptical_footprint(4, 2, theta=np.pi/2.)
array([[0, 0, 1, 0, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [1, 1, 1, 1, 1],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 0, 1, 0, 0]])