Skip to content

Documentation for tessFOV

tessfov.tessfov

add_tessfov_outline(ax, sector=[1], camera=None, ccd=None, unit='deg', wrap_at=360, color='k', **kwargs)

Adds the outline of the input TESS CCD, camera, and sector to ax.

Parameters:

Name Type Description Default
sector Union[int, List[int], numpy.ndarray]

Input sectors to process

[1]
camera Union[int, List[int], numpy.ndarray]

Input cameras to process

None
ccd Union[int, List[int], numpy.ndarray]

Input CCDs to process

None
unit str

Astropy unit to use for angles. Use 'deg' for degrees, 'rad' for radians. For matplotlib projections (e.g. 'mollweide' or 'hammer') use radians.

'deg'
wrap_at Union[int, float]

The angle at which to "wrap" the edges. By default this is 360 degrees. For matplotlib projections (e.g. 'mollweide' or 'hammer') use 180 degrees.

360
color str

Color to plot the outline in

'k'
kwargs dict

Keywords to pass to matplotlib.pyplot.plot

{}
Source code in tessfov/tessfov.py
def add_tessfov_outline(
    ax: plt.Axes,
    sector: Optional[Union[int, List[int], npt.NDArray]] = [1],
    camera: Optional[Union[int, List[int], npt.NDArray]] = None,
    ccd: Optional[Union[int, List[int], npt.NDArray]] = None,
    unit: str = "deg",
    wrap_at: Union[int, float] = 360,
    color: str = "k",
    **kwargs,
):
    """Adds the outline of the input TESS CCD, camera, and sector to `ax`.

    Parameters
    ----------

    sector: Optional[Union[int, List[int], npt.NDArray]]
        Input sectors to process
    camera: Optional[Union[int, List[int], npt.NDArray]]
        Input cameras to process
    ccd: Optional[Union[int, List[int], npt.NDArray]]
        Input CCDs to process
    unit: str
        Astropy unit to use for angles. Use `'deg'` for degrees, `'rad'` for radians.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use radians.
    wrap_at: Union[int, float]
        The angle at which to "wrap" the edges. By default this is 360 degrees.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use 180 degrees.
    color: str
        Color to plot the outline in
    kwargs: dict
        Keywords to pass to `matplotlib.pyplot.plot`
    """
    patches = get_edges(
        sector=sector, camera=camera, ccd=ccd, unit=unit, wrap_at=wrap_at
    )
    for patch in patches:
        ax.plot(patch[0], patch[1], color=color, **kwargs)

add_tessfov_shade(ax, sector=[1], camera=None, ccd=None, unit='deg', wrap_at=360, color='k', alpha=0.15, lw=0.75, **kwargs)

Adds a shaded patch corresponding to the input TESS CCD, camera, and sector to ax.

Parameters:

Name Type Description Default
sector Union[int, List[int], numpy.ndarray]

Input sectors to process

[1]
camera Union[int, List[int], numpy.ndarray]

Input cameras to process

None
ccd Union[int, List[int], numpy.ndarray]

Input CCDs to process

None
unit str

Astropy unit to use for angles. Use 'deg' for degrees, 'rad' for radians. For matplotlib projections (e.g. 'mollweide' or 'hammer') use radians.

'deg'
wrap_at Union[int, float]

The angle at which to "wrap" the edges. By default this is 360 degrees. For matplotlib projections (e.g. 'mollweide' or 'hammer') use 180 degrees.

360
color str

Color to plot the outline in

'k'
alpha float

The transparancy (alpha) of the patch

0.15
lw float

Line width to outline the patch

0.75
kwargs dict

Keywords to pass to matplotlib.pyplot.Polygon

{}
Source code in tessfov/tessfov.py
def add_tessfov_shade(
    ax: plt.Axes,
    sector: Optional[Union[int, List[int], npt.NDArray]] = [1],
    camera: Optional[Union[int, List[int], npt.NDArray]] = None,
    ccd: Optional[Union[int, List[int], npt.NDArray]] = None,
    unit: str = "deg",
    wrap_at: Union[int, float] = 360,
    color: str = "k",
    alpha: float = 0.15,
    lw: float = 0.75,
    **kwargs,
):

    """Adds a shaded patch corresponding to the input TESS CCD, camera, and sector to `ax`.

    Parameters
    ----------

    sector: Optional[Union[int, List[int], npt.NDArray]]
        Input sectors to process
    camera: Optional[Union[int, List[int], npt.NDArray]]
        Input cameras to process
    ccd: Optional[Union[int, List[int], npt.NDArray]]
        Input CCDs to process
    unit: str
        Astropy unit to use for angles. Use `'deg'` for degrees, `'rad'` for radians.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use radians.
    wrap_at: Union[int, float]
        The angle at which to "wrap" the edges. By default this is 360 degrees.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use 180 degrees.
    color: str
        Color to plot the outline in
    alpha: float
        The transparancy (alpha) of the patch
    lw: float
        Line width to outline the patch
    kwargs: dict
        Keywords to pass to `matplotlib.pyplot.Polygon`
    """
    patches = get_edges(
        sector=sector, camera=camera, ccd=ccd, unit=unit, wrap_at=wrap_at
    )
    for patch in patches:
        poly = plt.Polygon(
            np.vstack([patch[0], patch[1]]).T, color=color, alpha=0.15, lw=lw, **kwargs
        )
        ax.add_patch(poly)

