pyimcom.diagnostics.outimage_utils.helper
Helper functions to read metadata in output coadded map diagnostics
Functions
- UNIT_to_bels
Convert a unit string to units of bels.
- HDU_to_bels
Convert a FITS header to units of bels.
Functions
|
Convert a UNIT string (usually a FITS header value) to units of bels |
|
Reads the UNIT keyword from a FITS header and converts it to bels. |
Module Contents
- UNIT_to_bels(unitstring)[source]
Convert a UNIT string (usually a FITS header value) to units of bels
- Parameters:
unitstring (str) – A number and optional SI prefix, e.g.
0.2uB(supports m=milli, u=micro, n=nano).- Returns:
Floating version of the unitstring, e.g.,
2.0e-7. Returns np.nan if no match or unrecognized.- Return type:
float
- HDU_to_bels(inhdu)[source]
Reads the UNIT keyword from a FITS header and converts it to bels.
- Parameters:
inhdu (astropy.io.fits.ImageHDU) – The FITS HDU to read.
- Returns:
Floating version of the unitstring encoded in the FITS header. Returns np.nan if no match or unrecognized.
- Return type:
float
Notes
This function checks whether the sign of the UNIT is consistent with the comment. If the UNIT is positive, but the comment starts with a “-”, then it flips it. This allows it to read legacy files that had a sign bug in UNIT.