punchbowl.data.wcs#

Attributes#

Functions#

extract_crota_from_wcs(→ astropy.units.deg)

Extract CROTA from a WCS.

calculate_helio_wcs_from_celestial(...)

Calculate the helio WCS from a celestial WCS.

get_sun_ra_dec(→ tuple[float, float])

Get the position of the Sun in right ascension and declination.

calculate_pc_matrix(→ numpy.ndarray)

Calculate a PC matrix given CROTA and CDELT.

_times_are_equal(→ bool)

get_p_angle(→ astropy.units.deg)

Get the P angle.

hpc_to_gcrs(HPcoord, GCRSframe)

Convert helioprojective to GCRS.

gcrs_to_hpc(GCRScoord, Helioprojective)

Convert GCRS to HPC.

calculate_celestial_wcs_from_helio(→ astropy.wcs.WCS)

Calculate the celestial WCS from a helio WCS.

project_vec_onto_plane(→ numpy.ndarray)

Project vec1 onto the plane perpendicular to vec2.

angle_between_vectors(→ numpy.ndarray)

Compute the angle between vec1 and vec2.

compute_hp_to_eq_rotation_angle(→ astropy.units.Quantity)

Compute the necessary rotation angle to align a celestial WCS to a helioprojective one.

load_trefoil_wcs(→ tuple[astropy.wcs.WCS, tuple[int, int]])

Load Level 2 trefoil world coordinate system and shape.

load_quickpunch_mosaic_wcs(→ tuple[astropy.wcs.WCS, ...)

Load Level quickPUNCH mosaic world coordinate system and shape.

load_quickpunch_nfi_wcs(→ tuple[astropy.wcs.WCS, ...)

Load Level quickPUNCH NFI world coordinate system and shape.

Module Contents#

punchbowl.data.wcs._ROOT = b'.'#
punchbowl.data.wcs.PUNCH_STOKES_MAPPING#
punchbowl.data.wcs.extract_crota_from_wcs(wcs: astropy.wcs.WCS) astropy.units.deg#

Extract CROTA from a WCS.

punchbowl.data.wcs.calculate_helio_wcs_from_celestial(wcs_celestial: astropy.wcs.WCS, date_obs: astropy.time.Time | str | None = None, data_shape: tuple[int, int] | None = None) tuple[astropy.wcs.WCS, float]#

Calculate the helio WCS from a celestial WCS.

punchbowl.data.wcs.get_sun_ra_dec(dt: datetime.datetime) tuple[float, float]#

Get the position of the Sun in right ascension and declination.

punchbowl.data.wcs.calculate_pc_matrix(crota: float, cdelt: tuple[float, float]) numpy.ndarray#

Calculate a PC matrix given CROTA and CDELT.

Parameters:
  • crota (float) – rotation angle from the WCS

  • cdelt (float) – pixel size from the WCS

Returns:

PC matrix

Return type:

np.ndarray

punchbowl.data.wcs._times_are_equal(time_1: astropy.time.Time, time_2: astropy.time.Time) bool#
punchbowl.data.wcs.get_p_angle(time: str = 'now') astropy.units.deg#

Get the P angle.

Return the position (P) angle for the Sun at a specified time, which is the angle between geocentric north and solar north as seen from Earth, measured eastward from geocentric north. The range of P is +/-26.3 degrees.

Parameters:

time ({parse_time_types}) – Time to use in a parse_time-compatible format

Returns:

out – The position angle

Return type:

~astropy.coordinates.Angle

punchbowl.data.wcs.hpc_to_gcrs(HPcoord, GCRSframe)#

Convert helioprojective to GCRS.

punchbowl.data.wcs.gcrs_to_hpc(GCRScoord, Helioprojective)#

Convert GCRS to HPC.

punchbowl.data.wcs.calculate_celestial_wcs_from_helio(wcs_helio: astropy.wcs.WCS, date_obs: astropy.time.Time | str | None = None, data_shape: tuple[int, int] | None = None) astropy.wcs.WCS#

Calculate the celestial WCS from a helio WCS.

punchbowl.data.wcs.project_vec_onto_plane(vec1: numpy.ndarray, vec2: numpy.ndarray) numpy.ndarray#

Project vec1 onto the plane perpendicular to vec2.

punchbowl.data.wcs.angle_between_vectors(vec1: numpy.ndarray, vec2: numpy.ndarray, plane_normal: numpy.ndarray) numpy.ndarray#

Compute the angle between vec1 and vec2.

The angle is computed in the plane normal to plane_normal. This normal vector also sets the handedness and the sign of the angle.

punchbowl.data.wcs.compute_hp_to_eq_rotation_angle(wcs_helio: astropy.wcs.WCS, date_obs: str | astropy.time.Time | None = None) astropy.units.Quantity#

Compute the necessary rotation angle to align a celestial WCS to a helioprojective one.

The computed angle includes the effect of the P angle but not the rotation of the helioprojective WCS

Parameters:
  • wcs_helio (WCS) – A helioprojective WCS for which we’re producing a corresponding celestial WCS. Only CRVAL is used from this WCS

  • date_obs (str | Time | None) – The observation date. If not provided, it will be pulled from wcs_helio. If not provided in wcs_helio, it must be specified here.

Returns:

rotation_angle – The rotation angle that should be added to that in wcs_celestial’s PC matrix

Return type:

Quantity

punchbowl.data.wcs.load_trefoil_wcs() tuple[astropy.wcs.WCS, tuple[int, int]]#

Load Level 2 trefoil world coordinate system and shape.

punchbowl.data.wcs.load_quickpunch_mosaic_wcs() tuple[astropy.wcs.WCS, tuple[int, int]]#

Load Level quickPUNCH mosaic world coordinate system and shape.

punchbowl.data.wcs.load_quickpunch_nfi_wcs() tuple[astropy.wcs.WCS, tuple[int, int]]#

Load Level quickPUNCH NFI world coordinate system and shape.