add_tessfov_text(ax, sector=[1], camera=None, ccd=None, unit='deg', wrap_at=360, ha='center', va='center', color='k', **kwargs)

Adds labels of the input TESS CCD, camera, and sector to ax.

Parameters:

Name Type Description Default
sector Union[int, List[int], numpy.ndarray]

Input sectors to process

[1]
camera Union[int, List[int], numpy.ndarray]

Input cameras to process

None
ccd Union[int, List[int], numpy.ndarray]

Input CCDs to process

None
unit str

Astropy unit to use for angles. Use 'deg' for degrees, 'rad' for radians. For matplotlib projections (e.g. 'mollweide' or 'hammer') use radians.

'deg'
wrap_at Union[int, float]

The angle at which to "wrap" the edges. By default this is 360 degrees. For matplotlib projections (e.g. 'mollweide' or 'hammer') use 180 degrees.

360
ha str

Horizontal alignment. Default is 'center'

'center'
va str

Vertical alignment. Default is 'center'

'center'
color str

Color to plot the outline in

'k'
kwargs dict

Keywords to pass to matplotlib.pyplot.plot

{}
Source code in tessfov/tessfov.py
def add_tessfov_text(
    ax: plt.Axes,
    sector: Optional[Union[int, List[int], npt.NDArray]] = [1],
    camera: Optional[Union[int, List[int], npt.NDArray]] = None,
    ccd: Optional[Union[int, List[int], npt.NDArray]] = None,
    unit: str = "deg",
    wrap_at: Union[int, float] = 360,
    ha: str = "center",
    va: str = "center",
    color: str = "k",
    **kwargs,
):
    """Adds labels of the input TESS CCD, camera, and sector to `ax`.

    Parameters
    ----------

    sector: Optional[Union[int, List[int], npt.NDArray]]
        Input sectors to process
    camera: Optional[Union[int, List[int], npt.NDArray]]
        Input cameras to process
    ccd: Optional[Union[int, List[int], npt.NDArray]]
        Input CCDs to process
    unit: str
        Astropy unit to use for angles. Use `'deg'` for degrees, `'rad'` for radians.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use radians.
    wrap_at: Union[int, float]
        The angle at which to "wrap" the edges. By default this is 360 degrees.
        For matplotlib projections (e.g. `'mollweide'` or `'hammer'`) use 180 degrees.
    ha : str
        Horizontal alignment. Default is 'center'
    va : str
        Vertical alignment. Default is 'center'
    color: str
        Color to plot the outline in
    kwargs: dict
        Keywords to pass to `matplotlib.pyplot.plot`
    """
    patches, labels = get_edges(
        sector=sector,
        camera=camera,
        ccd=ccd,
        unit=unit,
        wrap_at=wrap_at,
        return_labels=True,
    )
    for patch, label in zip(patches, labels):
        ax.text(
            patch[0].mean(),
            patch[1].mean(),
            f"Sector {label[0]}\nCam {label[1]}\nCCD {label[2]}",
            ha=ha,
            va=va,
            color=color,
            **kwargs,
        )

footprint(npoints=5)

Gets the column and row points for CCD edges

Source code in tessfov/tessfov.py
def footprint(npoints=5):
    """Gets the column and row points for CCD edges"""
    column = np.hstack(
        [
            np.zeros(npoints),
            np.linspace(0, 2048, npoints),
            np.linspace(0, 2048, npoints),
            np.ones(npoints) * 2048,
        ]
    )
    row = np.hstack(
        [
            np.linspace(0, 2048, npoints),
            np.zeros(npoints),
            np.ones(npoints) * 2048,
            np.linspace(0, 2048, npoints),
        ]
    )
    return column, row

sort_patch(patch)

Finds the center of a patch, and orders points by angle around the center.

Source code in tessfov/tessfov.py
def sort_patch(patch):
    """Finds the center of a patch, and orders points by angle around the center."""
    angle = np.arctan2(*(patch - np.mean(patch, axis=1)[:, None]))
    p = np.asarray(patch)[:, np.argsort(angle)]
    return p[:, np.hstack([np.arange(p.shape[1]), 0])]