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-08 14:07:32.633 | INFO     | vasca.field:load:747 - Loading field '6381787756527353856' with method 'MAST_REMOTE' for filter 'NUV' and load_products 'ALL'.
2024-11-08 14:07:32.634 | DEBUG    | vasca.field:__init__:533 - Field data path set to: '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856'
2024-11-08 14:07:32.635 | DEBUG    | vasca.field:__init__:534 - Visits data path set to: '/home/runner/work/vasca/vasca/vasca/test/resources/GALEX_visits_list.fits'
2024-11-08 14:07:32.636 | DEBUG    | vasca.field:_load_galex_field_info:888 - Downloading archive field info and saving to /home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_coadd.fits.
2024-11-08 14:07:33.255 | DEBUG    | vasca.field:_load_galex_field_info:908 - Constructing 'tt_fields'.
2024-11-08 14:07:33.260 | DEBUG    | vasca.tables:add_table:156 - Adding table 'base_field:tt_fields'
2024-11-08 14:07:33.263 | DEBUG    | vasca.field:_load_galex_visits_info:957 - Loading GALEX visit info :6381787756527353856 NUV None
2024-11-08 14:07:33.264 | DEBUG    | vasca.field:_load_galex_visits_info:988 - Reading archive visit info from cashed file '/home/runner/work/vasca/vasca/vasca/test/resources/GALEX_visits_list.fits'
2024-11-08 14:07:33.297 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_visits'
2024-11-08 14:07:33.298 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'field_id': b'GNU6381787756527353856', , S
2024-11-08 14:07:33.299 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'field_name': b'AIS_309_1_28', None, S
2024-11-08 14:07:33.300 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'ra': 83.49715416019251, deg, f
2024-11-08 14:07:33.300 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'dec': 22.0648638252376, deg, f
2024-11-08 14:07:33.301 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'fov_diam': 1.2000000476837158, deg, f
2024-11-08 14:07:33.301 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'observatory': b'GALEX', None, S
2024-11-08 14:07:33.302 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'obs_filter': b'NUV', None, S
2024-11-08 14:07:33.303 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'ra': 83.49715416019251, deg, f
2024-11-08 14:07:33.303 | DEBUG    | vasca.field:get_field_par:403 - Getting parameter 'dec': 22.0648638252376, deg, f
2024-11-08 14:07:33.305 | 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-08 14:07:33.305 | DEBUG    | vasca.field:_load_galex_archive_products:1076 - Reading archive field info from cashed file '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_coadd.fits'
2024-11-08 14:07:33.321 | DEBUG    | vasca.field:_load_galex_archive_products:1081 - Downloading archive data products list and saving to /home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/MAST_6381787756527353856_NUV_data.fits.
2024-11-08 14:07:34.138 | DEBUG    | vasca.field:_load_galex_archive_products:1164 - Downloading archive data products. Manifest saved to /home/runner/work/vasca/vasca/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/vasca/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/vasca/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/vasca/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/vasca/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/vasca/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/vasca/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787756527353856/AIS_309_sg28-xd-mcat.fits.gz ...
 [Done]
2024-11-08 14:07:46.755 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_detections'
2024-11-08 14:07:46.760 | DEBUG    | vasca.field:_load_galex_archive_products:1391 - Constructed 'tt_detections'.
2024-11-08 14:07:46.777 | DEBUG    | vasca.tables:add_table:156 - Adding table 'galex_field:tt_coadd_detections'
2024-11-08 14:07:46.781 | DEBUG    | vasca.field:_load_galex_archive_products:1396 - Constructed 'tt_coadd_detections'.
2024-11-08 14:07:46.782 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787756527353856/AIS_309_sg28-nd-int.fits.gz'
2024-11-08 14:07:47.361 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619088400384/AIS_309_0001_sg28-nd-int.fits.gz'
2024-11-08 14:07:47.958 | DEBUG    | vasca.field:load_sky_map:117 - Loading skypmap from file: '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/mastDownload/GALEX/6381787619121954816/AIS_309_0002_sg28-nd-int.fits.gz'
2024-11-08 14:07:48.549 | INFO     | vasca.tables:write_to_fits:211 - Writing file with name '/home/runner/work/vasca/vasca/docs/tutorial_resources/6381787756527353856/VASCA_GALEX_6381787756527353856_NUV_field_data.fits'
2024-11-08 14:07:48.550 | DEBUG    | vasca.tables:write_to_fits:222 - Storing image data of shape (3840, 3840)
2024-11-08 14:07:48.564 | DEBUG    | vasca.tables:write_to_fits:236 - Storing image data of shape (2, 3840, 3840)
2024-11-08 14:07:51.285 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_fields'
2024-11-08 14:07:51.303 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_visits'
2024-11-08 14:07:51.317 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_detections'
2024-11-08 14:07:51.359 | DEBUG    | vasca.tables:write_to_fits:251 - Writing table 'tt_coadd_detections'
2024-11-08 14:07:51.429 | INFO     | vasca.field:from_MAST:683 - Loaded new GALEX field '6381787756527353856' with obs_filter 'NUV'from MAST data .