morphfits.utils.science#

Science utility functions for MorphFITS.

Functions#

get_pixname_from_scale(→ str)

Get a resolution name from its corresponding scale.

get_pixscale_from_name(→ float)

Get a resolution scale from its corresponding name.

get_pixels_from_skycoord(→ tuple[tuple[int, int], ...)

TODO May be deleted. Check if unused.

get_pixscale(science_path)

Get a FICL's pixscale from its science frame.

get_zeropoint(→ float)

Calculate image zeropoint in passed magnitude system.

Module Contents#

morphfits.utils.science.get_pixname_from_scale(pixscale: float) str#

Get a resolution name from its corresponding scale.

Parameters:

pixscale (float) – Pixel scale.

Returns:

Pixel scale as human-readable text.

Return type:

str

morphfits.utils.science.get_pixscale_from_name(pixname: str) float#

Get a resolution scale from its corresponding name.

Parameters:

pixname (str) – Pixel scale as text.

Returns:

Corresponding pixel scale.

Return type:

float

morphfits.utils.science.get_pixels_from_skycoord(skycoord: astropy.coordinates.SkyCoord, wcs: astropy.wcs.WCS, image_size: int) tuple[tuple[int, int], tuple[int, int]]#

TODO May be deleted. Check if unused.

Calculate corresponding pixels in an image based on sky coordinates and a WCS.

Parameters:
  • skycoord (SkyCoord) – Position of object in sky.

  • wcs (WCS) – Coordinate system from pixel to sky.

  • image_size (int) – Number of pixels along one square image side.

Returns:

Integer pixel coordinates in order of less x, greater x, less y, greater y.

Return type:

tuple[tuple[int, int], tuple[int, int]]

morphfits.utils.science.get_pixscale(science_path: pathlib.Path)#

Get a FICL’s pixscale from its science frame.

Used because not every frame has the same pixel scale. For the most part, long wavelength filtered observations have scales of 0.04 “/pix, and short wavelength filters have scales of 0.02 “/pix.

Parameters:

science_path (Path) – Path to science frame.

Raises:

KeyError – Coordinate transformation matrix element headers missing from frame.

morphfits.utils.science.get_zeropoint(image_path: str | pathlib.Path, magnitude_system: str = 'AB') float#

Calculate image zeropoint in passed magnitude system.

Parameters:
  • image_path (str | Path) – Path to image FITS file.

  • magnitude_system (str, optional) – Magnitude system to calculate zeropoint from, by default “AB”.

Returns:

Zeropoint of image.

Return type:

float

Raises:

NotImplementedError – Magnitude system unknown.

Notes

Image header must contain keys PHOTFLAM and PHOTPLAM.

References

  1. https://www.stsci.edu/hst/instrumentation/acs/data-analysis/zeropoints#:~:text=The%20PHOTFLAM%20and%20PHOTPLAM%20header,TPLAM)%E2%88%92