MAST DownloadΒΆ

In this short tutorial the MAST query functions of GALEXField are used to download fresh data.

from loguru import logger
from astropy.table import Table

from vasca.field import GALEXField
from vasca.resource_manager import ResourceManager
# Activate logging
logger.enable("vasca")
# Initialize ResourceManager
rm = ResourceManager()
docs_resources = rm.get_path("docs_resources", "vasca")
gal_visits = rm.get_path("gal_visits_list", "vasca")
# Let's look at a single field with two visits
field_name = "AIS_309_1_28"  # 2 visits, contains Crab pulsar
field_id = 6381787756527353856
# Show visits info about this field
# tt_gal_visits is a table containing info about all GALEX visits
tt_gal_visits = Table.read(gal_visits)
sel_fd = tt_gal_visits["ParentImgRunID"] == field_id
# tt_gal_visits[sel_fd]
RATileCenter DECTileCenter survey nexptime fexptime imgRunID ParentImgRunID joinID tileNum specTileNum source nPhotoObjects nPhotoVisits PhotoObsDate spectra nSpectra nSpectraVisits SpecObsDate visitNum subvis minPhotoObsDate maxPhotoObsDate minSpecObsDate maxSpecObsDate PhotoObsDate_MJD
Loading ITables v2.2.3 from the init_notebook_mode cell... (need help?)
# Initialize a new field and
# download data from MAST
fd = GALEXField.load(
    gfield_id=field_id,
    obs_filter="NUV",
    method="MAST_REMOTE",
    load_products="ALL",
    data_path=docs_resources,
    visits_data_path=gal_visits,
)
Hide code cell output
2024-11-11 08:55:39.427 | INFO     | vasca.field:load:747 - Loading field '6381787756527353856' with method 'MAST_REMOTE' for filter 'NUV' and load_products 'ALL'.
2024-11-11 08:55:39.428 | DEBUG    | vasca.field:__init__:533 - Field data path set to: '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856'
2024-11-11 08:55:39.429 | DEBUG    | vasca.field:__init__:534 - Visits data path set to: '/home/runner/work/vasca-mirror/vasca-mirror/vasca/test/resources/GALEX_visits_list.fits'
2024-11-11 08:55:39.429 | DEBUG    | vasca.field:_load_galex_field_info:888 - Downloading archive field info and saving to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_coadd.fits.
2024-11-11 08:55:39.676 | DEBUG    | vasca.field:_load_galex_field_info:908 - Constructing 'tt_fields'.
2024-11-11 08:55:39.679 | DEBUG    | vasca.tables:add_table:156 - Adding table 'base_field:tt_fields'
2024-11-11 08:55:39.680 | DEBUG    | vasca.field:_load_galex_visits_info:957 - Loading GALEX visit info :6381787756527353856 NUV None
2024-11-11 08:55:39.681 | DEBUG    | vasca.field:_load_galex_visits_info:988 - Reading archive visit info from cashed file '/home/runner/work/vasca-mirror/vasca-mirror/vasca/test/resources/GALEX_visits_list.fits'
2024-11-11 08:55:39.705 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_visits'
2024-11-11 08:55:39.707 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'field_id': b'GNU6381787756527353856', , S
2024-11-11 08:55:39.707 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'field_name': b'AIS_309_1_28', None, S
2024-11-11 08:55:39.708 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'ra': 83.49715416019251, deg, f
2024-11-11 08:55:39.709 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'dec': 22.0648638252376, deg, f
2024-11-11 08:55:39.709 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'fov_diam': 1.2000000476837158, deg, f
2024-11-11 08:55:39.710 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'observatory': b'GALEX', None, S
2024-11-11 08:55:39.710 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'obs_filter': b'NUV', None, S
2024-11-11 08:55:39.711 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'ra': 83.49715416019251, deg, f
2024-11-11 08:55:39.711 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'dec': 22.0648638252376, deg, f
2024-11-11 08:55:39.713 | DEBUG    | vasca.field:set_field_attr:324 - Set attributes: {'tt_fields': ['field_id', 'field_name', 'ra', 'dec', 'fov_diam', 'observatory', 'obs_filter', 'center'], 'tt_visits': ['nr_vis', 'time_bin_size_sum', 'time_start', 'time_stop']}
2024-11-11 08:55:39.713 | DEBUG    | vasca.field:_load_galex_archive_products:1076 - Reading archive field info from cashed file '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_coadd.fits'
2024-11-11 08:55:39.728 | DEBUG    | vasca.field:_load_galex_archive_products:1081 - Downloading archive data products list and saving to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_data.fits.
2024-11-11 08:55:39.907 | DEBUG    | vasca.field:_load_galex_archive_products:1164 - Downloading archive data products. Manifest saved to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_down.ecsv.
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/00-visits/0001-img/07-try/AIS_309_0001_sg28-nd-int.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619088400384/AIS_309_0001_sg28-nd-int.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/00-visits/0001-img/07-try/AIS_309_0001_sg28-xd-mcat.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619088400384/AIS_309_0001_sg28-xd-mcat.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/00-visits/0002-img/07-try/AIS_309_0002_sg28-nd-int.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619121954816/AIS_309_0002_sg28-nd-int.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/00-visits/0002-img/07-try/AIS_309_0002_sg28-xd-mcat.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619121954816/AIS_309_0002_sg28-xd-mcat.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/01-main/0001-img/07-try/AIS_309_sg28-nd-int.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787756527353856/AIS_309_sg28-nd-int.fits.gz ...
 [Done]
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:GALEX/url/data/GR6/pipe/02-vsn/50309-AIS_309/d/01-main/0001-img/07-try/AIS_309_sg28-xd-mcat.fits.gz to /home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787756527353856/AIS_309_sg28-xd-mcat.fits.gz ...
 [Done]
2024-11-11 08:55:42.948 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_detections'
2024-11-11 08:55:42.953 | DEBUG    | vasca.field:_load_galex_archive_products:1391 - Constructed 'tt_detections'.
2024-11-11 08:55:42.964 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_coadd_detections'
2024-11-11 08:55:42.967 | DEBUG    | vasca.field:_load_galex_archive_products:1396 - Constructed 'tt_coadd_detections'.
2024-11-11 08:55:42.967 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787756527353856/AIS_309_sg28-nd-int.fits.gz'
2024-11-11 08:55:43.535 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619088400384/AIS_309_0001_sg28-nd-int.fits.gz'
2024-11-11 08:55:44.120 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619121954816/AIS_309_0002_sg28-nd-int.fits.gz'
2024-11-11 08:55:44.703 | INFO     | vasca.tables:write_to_fits:211 - Writing file with name '/home/runner/work/vasca-mirror/vasca-mirror/docs/tutorial_resources/6381787756527353856/VASCA_GALEX_6381787756527353856_NUV_field_data.fits'
2024-11-11 08:55:44.704 | DEBUG    | vasca.tables:write_to_fits:222 - Storing image data of shape (3840, 3840)
2024-11-11 08:55:44.717 | DEBUG    | vasca.tables:write_to_fits:236 - Storing image data of shape (2, 3840, 3840)
2024-11-11 08:55:47.408 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_fields'
2024-11-11 08:55:47.422 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_visits'
2024-11-11 08:55:47.433 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_detections'
2024-11-11 08:55:47.465 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_coadd_detections'
2024-11-11 08:55:47.525 | INFO     | vasca.field:from_MAST:683 - Loaded new GALEX field '6381787756527353856' with obs_filter 'NUV'from MAST data .