Source code for sofia_redux.scan.coordinate_systems.focal_plane_coordinates
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from sofia_redux.scan.coordinate_systems.spherical_coordinates import \
SphericalCoordinates
from sofia_redux.scan.coordinate_systems.coordinate_system import \
CoordinateSystem
__all__ = ['FocalPlaneCoordinates']
[docs]
class FocalPlaneCoordinates(SphericalCoordinates):
def __init__(self, coordinates=None, unit='degree', copy=True):
"""
Initialize focal plane coordinates.
The focal plane coordinates are spherical coordinates used to
represent coordinates on the plane perpendicular to the axis
containing the focal point.
Parameters
----------
coordinates : list or tuple or array-like or units.Quantity, optional
The coordinates used to populate the object during initialization.
The first (0) value or index should represent longitudinal
coordinates, and the second should represent latitude.
unit : units.Unit or str, optional
The angular unit for the spherical coordinates. The default is
'degree'.
copy : bool, optional
Whether to explicitly perform a copy operation on the input
coordinates when storing them into these coordinates. Note that it
is extremely unlikely for the original coordinates to be passed in
as a reference due to the significant checks performed on them.
"""
super().__init__(coordinates=coordinates, unit=unit, copy=copy)
[docs]
def copy(self):
"""
Return a copy of the focal-plane coordinates.
Returns
-------
FocalPlaneCoordinates
"""
return super().copy()
[docs]
def setup_coordinate_system(self):
"""
Setup the system for the coordinates.
Returns
-------
None
"""
self.default_coordinate_system = CoordinateSystem(
name='Focal Plane Coordinates')
x_axis = self.create_axis('Focal-plane X', 'X')
y_axis = self.create_axis('Focal-plane Y', 'Y')
self.default_coordinate_system.add_axis(x_axis)
self.default_coordinate_system.add_axis(y_axis)
self.default_local_coordinate_system = CoordinateSystem(
name='Focal Plane Offsets')
dx_axis = self.create_offset_axis('Focal-plane dX', 'dX')
dy_axis = self.create_offset_axis('Focal-plane dY', 'dY')
self.default_local_coordinate_system.add_axis(dx_axis)
self.default_local_coordinate_system.add_axis(dy_axis)
@property
def fits_longitude_stem(self):
"""
Return the FITS longitude stem string.
Returns
-------
stem : str
"""
return 'FLON'
@property
def fits_latitude_stem(self):
"""
Return the FITS latitude stem string.
Returns
-------
stem : str
"""
return 'FLAT'
@property
def two_letter_code(self):
"""
Return the two-letter code for the coordinate system.
Returns
-------
code : str
"""
return 'FP'
def __getitem__(self, indices):
"""
Return a section of the coordinates
Parameters
----------
indices : int or numpy.ndarray or slice
Returns
-------
FocalPlaneCoordinates
"""
return super().__getitem__(indices)