Astroquery: Exploring Metadata from the James Webb Space Telescope#
Learning Goals#
By the end of this tutorial, you will:
Understand how to use the
astroquery.mast
module to access metadata from the James Webb Space Telescope (JWST).Run metadata queries based on coordinates, an object name, or non-positional criteria.
Use optional search parameters to further refine query results.
Table of Contents#
Introduction
Querying MAST for JWST Metadata
Setup
Optional Search Parameters
Query by Object Name
Query by Region
Query by Criteria
Additional Resources
Exercise Solutions
Introduction#
Welcome! This tutorial focuses on using the astroquery.mast
module to search for metadata from the James Webb Space Telescope (JWST). Launched in December of 2021, JWST is an advanced space observatory designed for observations in the infrared light spectrum.
The Mikulski Archive for Space Telescopes (MAST) hosts publicly accessible data products from space telescopes like JWST. astroquery.mast
provides access to a broad set of JWST metadata, including header keywords, proposal information, and observational parameters. The available metadata can also be found using the MAST JWST Search interface.
Please note that astroquery.mast.MastMissions
and the MAST JWST Search API do not yet support data product downloads.
Imports#
This notebook uses the following packages:
astroquery.mast to query the MAST Archive
astropy.coordinates to assign coordinates of interest
from astroquery.mast import MastMissions
from astropy.coordinates import SkyCoord
Querying MAST for JWST Metadata#
Setup#
In order to make queries on JWST metadata, we will have to perform some setup. First, we will instantiate an object of the MastMissions
class and assign its mission
to be 'jwst'
. Its service
is set to the default of 'search'
.
# Create MastMissions object and assign mission to 'jwst'
missions = MastMissions(mission='jwst')
print(f'Mission: {missions.mission}')
print(f'Service: {missions.service}')
Mission: jwst
Service: search
When writing queries, keyword arguments can be used to specify output characteristics (see the following section) and filter on values like instrument, exposure type, and proposal ID. The available column names for a mission are returned by the get_column_list
function. Below, we will print out the name, data type, and description for the first 10 columns in JWST metadata.
# Get available columns for JWST mission
columns = missions.get_column_list()
columns[:10]
name | data_type | description |
---|---|---|
str17 | str9 | str1594 |
search_pos | string | Search Position (RA and Dec) |
ArchiveFileID | integer | ArchiveFileID |
fileSetName | string | Of the form jwpppppooovvv_ggsaa_eeeee where ppppp - Program Number, ooo - Observation Number, vvv - Visit Number, gg - Visit Group, s - Parallel Sequence id (1 prime, 2-5 parallel), aa - Activity (base 36), and eeeee - Exposure Number, all padded by zeros where necessary. Source-based data set names are expressed as jwppppp-oOOO_tTTT_instrument, where: ppppp - Program number, OOO - observation number, TTT - target number, and instrument - Instrument name |
productLevel | string | Product levels, 1b is an Uncal FITS file, 2a = Countrate exposure, 2b = calibrated exposure, 2c = cosmic-ray-flagged exposure, and 3 = combined data. |
targprop | string | Proposer prefered name for the target |
targname | string | Standard astronomical catalog name for the target |
targ_ra | ra | Right Ascension (J2000), from 0 to 360, in degrees |
targ_dec | dec | Declination (J2000), from -90 to +90, in degrees |
instrume | string | Identifies the instrument used to acquire the data. |
exp_type | string | Exposure type is used by DMS to direct Science Data Processing code (SDP) and calibration, as well as provide metadata for archive searches. For a given template the EXP_TYPE keyword value is obtained for each exposure from the EXPOSURE_TYPE exposure-level parameter in the Observatory Status File (OSF). In a few cases, additional information is required to set the value for the EXP_TYPE keyword |
Optional Search Parameters#
Before we dive in to the actual queries, it’s important to know how we can refine our results with optional keyword arguments. The following parameters are available:
radius
: For positional searches only. Only return results within a certain distance from an object or set of coordinates. Default is 3 arcminutes.limit
: The maximum number of results to return. Default is 5000.offset
: Skip the first n results. Useful for paging through results.select_cols
: A list of columns to be returned in the response.
As we walk through different types of queries, we will see these parameters in action!
Query by Object Name#
We’ve reached our first query! We can use object names to perform metadata queries using the query_object
function.
To start, let’s query for the Messier 1 object, a supernova remnant in the Taurus constellation. You may know it better as the Crab Nebula!
# Query for Messier 1 ('M1')
results = missions.query_object('M1')
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 250
ArchiveFileID | fileSetName | productLevel | targprop | targ_ra | targ_dec | instrume | exp_type | opticalElements | date_obs | duration | program | observtn | visit | publicReleaseDate | pi_name | proposal_type | proposal_cycle | targtype | access | ang_sep | s_region |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int64 | str25 | str14 | str18 | float64 | float64 | str6 | str9 | str77 | str27 | float64 | int64 | int64 | int64 | str19 | str10 | str2 | int64 | str5 | str6 | float64 | str117 |
140969955 | jw01714001001_02101_00001 | 1b, 2a, 2b, 2c | CRAB-NEBULA | 83.63604958333333 | 22.01641666666667 | MIRI | MIR_IMAGE | F560W | 2023-02-24T00:50:42.9710000 | 138.752 | 1714 | 1 | 1 | 2024-02-24T13:30:27 | Temim, Tea | GO | 1 | FIXED | PUBLIC | 1.0970509857770536 | POLYGON ICRS 83.651895783 22.020165846 83.685738447 22.019090702 83.686913614 22.050772495 83.653063383 22.051847880 |
140969441 | jw01714001001_02101_00002 | 1b, 2a, 2b, 2c | CRAB-NEBULA | 83.63604958333333 | 22.01641666666667 | MIRI | MIR_IMAGE | F560W | 2023-02-24T00:54:27.7390000 | 138.752 | 1714 | 1 | 1 | 2024-02-24T13:33:03 | Temim, Tea | GO | 1 | FIXED | PUBLIC | 0.8253462827989163 | POLYGON ICRS 83.646857347 22.020496034 83.680700125 22.019421805 83.681874298 22.051103630 83.648023954 22.052178100 |
140970303 | jw01714001001_02101_00003 | 1b, 2a, 2b, 2c | CRAB-NEBULA | 83.63604958333333 | 22.01641666666667 | MIRI | MIR_IMAGE | F560W | 2023-02-24T00:58:07.0030000 | 138.752 | 1714 | 1 | 1 | 2024-02-24T13:32:24 | Temim, Tea | GO | 1 | FIXED | PUBLIC | 0.9607116035272403 | POLYGON ICRS 83.647661363 22.024897630 83.681505187 22.023823259 83.682679551 22.055505079 83.648828160 22.056579690 |
140969487 | jw01714001001_02101_00004 | 1b, 2a, 2b, 2c | CRAB-NEBULA | 83.63604958333333 | 22.01641666666667 | MIRI | MIR_IMAGE | F560W | 2023-02-24T01:01:46.2660000 | 138.752 | 1714 | 1 | 1 | 2024-02-24T13:33:18 | Temim, Tea | GO | 1 | FIXED | PUBLIC | 1.1368712452489975 | POLYGON ICRS 83.651520724 22.024094493 83.685364325 22.023019302 83.686539577 22.054701093 83.652688408 22.055776525 |
140970598 | jw01714001001_02103_00001 | 1b, 2a, 2b, 2c | CRAB-NEBULA | 83.63604958333333 | 22.01641666666667 | MIRI | MIR_IMAGE | F1130W | 2023-02-24T01:07:30.3500000 | 105.452 | 1714 | 1 | 1 | 2024-02-24T13:34:12 | Temim, Tea | GO | 1 | FIXED | PUBLIC | 1.0962220337763038 | POLYGON ICRS 83.651879463 22.020173371 83.685722127 22.019098153 83.686897374 22.050779944 83.653047144 22.051855402 |
There were 250 total results, meaning that 250 JWST datasets were targeting the Crab Nebula. Now, let’s try refining our search a bit more.
Each dataset is associated with a celestial coordinate, given by
targ_ra
(right ascension) andtarg_dec
(declination). By default, the query returns all datasets that fall within 3 arcminutes from the object’s coordinates. Let’s set theradius
parameter to be 1 arcminute instead.Say that we’re not interested in the first 4 results. We can assign
offset
to skip a certain number of rows.By default, a subset of recommended columns are returned for each query. However, we can specify exactly which columns to return using the
select_cols
keyword argument. TheArchiveFileID
column is included automatically.
# Refined query for Messier 1 ('M1')
results = missions.query_object('M1',
radius=1, # Search within a 1 arcminute radius
offset=4, # Skip the first 4 results
select_cols=['fileSetName', 'targprop', 'date_obs']) # Select certain columns
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 161
ArchiveFileID | fileSetName | targprop | date_obs | s_region |
---|---|---|---|---|
int64 | str25 | str18 | str27 | str117 |
140967908 | jw01714001001_02105_00002 | CRAB-NEBULA | 2023-02-24T01:23:47.1870000 | POLYGON ICRS 83.646836411 22.020511240 83.680679192 22.019437014 83.681853361 22.051118839 83.648003014 22.052193305 |
140968840 | jw01714001001_02105_00003 | CRAB-NEBULA | 2023-02-24T01:25:40.9790000 | POLYGON ICRS 83.647640608 22.024913016 83.681484434 22.023838623 83.682658823 22.055520441 83.648807429 22.056595075 |
140969064 | jw01714001001_02107_00002 | CRAB-NEBULA | 2023-02-24T01:33:35.5030000 | POLYGON ICRS 83.646850658 22.020498367 83.680693435 22.019424131 83.681867616 22.051105955 83.648017272 22.052180431 |
140968989 | jw01714001001_02107_00003 | CRAB-NEBULA | 2023-02-24T01:36:24.7820000 | POLYGON ICRS 83.647654834 22.024900130 83.681498658 22.023825747 83.682673036 22.055507566 83.648821644 22.056582189 |
140968684 | jw01714001002_02101_00002 | CRAB-NEBULA | 2023-02-24T01:53:56.5670000 | POLYGON ICRS 83.646065866 22.002003062 83.679904222 22.000928695 83.681078389 22.032610514 83.647232475 22.033685122 |
Exercise 1#
Now it’s your turn! Try querying for the Whirlpool Galaxy object. Search within a radius of 1 arcminute, skip the first 300 results, and select the fileSetName
and opticalElements
columns.
# # Query for Whirlpool Galaxy
# results = missions.query_object(...) # Write your query!
# # Display the first 5 results
# print(f'Total number of results: {len(results)}')
# results[:5]
Query by Region#
The missions
object also allows us to query by a region in the sky. By passing in a set of coordinates to the query_region
function, we can return datasets that fall within a certain radius
value of that point. This type of search is also known as a cone search.
# Create coordinate object
coords = SkyCoord(210.80227, 54.34895, unit=('deg'))
# Query for results within 10 arcminutes of coords
results = missions.query_region(coords, radius=10)
# Display results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 431
ArchiveFileID | fileSetName | productLevel | targprop | targ_ra | targ_dec | instrume | exp_type | opticalElements | date_obs | duration | program | observtn | visit | publicReleaseDate | pi_name | proposal_type | proposal_cycle | targtype | access | ang_sep | s_region |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
int64 | str31 | str14 | str25 | float64 | float64 | str7 | str17 | str89 | str27 | float64 | int64 | int64 | int64 | str19 | str25 | str6 | int64 | str7 | str16 | float64 | str121 |
143245453 | jw01995001001_02101_00001 | 1b, 2a, 2b, 2c | MESSIER-101 | 210.876465 | 54.36092777777778 | NIRCAM | NRC_IMAGE | F115W;CLEAR, F444W;CLEAR | 2023-05-30T15:23:35.5330000 | 311.366 | 1995 | 1 | 1 | 2024-05-30T23:55:17 | Freedman, Wendy L. | GO | 1 | FIXED | PUBLIC | 0.9317195976624251 | POLYGON ICRS 210.827993572 54.354715688 210.864844544 54.325657806 210.914875889 54.347195624 210.878040993 54.376268745 |
143248342 | jw01995001001_02101_00002 | 1b, 2a, 2b, 2c | MESSIER-101 | 210.876465 | 54.36092777777778 | NIRCAM | NRC_IMAGE | F115W;CLEAR, F444W;CLEAR | 2023-05-30T15:30:23.4690000 | 311.366 | 1995 | 1 | 1 | 2024-05-30T23:56:39 | Freedman, Wendy L. | GO | 1 | FIXED | PUBLIC | 0.9247099787034783 | POLYGON ICRS 210.895598212 54.383166871 210.932406715 54.354011954 210.982639688 54.375509952 210.945847598 54.404680147 |
143248633 | jw01995001001_02101_00003 | 1b, 2a, 2b, 2c | MESSIER-101 | 210.876465 | 54.36092777777778 | NIRCAM | NRC_IMAGE | F115W;CLEAR, F444W;CLEAR | 2023-05-30T15:37:00.7800000 | 311.366 | 1995 | 1 | 1 | 2024-05-30T23:58:44 | Freedman, Wendy L. | GO | 1 | FIXED | PUBLIC | 0.9387390545558567 | POLYGON ICRS 210.853452937 54.366244061 210.871650908 54.351711621 210.896510323 54.362275300 210.878316469 54.376811479 |
143247692 | jw01995001001_02201_00001 | 1b, 2a, 2b, 2c | MESSIER-101 | 210.876465 | 54.36092777777778 | NIRISS | NIS_IMAGE | CLEAR;F115W | 2023-05-30T15:23:38.9100000 | 311.366 | 1995 | 1 | 1 | 2024-05-30T23:55:55 | Freedman, Wendy L. | GO | 1 | FIXED | PUBLIC | 7.239582698074742 | POLYGON ICRS 210.913934950 54.462978815 210.951558106 54.432634381 211.003204113 54.454479744 210.965638042 54.484823939 |
143248409 | jw01995001001_02201_00002 | 1b, 2a, 2b, 2c | MESSIER-101 | 210.876465 | 54.36092777777778 | NIRISS | NIS_IMAGE | CLEAR;F115W | 2023-05-30T15:30:26.3340000 | 311.366 | 1995 | 1 | 1 | 2024-05-30T23:55:49 | Freedman, Wendy L. | GO | 1 | FIXED | PUBLIC | 7.233995178717605 | POLYGON ICRS 210.913724498 54.462971771 210.951347659 54.432627342 211.002993648 54.454472712 210.965427572 54.484816902 |
395 JWST datasets fall within our cone search. In other words, their target coordinates are within 10 arcminutes of the coordinates that we defined.
Exercise 2:#
JWST has observed the star Vega, which has a right ascension of 279.23473 degrees and a declination of 38.78369 degrees. Use the query_region
function to search for datasets within 15 arcminutes of Vega. Select the fileSetName
, targprop
, targ_ra
, and targ_dec
columns.
# # Vega coordinates
# vega = SkyCoord(_, _, unit=('deg')) # Fill in with Vega's coordinates
# # Query for datasets around Vega
# results = missions.query_region(...) # Write your query!
# # Display the first 5 results
# print(f'Total number of results: {len(results)}')
# results[:5]
Query by Criteria#
In some cases, we may want to run queries with non-positional parameters. To accomplish this, we use the query_criteria
function.
For any of our query functions, we can filter our results by the value of columns in the dataset.
Let’s say that we only want observations from JWST’s Near Infrared Camera (NIRCam) instrument, and that we only want datasets connected to program number 1189.
# Query with column criteria
results = missions.query_criteria(instrume='NIRCAM', # From Near Infrared Camera
program=1189,
select_cols=['fileSetName', 'instrume', 'exp_type', 'program', 'pi_name'])
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 79
ArchiveFileID | fileSetName | instrume | exp_type | program | pi_name | s_region |
---|---|---|---|---|---|---|
int64 | str25 | str6 | str13 | int64 | str17 | str121 |
159785580 | jw01189010001_02101_00001 | NIRCAM | NRC_IMAGE | 1189 | Roellig, Thomas L | POLYGON ICRS 277.137659247 26.861105196 277.149069743 26.846465320 277.165479951 26.856643631 277.154070551 26.871284825 |
159785419 | jw01189010001_02101_00002 | NIRCAM | NRC_IMAGE | 1189 | Roellig, Thomas L | POLYGON ICRS 277.137238152 26.858825348 277.148648325 26.844185414 277.165058265 26.854363641 277.153649189 26.869004893 |
159785131 | jw01189010001_02101_00003 | NIRCAM | NRC_IMAGE | 1189 | Roellig, Thomas L | POLYGON ICRS 277.149235325 26.841068963 277.160604381 26.826745837 277.176674629 26.836900318 277.165306586 26.851224729 |
159784821 | jw01189010001_02101_00004 | NIRCAM | NRC_IMAGE | 1189 | Roellig, Thomas L | POLYGON ICRS 277.148813871 26.838789939 277.160182758 26.824466851 277.176252641 26.834621385 277.164884766 26.848945758 |
159784825 | jw01189010001_04101_00001 | NIRCAM | NRC_IMAGE | 1189 | Roellig, Thomas L | POLYGON ICRS 277.120171890 26.849875464 277.132005933 26.835345259 277.148242726 26.845870734 277.136409668 26.860402290 |
To exclude and filter out a certain value from the results, we can prepend the value with !
.
Let’s run the same query as above, but this time, we will filter out datasets coming from the NIRCam instrument.
# Filtered query, excluding NIRCam datasets
results = missions.query_criteria(program=1189,
instrume='!NIRCAM', # Exclude datasets from the NIRCam instrument
select_cols=['fileSetName', 'instrume', 'exp_type', 'program', 'pi_name'])
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 94
ArchiveFileID | fileSetName | instrume | exp_type | program | pi_name | s_region |
---|---|---|---|---|---|---|
int64 | str31 | str7 | str17 | int64 | str17 | str121 |
159776343 | jw01189001001_02101_00001 | NIRSPEC | NRS_WATA | 1189 | Roellig, Thomas L | POLYGON ICRS 57.028706395 -60.379718866 57.029996917 -60.379034437 57.028628460 -60.378418399 57.027338468 -60.379103025 |
159776754 | jw01189001001_02101_00002 | NIRSPEC | NRS_TACONFIRM | 1189 | Roellig, Thomas L | POLYGON ICRS 57.028868144 -60.379725520 57.030158663 -60.379041090 57.028790202 -60.378425054 57.027500214 -60.379109681 |
159777067 | jw01189001001_04101_00001 | NIRSPEC | NRS_FIXEDSLIT | 1189 | Roellig, Thomas L | -- |
159777116 | jw01189001001_04101_00002 | NIRSPEC | NRS_FIXEDSLIT | 1189 | Roellig, Thomas L | -- |
159776883 | jw01189001001_04101_00003 | NIRSPEC | NRS_FIXEDSLIT | 1189 | Roellig, Thomas L | -- |
We can also use wildcards for more advanced filtering. Let’s use the same query from above, but we will add an exposure type filter for fixed slits (FS) spectroscopy.
# Filtered query with wildcard
results = missions.query_criteria(program=1189,
instrume='!NIRCAM', # Exclude datasets from the NIRCam instrument
exp_type='*FIXEDSLIT*', # Any exposure type that contains 'FIXEDSLIT'
select_cols=['fileSetName', 'instrume', 'exp_type', 'program', 'pi_name'])
# Display the first 10 results
print(f'Total number of results: {len(results)}')
results[:10]
Total number of results: 0
WARNING: NoResultsWarning: Query returned no results. [astroquery.mast.services]
ArchiveFileID | fileSetName | instrume | exp_type | program | pi_name | s_region |
---|---|---|---|---|---|---|
int64 | str1 | str1 | str1 | int64 | str1 | str1 |
To filter by multiple values for a single column, we use a string of the values delimited by commas.
To illustrate this, we will use a slightly different query. We query for datasets that have a fixed slits spectroscopy exposure type and targets with moving coordinates (targtype='MOVING'
). We will add another filter to match three different last names for principal investigators (PIs).
# Filtered query with multiple values
results = missions.query_criteria(exp_type='*FIXEDSLIT*', # Any exposure type that contains 'FIXEDSLIT'
targtype='MOVING', # Only return moving targets
pi_name='Stansberry, Parker, Lunine', # Last name of PI can be any of these 3 values
select_cols=['fileSetName', 'targtype', 'instrume', 'exp_type', 'program', 'pi_name'])
# Display the first 10 results
print(f'Total number of results: {len(results)}')
results[:10]
Total number of results: 0
ArchiveFileID | fileSetName | instrume | exp_type | program | pi_name | targtype | s_region |
---|---|---|---|---|---|---|---|
int64 | str1 | str1 | str1 | int64 | str1 | str1 | str1 |
For columns with numeric or date values, we can filter using comparison values:
<
: Return values less than or before the given number/date>
: Return values greater than or after the given number/date<=
: Return values less than or equal to the given number/date>=
: Return values greater than or equal to the given number/date
As an example, let’s write a query to return all datasets with an observation date before February 1, 2022.
# Query using comparison operator
results = missions.query_criteria(date_obs='<2022-02-01', # Must be observed before February 1, 2022
select_cols=['fileSetName', 'program', 'date_obs'])
# Display results
print(f'Total number of results: {len(results)}')
results
Total number of results: 7
ArchiveFileID | fileSetName | date_obs | program | s_region |
---|---|---|---|---|
int64 | str25 | str27 | int64 | str117 |
152901340 | jw01173001001_02101_00001 | 2022-01-28T14:23:42.0420000 | 1173 | POLYGON ICRS 49.866458426 43.426050483 49.866462762 43.425157226 49.865029698 43.425149829 49.865043995 43.426048206 |
152901354 | jw01173002001_02101_00001 | 2022-01-28T14:36:53.5670000 | 1173 | POLYGON ICRS 49.872292426 43.425849207 49.872296668 43.424955949 49.870863608 43.424948633 49.870878000 43.425847008 |
152900094 | jw01173003001_02101_00001 | 2022-01-28T15:00:36.6550000 | 1173 | POLYGON ICRS 49.833254104 43.387235046 49.830519212 43.418878447 49.873596213 43.420536706 49.876213947 43.389178421 |
152899998 | jw01173004001_02101_00001 | 2022-01-28T15:09:07.1830000 | 1173 | POLYGON ICRS 49.871715919 43.425730091 49.871720169 43.424836834 49.870287112 43.424829510 49.870301495 43.425727886 |
152900368 | jw01173005001_02101_00001 | 2022-01-28T15:26:28.4540000 | 1173 | POLYGON ICRS 49.871724403 43.425719555 49.871728653 43.424826298 49.870295596 43.424818974 49.870309979 43.425717350 |
152900392 | jw01173006001_02101_00001 | 2022-01-28T15:34:23.4690000 | 1173 | POLYGON ICRS 49.871738741 43.425735307 49.871742991 43.424842050 49.870309933 43.424834727 49.870324317 43.425733103 |
152900285 | jw01173007001_02101_00001 | 2022-01-28T15:43:44.3010000 | 1173 | POLYGON ICRS 49.871732392 43.425741041 49.871736642 43.424847784 49.870303584 43.424840460 49.870317968 43.425738836 |
For numeric or date data types, we can also filter with ranges. This requires the following syntax: '#..#'
.
Let’s write a query that uses range syntax to return datasets that belong to a program number between 1150 and 1155. We will also select for exposure durations that are greater than or equal to 100 seconds.
# Query using range operator
results = missions.query_criteria(program='1150..1155', # Program number between 1150 and 1155
duration='>100', # Exposure duration is greater than or equal to 100 seconds
select_cols=['fileSetName', 'program', 'duration'])
# Display results
print(f'Total number of results: {len(results)}')
results
Total number of results: 77
ArchiveFileID | fileSetName | duration | program | s_region |
---|---|---|---|---|
int64 | str25 | float64 | int64 | str121 |
56863803 | jw01151001001_02101_00001 | 203.999 | 1151 | POLYGON ICRS 267.905935489 74.594343945 267.773467483 74.601350652 267.745808425 74.566718890 267.878307607 74.558837777 |
56863873 | jw01151001001_02101_00002 | 203.999 | 1151 | POLYGON ICRS 267.844834919 74.586434115 267.712406428 74.593404722 267.684894677 74.558765447 267.817357659 74.550920433 |
56863512 | jw01151001001_03101_00001 | 214.735 | 1151 | POLYGON ICRS 268.091803329 74.608826495 267.943092794 74.616030022 267.912318626 74.578289816 268.058609787 74.570410560 |
56863800 | jw01151001001_05101_00001 | 203.999 | 1151 | POLYGON ICRS 267.893660571 74.575935751 267.827945499 74.579618578 267.813949853 74.562328771 267.879750360 74.558389483 |
56863856 | jw01151001001_05101_00002 | 203.999 | 1151 | POLYGON ICRS 267.844835056 74.586433898 267.712406430 74.593404320 267.684895365 74.558765007 267.817358498 74.550920178 |
56863823 | jw01151001001_06101_00001 | 214.735 | 1151 | POLYGON ICRS 268.091803198 74.608826549 267.943092604 74.616029989 267.912318750 74.578289765 268.058609977 74.570410594 |
56863853 | jw01151001001_08101_00001 | 203.999 | 1151 | POLYGON ICRS 267.888160436 74.568517327 267.822479644 74.572204521 267.808474310 74.554915646 267.874240304 74.550971983 |
56875469 | jw01151020001_03101_00001 | 214.735 | 1151 | POLYGON ICRS 241.403250845 62.406808505 241.320362209 62.395214146 241.341730845 62.357890793 241.424148058 62.368600633 |
56876309 | jw01151021001_02102_00001 | 118.104 | 1151 | POLYGON ICRS 267.911184344 74.593885726 267.779710230 74.602107984 267.747538661 74.567745622 267.878954411 74.558651139 |
... | ... | ... | ... | ... |
56968427 | jw01155005001_0210a_00002 | 150.315 | 1155 | POLYGON ICRS 268.950135910 65.884115362 268.906969346 65.886595235 268.900599994 65.869182640 268.943757497 65.866457203 |
56968592 | jw01155005001_0210b_00001 | 150.315 | 1155 | POLYGON ICRS 268.904202937 65.886650584 268.861748404 65.889217517 268.855301278 65.872015244 268.897761202 65.869256365 |
56968483 | jw01155005001_0210b_00002 | 150.315 | 1155 | POLYGON ICRS 268.943349832 65.865093564 268.900189303 65.867843084 268.893331493 65.850380419 268.936597351 65.847374789 |
56967461 | jw01155007001_02102_00001 | 1191.781 | 1155 | POLYGON ICRS 268.900739876 65.867352239 268.858053923 65.870127601 268.851284097 65.852675278 268.893941782 65.849901802 |
56967484 | jw01155007001_02103_00001 | 1191.781 | 1155 | POLYGON ICRS 268.907588088 65.885890374 268.865082464 65.888560682 268.858558271 65.871177748 268.901035787 65.868509248 |
56967455 | jw01155007001_02104_00001 | 1191.781 | 1155 | POLYGON ICRS 268.953444161 65.883351054 268.910226105 65.885970032 268.903835023 65.868311189 268.947024000 65.865694013 |
56969427 | jw01155-o001_t018_nircam | 246.946 | 1155 | POLYGON ICRS 268.904172965 65.886609810 268.861719200 65.889178683 268.855267376 65.871976705 268.897726480 65.869215886 |
56969260 | jw01155-o003_t018_nircam | 150.315 | 1155 | POLYGON ICRS 268.948913393 65.883648560 268.862008496 65.888779990 268.848492791 65.853809603 268.935598638 65.847800619 |
56969340 | jw01155-o005_t018_nircam | 246.946 | 1155 | POLYGON ICRS 268.904185522 65.886606704 268.861731057 65.889173626 268.855283968 65.871971352 268.897743825 65.869212484 |
56969363 | jw01155-o007_t018_nircam | 4767.124 | 1155 | POLYGON ICRS 268.953551265 65.883344527 268.864318032 65.888753703 268.851066146 65.852035393 268.940174638 65.846633948 |
Exercise 3#
It’s time to apply all that you’ve learned! Write a non-positional query based on the following:
Fixed targets (HINT:
targtype='FIXED'
)Instument is Mid-Infrared Instrument (MIRI) or Fine Guidance Sensor (FGS)
Proposal type should NOT include General Observers (
GO
)Exposure type includes the string
'IMAGE'
Right ascension is between 70 and 75 degrees
Program number is less than 1200.
Skip the first 5 entries.
Select the following columns:
fileSetName
,targtype
,instrume
,proposal_type
,exp_type
,targ_ra
,program
# # A non-positional query with column criteria
# results = missions.query_criteria(...) # Write your query here!
# # Display results
# print(f'Total number of results: {len(results)}')
# results
Additional Resources#
Exercise Solutions#
Exercise 1#
# Query for Whirlpool Galaxy
results = missions.query_object('Whirlpool',
radius=1, # Search radius of 1 arcminute
offset=300, # Skip the first 300 rows
select_cols=['fileSetName', 'opticalElements'])
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 61
ArchiveFileID | fileSetName | opticalElements | s_region |
---|---|---|---|
int64 | str25 | str103 | str121 |
144284832 | jw03435008001_0210l_00003 | CH12;SHORT, CH34;SHORT, F770W | -- |
144283926 | jw03435008001_0210l_00004 | CH12;SHORT, CH34;SHORT, F770W | POLYGON ICRS 202.436247753 47.217452146 202.462884928 47.191799453 202.501022836 47.210063119 202.474394940 47.235724650 |
144284390 | jw03435008001_0210n_00001 | CH12;SHORT, CH34;SHORT, F770W | -- |
144284225 | jw03435008001_0210n_00002 | CH12;SHORT, CH34;SHORT, F770W | -- |
144283868 | jw03435008001_0210n_00003 | CH12;SHORT, CH34;SHORT, F770W | POLYGON ICRS 202.435540216 47.216831997 202.462177436 47.191179475 202.500314644 47.209443386 202.473686702 47.235104746 |
Exercise 2#
# Vega coordinates
vega = SkyCoord(279.23473, 38.78369, unit=('deg'))
# Query for datasets around Vega
results = missions.query_region(vega,
radius=15, # Search radius of 15 arcminutes
select_cols=['fileSetName', 'targprop', 'targ_ra', 'targ_dec'])
# Display the first 5 results
print(f'Total number of results: {len(results)}')
results[:5]
Total number of results: 59
ArchiveFileID | fileSetName | targprop | targ_ra | targ_dec | s_region |
---|---|---|---|---|---|
int64 | str25 | str20 | float64 | float64 | str121 |
139986910 | jw01193026001_02101_00001 | VEGA | 279.2364266145171 | 38.78556769656323 | POLYGON ICRS 279.221673372 38.783464345 279.235110746 38.771687075 279.250219841 38.782160787 279.236782989 38.793939787 |
139986914 | jw01193026001_02101_00002 | VEGA | 279.2364266153141 | 38.7855676974483 | POLYGON ICRS 279.217845954 38.787075674 279.231284731 38.775298906 279.246393949 38.785773182 279.232955693 38.797551680 |
139986894 | jw01193026001_02101_00003 | VEGA | 279.2364266161172 | 38.78556769833999 | POLYGON ICRS 279.222594065 38.789571903 279.236032521 38.777794586 279.251142971 38.788268244 279.237705038 38.800047292 |
139986886 | jw01193026001_02101_00004 | VEGA | 279.2364266169163 | 38.78556769922733 | POLYGON ICRS 279.225013814 38.786427568 279.238451269 38.774649968 279.253561416 38.785123308 279.240124484 38.796902638 |
139984754 | jw01193027001_02101_00001 | VEGA-COPY-MIRI-CORON | 279.2364266191411 | 38.78556770169765 | POLYGON ICRS 279.224083011 38.786614315 279.232077088 38.779700332 279.241453574 38.786140110 279.233480779 38.793084704 |
Exercise 3#
# A non-positional query with column criteria
results = missions.query_criteria(targtype='FIXED', # Fixed target
instrume='MIRI, FGS', # Select MIRI and FGS observations
proposal_type='!GO', # Not from a general observer proposal
exp_type='*IMAGE*', # Contains the string "IMAGE"
targ_ra='70..75', # Between 70 and 75
program='<1200', # Less than 1200
offset=5, # Skip the first 5 results
select_cols=['fileSetName', 'targtype', 'instrume', 'proposal_type',
'exp_type', 'targ_ra', 'program'])
# Display results
print(f'Total number of results: {len(results)}')
results
Total number of results: 0
ArchiveFileID | fileSetName | targ_ra | instrume | exp_type | program | proposal_type | targtype | s_region |
---|---|---|---|---|---|---|---|---|
int64 | str1 | float64 | str1 | str1 | int64 | str1 | str1 | str1 |
Citations#
If you use astroquery
for published research, please cite the
authors. Follow these links for more information about citing astroquery
:
About this Notebook#
Author(s): Sam Bianco
Keyword(s): Tutorial, JWST, Astroquery, MastMissions
First published: June 2024
Last updated: June 2024