Cutouts¶
Everything related to cutouts is documented bellow:
- hostphot.cutouts.check_existing_images(name, filters, survey)¶
Checks if images exist for the given filters+survey combination, for the given object.
- Parameters:
name (str) – Name of the object.
filters (str or list) – Filters to use.
survey (str) – Survey name.
- Returns:
filters_without_image – Filters without images.
- Return type:
list
- hostphot.cutouts.download_images(name, ra, dec, size=3, filters=None, overwrite=True, survey='PS1', version=None)¶
Download images for a given object in the given filters of a given survey.
The surveys that use the
version
parameter are: GALEX (AIS
,MIS
,DIS
,NGS
andGII
), unWISE (allwise
andneo{i}
for {i}=1-7), VISTA (VHS
,VIDEO
andVIKING
) and SDSS (dr{i}
for {i}=12-17).- Parameters:
name (str) – Name used for tracking the object in your local directory.
ra (float) – Right ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters for the images.overwrite (bool, default
True
) – IfTrue
, the images are overwritten if they already exist.survey (str, default
PS1
) – Survey used to download the images.version (str, default
None
) – Version used by some surveys including multiple surveys. E.g.VHS
for VISTA.
Examples
>>> from hostphot.cutouts import download_images >>> name = 'SN2004eo' >>> host_ra, host_dec = 308.2092, 9.92755 # coords of host galaxy of SN2004eo >>> survey = 'PS1' >>> download_images(name, host_ra, host_dec, survey=survey)
- hostphot.cutouts.get_2MASS_images(ra, dec, size=3, filters=None)¶
Downloads a set of 2MASS fits images for a given set of coordinates and filters.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesFUV, NUV
.
- Returns:
hdu_list – List with fits images for the given filters. None is returned if no image is found.
- Return type:
list
- hostphot.cutouts.get_DES_images(ra, dec, size=3, filters=None)¶
Gets DES fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesgrizY
.
- Returns:
hdu_list – List of fits images.
- Return type:
list
- hostphot.cutouts.get_DES_urls(ra, dec, fov, filters='grizY')¶
Obtains the URLs of the DES images+weights with the largest exposure times in the given filters.
- Parameters:
ra (float) – Right ascension in degrees.
dec (float) – Declination in degrees.
fov (float) – Field of view in degrees.
filters (str, default
None
) – Filters to use. IfNone
, usesgrizY
.
- Returns:
url_list (list) – List of URLs with DES images.
url_w_list (list) – List of URLs with DES images weights.
- hostphot.cutouts.get_GALEX_images(ra, dec, size=3, filters=None, version=None)¶
Downloads a set of GALEX fits images for a given set of coordinates and filters.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesFUV, NUV
.version (str, default
None
) – Version of GALEX images. Either Deep (DIS
), Medium (MIS
) or All-Sky Imaging Survey (AIS
), or Nearby Galaxy Survey (NGS
) or Guest Investigator Survey (GII
). IfNone
, take the image with the longest exposure time.
- Returns:
hdu_list – List with fits images for the given filters.
None
is returned if no image is found.- Return type:
list
- hostphot.cutouts.get_HST_images(ra, dec, size=3, filt=None)¶
Downloads a set of HST fits images for a given set of coordinates and filters using the MAST archive.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filt (str, default
None
) – Filter to use, e.g.WFC3_UVIS_F225W
.
- Returns:
hdu_list – List with fits image for the given filter. None is returned if no image is found.
- Return type:
list
- hostphot.cutouts.get_LegacySurvey_images(ra, dec, size=3, filters=None, version='dr10')¶
Gets Legacy Survey fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesgrz
.version (str, default
dr10
) – Data release version. E.g.dr10
,dr9
,dr8
, etc..
- Returns:
fits_files – List of fits images.
- Return type:
list
- hostphot.cutouts.get_PS1_images(ra, dec, size=3, filters=None)¶
Gets PS1 fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesgrizy
.
- Returns:
fits_files – List of fits images.
- Return type:
list
- hostphot.cutouts.get_PS1_urls(ra, dec, size=3, filters=None)¶
Get URLs for images obtained with
query_ps1()
.- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesgrizy
.
- Returns:
url_list – List of URLs for the fits images.
- Return type:
list
- hostphot.cutouts.get_SDSS_images(ra, dec, size=3, filters=None, version=None)¶
Downloads a set of SDSS fits images for a given set of coordinates and filters using SkyView.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesugriz
.version (str, default
None
) – Data release version to use. If not given, use the latest one (dr17
).
- Returns:
hdu_list – List with fits images for the given filters. None is returned if no image is found.
- Return type:
list
- hostphot.cutouts.get_SPLUS_images(ra, dec, size=3, filters=None)¶
Gets S-Plus fits images for the given coordinates and filters.
The available filters are: ‘F378’, ‘F395’, ‘F410’, ‘F430’, ‘F515’, ‘F660’, ‘F861’, ‘G’, ‘I’, ‘R’, ‘U’, ‘Z’.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, uses all available filters.
- Returns:
hdu_list – List of fits images.
- Return type:
list
- hostphot.cutouts.get_SPlus_urls(ra, dec, fov, filters=None)¶
Obtains the URLs of the S-Plus images.
The available filters are: ‘F378’, ‘F395’, ‘F410’, ‘F430’, ‘F515’, ‘F660’, ‘F861’, ‘G’, ‘I’, ‘R’, ‘U’, ‘Z’.
- Parameters:
ra (float) – Right ascension in degrees.
dec (float) – Declination in degrees.
fov (float) – Field of view in degrees.
filters (str, default
None
) – Filters to use. IfNone
, uses all available filters.
- Returns:
url_list – List of URLs with S-Plus images.
- Return type:
list
- hostphot.cutouts.get_SkyMapper_images(ra, dec, size=3, filters=None)¶
Gets SkyMapper fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesuvgriz
.
- Returns:
hdu_list – List of fits images.
- Return type:
list
- hostphot.cutouts.get_SkyMapper_urls(ra, dec, fov, filters='uvgriz')¶
Obtains the URLs of the SkyMapper images.
The images closest to the given coordinates are retrieved
- Parameters:
ra (float) – Right ascension in degrees.
dec (float) – Declination in degrees.
fov (float) – Field of view in degrees.
filters (str, default
None
) – Filters to use. IfNone
, usesuvgriz
.
- Returns:
url_list – List of URLs with SkyMapper images.
- Return type:
list
- hostphot.cutouts.get_Spitzer_images(ra, dec, size=3, filters=None)¶
Gets Spitzer fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesIRAC.1, IRAC.2, IRAC.3, IRAC.4, MIPS.1
.
- Returns:
fits_files – List of fits images.
- Return type:
list
- hostphot.cutouts.get_UKIDSS_images(ra, dec, size=3, filters='ZYJHK')¶
Gets UKIDSS fits images for the given coordinates and filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesZYJHK
.
- Returns:
fits_files – List of fits images.
- Return type:
list
- hostphot.cutouts.get_VISTA_images(ra, dec, size=3, filters=None, version='VHS')¶
Gets VISTA fits images for the given coordinates and filters.
Note: the different surveys included in VISTA cover different parts of the sky and do not necessarily contain the same filters.
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesZ, Y, J, H, Ks
.version (str, default
VHS
) – Survey to use:VHS
,VIDEO
orVIKING
.
- Returns:
fits_files – List of fits images.
- Return type:
list
- hostphot.cutouts.get_WISE_images(ra, dec, size=3, filters=None)¶
Downloads a set of WISE fits images for a given set of coordinates and filters.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, uses all WISE filters.
- Returns:
hdu_list – List with fits images for the given filters. None is returned if no image is found.
- Return type:
list
- hostphot.cutouts.get_unWISE_images(ra, dec, size=3, filters=None, version='allwise')¶
Downloads a set of unWISE fits images for a given set of coordinates and filters.
- Parameters:
ra (str or float) – Right ascension in degrees.
dec (str or float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, uses all WISE filters.version (str, default
allwise
) – Version of the unWISE images. Eitherallwise
orneo{i}
for {i} = 1 to 7.
- Returns:
hdu_list – List with fits images for the given filters. None is returned if no image is found.
- Return type:
list
- hostphot.cutouts.get_used_image(header)¶
Obtains the name of the image downloaded by SkyView.
- Parameters:
header (fits header) – Header of an image.
- Returns:
used_image – Name of the image.
- Return type:
str
- hostphot.cutouts.match_wcs(fits_files)¶
Matches the WCS of all the images, taking the first ones as a reference.
- Parameters:
fits_files (list) – List of fits files.
- Returns:
matched_fits_files – List of fits files with matched WCS.
- Return type:
list
- hostphot.cutouts.query_ps1(ra, dec, size=3, filters=None)¶
Query ps1filenames.py service to get a list of images
- Parameters:
ra (float) – Right Ascension in degrees.
dec (float) – Declination in degrees.
size (float or ~astropy.units.Quantity, default
3
) – Image size. If a float is given, the units are assumed to be arcmin.filters (str, default
None
) – Filters to use. IfNone
, usesgrizy
.
- Returns:
table – Astropy table with the results.
- Return type:
astropy Table
- hostphot.cutouts.set_HST_image(file, filt, name)¶
Moves a previously downloaded HST image into the work directory.
The image’s header is updated with the necessary keywords to obtain photometry and is also moved under the objects directory inside the work directory.
HST images take very long to download, so the user might prefer to download the images manually and then use this function to include the image into the workflow.
- Parameters:
file (str) – HST image to use.
filt (str) – HST filter, e.g.
WFC3_UVIS_F275W
.name (str) – Object’s name.
- hostphot.cutouts.update_HST_header(hdu)¶
Updates the HST image header with the necessary keywords.
- Parameters:
hdu (Header Data Unit.) – HST FITS image.