punchbowl.data.wcs#

Attributes#

Functions#

extract_crota_from_wcs(→ astropy.units.deg)

Extract CROTA from a WCS.

calculate_helio_wcs_from_celestial(→ astropy.wcs.WCS)

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.

celestial_north_from_wcs(→ numpy.ndarray)

Compute the angle of celestial north direction at each pixel using the WCS.

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[source]#

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) astropy.wcs.WCS[source]#

Calculate the helio WCS from a celestial WCS.

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

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[source]#

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[source]#
punchbowl.data.wcs.get_p_angle(time: str = 'now') astropy.units.deg[source]#

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)[source]#

Convert helioprojective to GCRS.

punchbowl.data.wcs.gcrs_to_hpc(GCRScoord, Helioprojective)[source]#

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[source]#

Calculate the celestial WCS from a helio WCS.

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

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[source]#

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[source]#

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]][source]#

Load Level 2 trefoil world coordinate system and shape.

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

Load Level quickPUNCH mosaic world coordinate system and shape.

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

Load Level quickPUNCH NFI world coordinate system and shape.

punchbowl.data.wcs.celestial_north_from_wcs(input_wcs: astropy.wcs.WCS, shape: tuple, eps: astropy.units.Quantity = 1.0 * u.arcsec) numpy.ndarray[source]#

Compute the angle of celestial north direction at each pixel using the WCS.

Parameters:
  • input_wcs (astropy.wcs.WCS) – 2D celestial WCS (e.g., RA/Dec TAN) or a WCS where the celestial axes are the first two. If WCS has extra axes (e.g., STOKES), pass a dropped/sliced 2D WCS (e.g., wcs.dropaxis(2)).

  • shape (tuple) – Shape of the image as (nrows, ncols).

  • eps (astropy.units.Quantity) – Small sky offset applied toward celestial north (positive Dec direction) to estimate the local north direction.

Returns:

angle_cel_north – Angle in degrees from +Y image axis to celestial north at each pixel (measured counterclockwise in the pixel coordinate system):

angle = atan2(dx, dy)

Return type:

2D numpy.ndarray