HorizontalFrames¶
- class sofia_redux.scan.frames.horizontal_frames.HorizontalFrames[source]¶
Bases:
Frames
Initialize horizontal frames.
The horizontal frames extend standard equatorial based frames to include horizontal coordinates, offset from the observed source, and the zenith opacity (tau).
Attributes Summary
Used to define the default values for data arrays.
Return the site coordinates of the associated scan.
Methods Summary
Calculate the equatorial coordinates from the horizontal coordinates.
Calculate the horizontal coordinates from the equatorial coordinates.
calculate_parallactic_angle
([lst, indices])Calculate the cos(pa) and sin(pa) values.
Convert native equatorial offsets to horizontal offsets.
equatorial_to_horizontal_offset
(offset[, ...])Convert equatorial offsets to horizontal offsets.
equatorial_to_native
(equatorial[, indices, ...])Convert equatorial coordinates to native (horizontal) coordinates.
Get absolute spherical (including chopper) coords in telescope frame.
Return absolute spherical offsets in telescope frame.
get_base_native_offset
([indices, offset])Return equatorial native offsets of the frames from the scan reference.
get_equatorial
(offsets[, indices, equatorial])Return equatorial coordinates given offsets from the base equatorial.
get_equatorial_native_offset
(position[, ...])Return the horizontal offsets of a position relative to scan center.
get_horizontal
(offsets[, indices, horizontal])Return horizontal coordinates given offsets from the base horizontal.
get_horizontal_offset
(position[, indices, ...])Return the horizontal offsets of a position relative to scan center.
get_native_offset
(position[, indices, offset])Get the horizontal offsets for the given position.
get_parallactic_angle
([indices])Returns the tan of sin(position_angle), cos(position_angle).
horizontal_to_equatorial_offset
(offset[, ...])Convert a horizontal offset to an equatorial offset.
Convert horizontal offsets to native equatorial offsets.
native_equatorial_to_native_offset
(offset[, ...])Convert native equatorial offsets to native (horizontal) offsets.
native_to_equatorial
(native[, indices, ...])Convert native (horizontal) coordinates to equatorial coordinates.
native_to_native_equatorial_offset
(offset[, ...])Convert native (horizontal) offsets to native equatorial offsets.
pointing_at
(offset[, indices])Applies pointing correction to coordinates via subtraction.
project
(position, projector[, indices])Project a position to offsets.
set_parallactic_angle
(angle[, indices])Sets the
sin_pa
andcos_pa
parallactic angles.set_zenith_tau
(zenith_tau[, indices])Set the zenith tau values of the frames.
validate
()Validate frame data after read.
Attributes Documentation
- default_field_types¶
Used to define the default values for data arrays.
Returns a dictionary of structure {field: default_value}. The default values have the following effects:
type - empty numpy array of the given type. value - full numpy array of the given value. astropy.units.Unit - empty numpy array (float) in the given unit. astropy.units.Quantity - full numpy array of the given quantity.
If a tuple is provided, the array will have additional axes appended such that the first element gives the type as above, and any additional integers give additional axes dimensions, e.g. (0.0, 2, 3) would result in a numpy array filled with zeros of shape (self.size, 2, 3).
- Returns:
- fieldsdict
- site¶
Return the site coordinates of the associated scan.
- Returns:
- GeodeticCoordinates
Methods Documentation
- calculate_equatorial()[source]¶
Calculate the equatorial coordinates from the horizontal coordinates.
This assumes that the object is tracked on sky, and uses scanning offsets on top of the tracking coordinates of the scan.
- Returns:
- None
- calculate_horizontal()[source]¶
Calculate the horizontal coordinates from the equatorial coordinates.
- Returns:
- None
- calculate_parallactic_angle(lst=None, indices=None)[source]¶
Calculate the cos(pa) and sin(pa) values.
- Parameters:
- lstastropy.units.Quantity
If provided, the Local Sidereal Time will be used to calculate the position angle from the site and equatorial coordinates. Otherwise, the parallactic angle will be calculated from the horizontal coordinates. If an array is provided, should be the same shape as
indices
.- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to calculate the parallactic angle. The default is all frames.
- Returns:
- None
- equatorial_native_to_horizontal_offset(offset, indices=None, in_place=True)[source]¶
Convert native equatorial offsets to horizontal offsets.
Rotates by -PA (position angle).
- Parameters:
- offsetCoordinate2D
The native equatorial (x, y) offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to update. The default is all frames.
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- horizontal_offsetsCoordinate2D
- equatorial_to_horizontal_offset(offset, indices=None, in_place=True)[source]¶
Convert equatorial offsets to horizontal offsets.
- Parameters:
- offsetCoordinate2D
The equatorial (x, y) offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to update. The default is all frames.
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- horizontal_offsetsCoordinate2D
- equatorial_to_native(equatorial, indices=None, native=None)[source]¶
Convert equatorial coordinates to native (horizontal) coordinates.
- Parameters:
- equatorialEquatorialCoordinates
The equatorial coordinates to convert.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to calculate offsets. The default is all frames (not used by equatorial frames).
- nativeSphericalCoordinates, optional
The native coordinates to populate. Will default to spherical coordinates if not provided.
- Returns:
- native_coordinatesHorizontalCoordinates
- get_absolute_native_coordinates()[source]¶
Get absolute spherical (including chopper) coords in telescope frame.
This is named getNativeCoords() in CRUSH
- Returns:
- coordinatesHorizontalCoordinates
- get_absolute_native_offsets()[source]¶
Return absolute spherical offsets in telescope frame.
This is named GetNativeOffset() in CRUSH
- Returns:
- offsetsCoordinate2D
The (x, y) native offsets.
- get_base_native_offset(indices=None, offset=None)[source]¶
Return equatorial native offsets of the frames from the scan reference.
- Parameters:
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to extract the offsets.
- offsetCoordinate2D, optional
An optional coordinate object to hold the results.
- Returns:
- horizontal_offsetsCoordinate2D
- get_equatorial(offsets, indices=None, equatorial=None)[source]¶
Return equatorial coordinates given offsets from the base equatorial.
The return result (lon, lat) is:
lon = base_lon + (position.lon / cos(scan.lat)) lat = base_lat + position.lat
- Parameters:
- offsetsCoordinate2D
The (x, y) horizontal offsets of shape () or (shape,)
- indicesnumpy.ndarray (int), optional
The frame indices that apply. The default is all indices.
- equatorialEquatorialCoordinates, optional
The equatorial output frame. The default is the same as the frame equatorial frame.
- Returns:
- equatorialEquatorialCoordinates
- get_equatorial_native_offset(position, indices=None, offset=None)[source]¶
Return the horizontal offsets of a position relative to scan center.
The final return position is the sum of the position offsets, and the equatorial coordinates of the frame relative to the scan center.
- Parameters:
- positionCoordinate2D
The (x, y) horizontal offsets of shape () or (m,) giving the (lon, lat) offset positions. If not set, the default is to return the offsets relative to the scan equatorial position.
- indicesint or numpy.ndarray (int), optional
The frame indices that apply of shape (n,) (if an array was used). The default is all indices.
- offsetCoordinate2D, optional
An optional output array to store and return the coordinates.
- Returns:
- equatorial_offsetsCoordinate2D
An array containing the sum of the equatorial offsets of the frame data and the supplied positions. If multiple frame indices and multiple positions are supplied, the resulting coordinate shape will be (n, m). Otherwise, the result will be shaped as either (n,) or (m,) or () depending on if indices/position are singular.
- get_horizontal(offsets, indices=None, horizontal=None)[source]¶
Return horizontal coordinates given offsets from the base horizontal.
- Parameters:
- offsetsCoordinate2D
The (x, y) horizontal offsets of shape () or (shape,)
- indicesnumpy.ndarray (int), optional
The frame indices that apply. The default is all indices.
- horizontalHorizontalCoordinates, optional
The horizontal output frame. The default is a fresh frame.
- Returns:
- horizontalHorizontalCoordinates
- get_horizontal_offset(position, indices=None, offset=None)[source]¶
Return the horizontal offsets of a position relative to scan center.
- Parameters:
- positionCoordinate2D, optional
The (x, y) horizontal offsets.
- indicesint or numpy.ndarray (int), optional
The frame indices that apply of shape (n,) (if an array was used). The default is all indices.
- offsetCoordinate2D, optional
An optional output array to store and return the coordinates.
- Returns:
- horizontal_offsetsCoordinate2D
An array containing the sum of the horizontal offsets of the frame data and the supplied positions. If multiple frame indices and multiple positions are supplied, the resulting coordinate shape will be (n, m). Otherwise, the result will be shaped as either (n,) or (m,) or () depending on if indices/position are singular.
- get_native_offset(position, indices=None, offset=None)[source]¶
Get the horizontal offsets for the given position.
- Parameters:
- positionCoordinate2D
The (x, y) offsets.
- indicesnumpy.ndarray (int), optional
The frame indices that apply. The default is all indices.
- offsetCoordinate2D, optional
The coordinate object on which to store the offsets (returned).
- Returns:
- native_offsetsCoordinate2D
- get_parallactic_angle(indices=None)[source]¶
Returns the tan of sin(position_angle), cos(position_angle).
- Parameters:
- indicesnumpy.ndarray (int), optional
The frame indices. The default is all indices.
- Returns:
- angleastropy.units.Quantity (numpy.ndarray)
An array of angles of size (N,) or (indices.size,).
- horizontal_to_equatorial_offset(offset, indices=None, in_place=True)[source]¶
Convert a horizontal offset to an equatorial offset.
- Parameters:
- offsetCoordinate2D
The horizontal (x, y) offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to update. The default is all frames.
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- equatorial_offsetsCoordinate2D
- horizontal_to_native_equatorial_offset(offset, indices=None, in_place=True)[source]¶
Convert horizontal offsets to native equatorial offsets.
Rotates by the position angle.
- Parameters:
- offsetCoordinate2D
The horizontal (x, y) offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to update. The default is all frames.
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- native_equatorial_offsetsCoordinate2D
- native_equatorial_to_native_offset(offset, indices=None, in_place=True)[source]¶
Convert native equatorial offsets to native (horizontal) offsets.
- Parameters:
- offsetCoordinate2D
The native (x, y) equatorial offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to calculate offsets. The default is all frames (not used by equatorial frames).
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- native_offsetsCoordinate2D
- native_to_equatorial(native, indices=None, equatorial=None)[source]¶
Convert native (horizontal) coordinates to equatorial coordinates.
- Parameters:
- nativeHorizontalCoordinates
The coordinates to convert.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to calculate offsets. The default is all frames (not used by equatorial frames).
- equatorialEquatorialCoordinates, optional
If not supplied, the returned coordinates will have a J2000 epoch. Otherwise, the equatorial coordinates provided will be populated.
- Returns:
- equatorial_coordinatesEquatorialCoordinates
- native_to_native_equatorial_offset(offset, indices=None, in_place=True)[source]¶
Convert native (horizontal) offsets to native equatorial offsets.
- Parameters:
- offsetCoordinate2D
The native (x, y) offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices for which to calculate offsets. The default is all frames (not used by equatorial frames).
- in_placebool, optional
If
True
, modify the coordinates in place. Otherwise, return a copy of the offsets.
- Returns:
- native_equatorial_offsetsCoordinate2D
- pointing_at(offset, indices=None)[source]¶
Applies pointing correction to coordinates via subtraction.
- Parameters:
- offsetastropy.units.Quantity (numpy.ndarray)
An array of
- indicesnumpy.ndarray (int), optional
The frame indices that apply. The default is all indices.
- Returns:
- None
- project(position, projector, indices=None)[source]¶
Project a position to offsets.
- Parameters:
- positionCoordinate2D
The (x, y) position.
- projectorAstroProjector
The projector to store and determine the projected offsets.
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to project.
- Returns:
- offsetsCoordinate2D
The (x, y) offsets.
- set_parallactic_angle(angle, indices=None)[source]¶
Sets the
sin_pa
andcos_pa
parallactic angles.- Parameters:
- angleint or float or numpy.ndarray or Quantity
The angle to set. If an array is supplied, must be the same size as
indices
.- indicesnumpy.ndarray (int), optional
The frame indices to set. The default is all indices.
- Returns:
- None
- set_zenith_tau(zenith_tau, indices=None)[source]¶
Set the zenith tau values of the frames.
- Parameters:
- zenith_taufloat or numpy.ndarray (float)
The zenith tau value(s).
- indicesint or slice or numpy.ndarray (int or bool)
The frame indices to apply the values to. The default is all frames.
- Returns:
- None