Reference/API¶
GALEX¶
Convert from GALEX counts/s to Jy/pixel.
GALEX maps are provided in units of counts/s. These can be converted to more helpful units via the conversion factors given at https://asd.gsfc.nasa.gov/archive/galex/FAQ/counts_background.html.
Parameters: - hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of GALEX
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
fits.open(file)[0]). - galex_filter (str) – Either ‘NUV’ or ‘FUV’.
- hdu_out (str, optional) – If not None, will save the converted HDU out with this filename. Defaults to None.
Returns: The HDU in units of Jy/pix.
Return type: astropy.io.fits.PrimaryHDU
- hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of GALEX
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
Create a GALEX mosaic, given a galaxy name.
Using a galaxy name and radius, queries around that object, downloads available GALEX data and mosaics into a final product.
Because GALEX images are in counts/s and the integrations may be different lengths, we convert back to a raw count, add the frames and convert back to counts/s at the end. This effectively weights the frame by exposure time.
Parameters: - galaxies (str or list) – Names of galaxies to create mosaics for. Resolved by NED.
- filters (str, optional) – One of ‘FUV’, ‘NUV’, or ‘both’. Selects which GALEX filters to create a mosaic for. Defaults to ‘both’.
- radius (astropy.units.Quantity, optional) – Radius around the galaxy to search for observations. Defaults to 0.2 degrees.
- filepath (str, optional) – Path to save the working and output files to. If not specified, saves to current working directory.
- download_data (bool, optional) – If True, will download data from MAST. Defaults to True.
- create_mosaic (bool, optional) – Switching this to True will mosaic data as appropriate. Defaults to True.
- jy_conversion (bool, optional) – Convert the mosaicked file from raw units to Jy/pix. Defaults to True.
- verbose (bool, optional) – Print out messages during the process. Useful mainly for debugging purposes or large images. Defaults to False.
SDSS¶
Convert from SDSS nanomaggies to Jy/pixel.
SDSS maps are provided in convenience units of ‘nanomaggies’. In general, 1 nanomaggy is 3.631 x 10-6Jy, but there are are some offsets for the u and z band. This is detailed at http://www.sdss3.org/dr8/algorithms/magnitudes.php.
Parameters: - hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of SDSS
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
fits.open(file)[0]). - sdss_filter (str) – Either ‘u’, ‘g’, ‘r’, ‘i’, or ‘z’.
- hdu_out (str, optional) – If not None, will save the converted HDU out with this filename. Defaults to None.
Returns: The HDU in units of Jy/pix.
Return type: astropy.io.fits.PrimaryHDU
- hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of SDSS
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
Create an SDSS mosaic, given a galaxy name.
Using a galaxy name and radius, queries around that object, downloads available SDSS data and mosaics into a final product.
Parameters: - galaxies (str or list) – Names of galaxies to create mosaics for. Resolved by NED.
- filters (str or list, optional) – Any combination of ‘u’, ‘g’, ‘r’, ‘i’, or ‘z’. If you want everything, select ‘all’. Defaults to ‘all’.
- radius (astropy.units.Quantity, optional) – Radius around the galaxy to search for observations. Defaults to 0.2 degrees.
- filepath (str, optional) – Path to save the working and output files to. If not specified, saves to current working directory.
- download_data (bool, optional) – If True, will download data using MontagePy. Defaults to True.
- create_mosaic (bool, optional) – Switching this to True will mosaic data as appropriate. Defaults to True.
- jy_conversion (bool, optional) – Convert the mosaicked file from raw units to Jy/pix. Defaults to True.
- verbose (bool, optional) – Print out messages during the process. Useful mainly for debugging purposes or large images. Defaults to False.
2MASS¶
Convert from Vega magnitudes to Jy/pixel.
2MASS maps are provided in convenience units of data numbers (DN). During the mosaicking process, these are converted to Vega mags since the magnitude zero point varies between frames. The constants for converting magnitudes to Jy are given at https://old.ipac.caltech.edu/2mass/releases/allsky/faq.html#jansky.
Parameters: - hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of 2MASS
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
fits.open(file)[0]). - two_mass_filter (str) – Either ‘J’, ‘H’, or ‘K’.
- hdu_out (str, optional) – If not None, will save the converted HDU out with this filename. Defaults to None.
Returns: The HDU in units of Jy/pix.
Return type: astropy.io.fits.PrimaryHDU
- hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of 2MASS
.fits file, or an Astropy PrimaryHDU instance (i.e. the result
of
Create a 2MASS mosaic, given a galaxy name.
Using a galaxy name and radius, queries around that object, downloads available 2MASS data and mosaics into a final product.
Parameters: - galaxies (str or list) – Names of galaxies to create mosaics for. Resolved by NED.
- filters (str or list, optional) – Any combination of ‘J’, ‘H’, and ‘K’. If you want everything, select ‘all’. Defaults to ‘all’.
- radius (astropy.units.Quantity, optional) – Radius around the galaxy to search for observations. Defaults to 0.2 degrees.
- filepath (str, optional) – Path to save the working and output files to. If not specified, saves to current working directory.
- download_data (bool, optional) – If True, will download data using MontagePy. Defaults to True.
- create_mosaic (bool, optional) – Switching this to True will mosaic data as appropriate. Defaults to True.
- jy_conversion (bool, optional) – Convert the mosaicked file from raw units to Jy/pix. Defaults to True.
- verbose (bool, optional) – Print out messages during the process. Useful mainly for debugging purposes or large images. Defaults to False.
WISE¶
Convert from WISE DN to Jy/pixel.
WISE maps are provided in convenience units of data numbers (DN). The constants to convert them are given in Table 1 of http://wise2.ipac.caltech.edu/docs/release/prelim/expsup/sec2_3f.html.
Parameters: - hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of WISE
.fits file, or an Astropy PrimaryHDU instance (i.e. the
result of
fits.open(file)[0]). - wise_filter (str) – Either ‘1’, ‘2’, ‘3’, or ‘4’.
- hdu_out (str, optional) – If not None, will save the converted HDU out with this filename. Defaults to None.
Returns: The HDU in units of Jy/pix.
Return type: astropy.io.fits.PrimaryHDU
- hdu_in (str or astropy.io.fits.PrimaryHDU) – File name of WISE
.fits file, or an Astropy PrimaryHDU instance (i.e. the
result of
Create a WISE mosaic, given a galaxy name.
Using a galaxy name and radius, queries around that object, downloads available WISE data and mosaics into a final product.
Parameters: - galaxies (str or list) – Names of galaxies to create mosaics for. Resolved by NED.
- filters (str or list, optional) – Any combination of ‘1’, ‘2’, ‘3’, and ‘4’. If you want everything, select ‘all’. Defaults to ‘all’.
- radius (astropy.units.Quantity, optional) – Radius around the galaxy to search for observations. Defaults to 0.2 degrees.
- filepath (str, optional) – Path to save the working and output files to. If not specified, saves to current working directory.
- download_data (bool, optional) – If True, will download data using MontagePy. Defaults to True.
- create_mosaic (bool, optional) – Switching this to True will mosaic data as appropriate. Defaults to True.
- jy_conversion (bool, optional) – Convert the mosaicked file from raw units to Jy/pix. Defaults to True.
- verbose (bool, optional) – Print out messages during the process. Useful mainly for debugging purposes or large images. Defaults to False.
HST¶
Tools¶
Calculate background median for data.
Calculates the background median for an image by iteratively sigma clipping. It first creates a source mask using segmentation and binary dilation (see https://photutils.readthedocs.io/en/stable/api/photutils.make_source_mask.html) for more details, before iteratively calculating the sigma-clipped median of the data.
Parameters: - data (str or numpy.ndarray or astropy.io.fits.PrimaryHDU) – Data to calculate the background median for. If provided as a string, this is interpreted as a filename for a .fits HDU.
- sigma (float, optional) – Level to perform sigma-clipping to. Defaults to 3.
- npixels (int, optional) – Number of connected pixels greater than sigma to consider for a pixel to be part of a source when masking. Defaults to 5.
- maxiters (int,optional) – The maximum number of sigma-clipping iterations to perform. Defaults to 20.
Returns: Background median of the data.
Return type: float
Model the background as a 2D polynomial.
After masking sources, fits a 2D polynomial to the remaining data. This is useful for images where the background ripples over small angular scales, such as 2MASS or SDSS data.
Parameters: - data (str or numpy.ndarray or astropy.io.fits.PrimaryHDU) – Data to calculate the background median for. If provided as a string, this is interpreted as a filename for a .fits HDU.
- poly_order (int, optional) – The 2D polynomial order to fit the background to. Defaults to 5.
- sigma (float, optional) – Level to set mask minimum SNR to. Defaults to 2.
- npixels (int, optional) – Number of connected pixels greater than sigma to consider for a pixel to be part of a source when masking. Defaults to 5.
Returns: - The modelled background; same size as the input
data.
Return type: numpy.ndarray
Mosaic together a folder full of .fits files.
Takes a folder and runs through the number of steps that MontagePy requires to combine all the .fits files within that folder. Also, optionally performs background modelling and matching (which most users will want to set to true). Note that this is not a background subtraction!
Parameters: - input_folder (str) – Folder of raw files to mosaic.
- header (str, optional) – Output from mHdr. If not specified, will mosaic all of the images together no matter the overlap.
- output_folder (str, optional) – Working folder for mosaicking. Defaults to ‘mosaic’.
- background_match (bool, optional) – Whether to perform background matching steps while mosaicking. Defaults to True.
- verbose (bool, optional) – Print out verbose statements during the mosaicking process. Useful for debugging. Defaults to False.
Optimize the size of a .fits image.
Calculate the minimum size for an image, updating the HDU at the end. This is useful for images out of mosaicking tools, where there might be a number of NaNs artificially inflating the filesize.
Parameters: - hdu (str or astropy.io.fits.PrimaryHDU) – Data to optimize size of. If this is a string, this is interpreted as a filename for a .fits HDU.
- hdu_out (str, optional) – Filename for output trimmed .fits file. Defaults to None, which will save nothing.
Returns: The size-optimized HDU.
Return type: astropy.io.fits.ImageHDU