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]
Table length=10
namedata_typedescription
str17str9str1594
search_posstringSearch Position (RA and Dec)
ArchiveFileIDintegerArchiveFileID
fileSetNamestringOf 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
productLevelstringProduct levels, 1b is an Uncal FITS file, 2a = Countrate exposure, 2b = calibrated exposure, 2c = cosmic-ray-flagged exposure, and 3 = combined data.
targpropstringProposer prefered name for the target
targnamestringStandard astronomical catalog name for the target
targ_raraRight Ascension (J2000), from 0 to 360, in degrees
targ_decdecDeclination (J2000), from -90 to +90, in degrees
instrumestringIdentifies the instrument used to acquire the data.
exp_typestringExposure 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
Table masked=True length=5
ArchiveFileIDfileSetNameproductLeveltargproptarg_ratarg_decinstrumeexp_typeopticalElementsdate_obsdurationprogramobservtnvisitpublicReleaseDatepi_nameproposal_typeproposal_cycletargtypeaccessang_seps_region
int64str25str14str18float64float64str6str9str77str27float64int64int64int64str19str10str2int64str5str6float64str117
140969955jw01714001001_02101_000011b, 2a, 2b, 2cCRAB-NEBULA83.6360495833333322.01641666666667MIRIMIR_IMAGEF560W2023-02-24T00:50:42.9710000138.7521714112024-02-24T13:30:27Temim, TeaGO1FIXEDPUBLIC1.0970509857770536POLYGON ICRS 83.651895783 22.020165846 83.685738447 22.019090702 83.686913614 22.050772495 83.653063383 22.051847880
140969441jw01714001001_02101_000021b, 2a, 2b, 2cCRAB-NEBULA83.6360495833333322.01641666666667MIRIMIR_IMAGEF560W2023-02-24T00:54:27.7390000138.7521714112024-02-24T13:33:03Temim, TeaGO1FIXEDPUBLIC0.8253462827989163POLYGON ICRS 83.646857347 22.020496034 83.680700125 22.019421805 83.681874298 22.051103630 83.648023954 22.052178100
140970303jw01714001001_02101_000031b, 2a, 2b, 2cCRAB-NEBULA83.6360495833333322.01641666666667MIRIMIR_IMAGEF560W2023-02-24T00:58:07.0030000138.7521714112024-02-24T13:32:24Temim, TeaGO1FIXEDPUBLIC0.9607116035272403POLYGON ICRS 83.647661363 22.024897630 83.681505187 22.023823259 83.682679551 22.055505079 83.648828160 22.056579690
140969487jw01714001001_02101_000041b, 2a, 2b, 2cCRAB-NEBULA83.6360495833333322.01641666666667MIRIMIR_IMAGEF560W2023-02-24T01:01:46.2660000138.7521714112024-02-24T13:33:18Temim, TeaGO1FIXEDPUBLIC1.1368712452489975POLYGON ICRS 83.651520724 22.024094493 83.685364325 22.023019302 83.686539577 22.054701093 83.652688408 22.055776525
140970598jw01714001001_02103_000011b, 2a, 2b, 2cCRAB-NEBULA83.6360495833333322.01641666666667MIRIMIR_IMAGEF1130W2023-02-24T01:07:30.3500000105.4521714112024-02-24T13:34:12Temim, TeaGO1FIXEDPUBLIC1.0962220337763038POLYGON 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) and targ_dec (declination). By default, the query returns all datasets that fall within 3 arcminutes from the object’s coordinates. Let’s set the radius 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. The ArchiveFileID 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
Table masked=True length=5
ArchiveFileIDfileSetNametargpropdate_obss_region
int64str25str18str27str117
140967908jw01714001001_02105_00002CRAB-NEBULA2023-02-24T01:23:47.1870000POLYGON ICRS 83.646836411 22.020511240 83.680679192 22.019437014 83.681853361 22.051118839 83.648003014 22.052193305
140968840jw01714001001_02105_00003CRAB-NEBULA2023-02-24T01:25:40.9790000POLYGON ICRS 83.647640608 22.024913016 83.681484434 22.023838623 83.682658823 22.055520441 83.648807429 22.056595075
140969064jw01714001001_02107_00002CRAB-NEBULA2023-02-24T01:33:35.5030000POLYGON ICRS 83.646850658 22.020498367 83.680693435 22.019424131 83.681867616 22.051105955 83.648017272 22.052180431
140968989jw01714001001_02107_00003CRAB-NEBULA2023-02-24T01:36:24.7820000POLYGON ICRS 83.647654834 22.024900130 83.681498658 22.023825747 83.682673036 22.055507566 83.648821644 22.056582189
140968684jw01714001002_02101_00002CRAB-NEBULA2023-02-24T01:53:56.5670000POLYGON 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
Table masked=True length=5
ArchiveFileIDfileSetNameproductLeveltargproptarg_ratarg_decinstrumeexp_typeopticalElementsdate_obsdurationprogramobservtnvisitpublicReleaseDatepi_nameproposal_typeproposal_cycletargtypeaccessang_seps_region
int64str31str14str25float64float64str7str17str89str27float64int64int64int64str19str25str6int64str7str16float64str121
143245453jw01995001001_02101_000011b, 2a, 2b, 2cMESSIER-101210.87646554.36092777777778NIRCAMNRC_IMAGEF115W;CLEAR, F444W;CLEAR2023-05-30T15:23:35.5330000311.3661995112024-05-30T23:55:17Freedman, Wendy L.GO1FIXEDPUBLIC0.9317195976624251POLYGON ICRS 210.827993572 54.354715688 210.864844544 54.325657806 210.914875889 54.347195624 210.878040993 54.376268745
143248342jw01995001001_02101_000021b, 2a, 2b, 2cMESSIER-101210.87646554.36092777777778NIRCAMNRC_IMAGEF115W;CLEAR, F444W;CLEAR2023-05-30T15:30:23.4690000311.3661995112024-05-30T23:56:39Freedman, Wendy L.GO1FIXEDPUBLIC0.9247099787034783POLYGON ICRS 210.895598212 54.383166871 210.932406715 54.354011954 210.982639688 54.375509952 210.945847598 54.404680147
143248633jw01995001001_02101_000031b, 2a, 2b, 2cMESSIER-101210.87646554.36092777777778NIRCAMNRC_IMAGEF115W;CLEAR, F444W;CLEAR2023-05-30T15:37:00.7800000311.3661995112024-05-30T23:58:44Freedman, Wendy L.GO1FIXEDPUBLIC0.9387390545558567POLYGON ICRS 210.853452937 54.366244061 210.871650908 54.351711621 210.896510323 54.362275300 210.878316469 54.376811479
143247692jw01995001001_02201_000011b, 2a, 2b, 2cMESSIER-101210.87646554.36092777777778NIRISSNIS_IMAGECLEAR;F115W2023-05-30T15:23:38.9100000311.3661995112024-05-30T23:55:55Freedman, Wendy L.GO1FIXEDPUBLIC7.239582698074742POLYGON ICRS 210.913934950 54.462978815 210.951558106 54.432634381 211.003204113 54.454479744 210.965638042 54.484823939
143248409jw01995001001_02201_000021b, 2a, 2b, 2cMESSIER-101210.87646554.36092777777778NIRISSNIS_IMAGECLEAR;F115W2023-05-30T15:30:26.3340000311.3661995112024-05-30T23:55:49Freedman, Wendy L.GO1FIXEDPUBLIC7.233995178717605POLYGON 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
Table masked=True length=5
ArchiveFileIDfileSetNameinstrumeexp_typeprogrampi_names_region
int64str25str6str13int64str17str121
159785580jw01189010001_02101_00001NIRCAMNRC_IMAGE1189Roellig, Thomas LPOLYGON ICRS 277.137659247 26.861105196 277.149069743 26.846465320 277.165479951 26.856643631 277.154070551 26.871284825
159785419jw01189010001_02101_00002NIRCAMNRC_IMAGE1189Roellig, Thomas LPOLYGON ICRS 277.137238152 26.858825348 277.148648325 26.844185414 277.165058265 26.854363641 277.153649189 26.869004893
159785131jw01189010001_02101_00003NIRCAMNRC_IMAGE1189Roellig, Thomas LPOLYGON ICRS 277.149235325 26.841068963 277.160604381 26.826745837 277.176674629 26.836900318 277.165306586 26.851224729
159784821jw01189010001_02101_00004NIRCAMNRC_IMAGE1189Roellig, Thomas LPOLYGON ICRS 277.148813871 26.838789939 277.160182758 26.824466851 277.176252641 26.834621385 277.164884766 26.848945758
159784825jw01189010001_04101_00001NIRCAMNRC_IMAGE1189Roellig, Thomas LPOLYGON 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
Table masked=True length=5
ArchiveFileIDfileSetNameinstrumeexp_typeprogrampi_names_region
int64str31str7str17int64str17str121
159776343jw01189001001_02101_00001NIRSPECNRS_WATA1189Roellig, Thomas LPOLYGON ICRS 57.028706395 -60.379718866 57.029996917 -60.379034437 57.028628460 -60.378418399 57.027338468 -60.379103025
159776754jw01189001001_02101_00002NIRSPECNRS_TACONFIRM1189Roellig, Thomas LPOLYGON ICRS 57.028868144 -60.379725520 57.030158663 -60.379041090 57.028790202 -60.378425054 57.027500214 -60.379109681
159777067jw01189001001_04101_00001NIRSPECNRS_FIXEDSLIT1189Roellig, Thomas L--
159777116jw01189001001_04101_00002NIRSPECNRS_FIXEDSLIT1189Roellig, Thomas L--
159776883jw01189001001_04101_00003NIRSPECNRS_FIXEDSLIT1189Roellig, 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]
Table masked=True length=0
ArchiveFileIDfileSetNameinstrumeexp_typeprogrampi_names_region
int64str1str1str1int64str1str1

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
Table masked=True length=0
ArchiveFileIDfileSetNameinstrumeexp_typeprogrampi_nametargtypes_region
int64str1str1str1int64str1str1str1

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
Table masked=True length=7
ArchiveFileIDfileSetNamedate_obsprograms_region
int64str25str27int64str117
152901340jw01173001001_02101_000012022-01-28T14:23:42.04200001173POLYGON ICRS 49.866458426 43.426050483 49.866462762 43.425157226 49.865029698 43.425149829 49.865043995 43.426048206
152901354jw01173002001_02101_000012022-01-28T14:36:53.56700001173POLYGON ICRS 49.872292426 43.425849207 49.872296668 43.424955949 49.870863608 43.424948633 49.870878000 43.425847008
152900094jw01173003001_02101_000012022-01-28T15:00:36.65500001173POLYGON ICRS 49.833254104 43.387235046 49.830519212 43.418878447 49.873596213 43.420536706 49.876213947 43.389178421
152899998jw01173004001_02101_000012022-01-28T15:09:07.18300001173POLYGON ICRS 49.871715919 43.425730091 49.871720169 43.424836834 49.870287112 43.424829510 49.870301495 43.425727886
152900368jw01173005001_02101_000012022-01-28T15:26:28.45400001173POLYGON ICRS 49.871724403 43.425719555 49.871728653 43.424826298 49.870295596 43.424818974 49.870309979 43.425717350
152900392jw01173006001_02101_000012022-01-28T15:34:23.46900001173POLYGON ICRS 49.871738741 43.425735307 49.871742991 43.424842050 49.870309933 43.424834727 49.870324317 43.425733103
152900285jw01173007001_02101_000012022-01-28T15:43:44.30100001173POLYGON 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
Table masked=True length=77
ArchiveFileIDfileSetNamedurationprograms_region
int64str25float64int64str121
56863803jw01151001001_02101_00001203.9991151POLYGON ICRS 267.905935489 74.594343945 267.773467483 74.601350652 267.745808425 74.566718890 267.878307607 74.558837777
56863873jw01151001001_02101_00002203.9991151POLYGON ICRS 267.844834919 74.586434115 267.712406428 74.593404722 267.684894677 74.558765447 267.817357659 74.550920433
56863512jw01151001001_03101_00001214.7351151POLYGON ICRS 268.091803329 74.608826495 267.943092794 74.616030022 267.912318626 74.578289816 268.058609787 74.570410560
56863800jw01151001001_05101_00001203.9991151POLYGON ICRS 267.893660571 74.575935751 267.827945499 74.579618578 267.813949853 74.562328771 267.879750360 74.558389483
56863856jw01151001001_05101_00002203.9991151POLYGON ICRS 267.844835056 74.586433898 267.712406430 74.593404320 267.684895365 74.558765007 267.817358498 74.550920178
56863823jw01151001001_06101_00001214.7351151POLYGON ICRS 268.091803198 74.608826549 267.943092604 74.616029989 267.912318750 74.578289765 268.058609977 74.570410594
56863853jw01151001001_08101_00001203.9991151POLYGON ICRS 267.888160436 74.568517327 267.822479644 74.572204521 267.808474310 74.554915646 267.874240304 74.550971983
56875469jw01151020001_03101_00001214.7351151POLYGON ICRS 241.403250845 62.406808505 241.320362209 62.395214146 241.341730845 62.357890793 241.424148058 62.368600633
56876309jw01151021001_02102_00001118.1041151POLYGON ICRS 267.911184344 74.593885726 267.779710230 74.602107984 267.747538661 74.567745622 267.878954411 74.558651139
...............
56968427jw01155005001_0210a_00002150.3151155POLYGON ICRS 268.950135910 65.884115362 268.906969346 65.886595235 268.900599994 65.869182640 268.943757497 65.866457203
56968592jw01155005001_0210b_00001150.3151155POLYGON ICRS 268.904202937 65.886650584 268.861748404 65.889217517 268.855301278 65.872015244 268.897761202 65.869256365
56968483jw01155005001_0210b_00002150.3151155POLYGON ICRS 268.943349832 65.865093564 268.900189303 65.867843084 268.893331493 65.850380419 268.936597351 65.847374789
56967461jw01155007001_02102_000011191.7811155POLYGON ICRS 268.900739876 65.867352239 268.858053923 65.870127601 268.851284097 65.852675278 268.893941782 65.849901802
56967484jw01155007001_02103_000011191.7811155POLYGON ICRS 268.907588088 65.885890374 268.865082464 65.888560682 268.858558271 65.871177748 268.901035787 65.868509248
56967455jw01155007001_02104_000011191.7811155POLYGON ICRS 268.953444161 65.883351054 268.910226105 65.885970032 268.903835023 65.868311189 268.947024000 65.865694013
56969427jw01155-o001_t018_nircam246.9461155POLYGON ICRS 268.904172965 65.886609810 268.861719200 65.889178683 268.855267376 65.871976705 268.897726480 65.869215886
56969260jw01155-o003_t018_nircam150.3151155POLYGON ICRS 268.948913393 65.883648560 268.862008496 65.888779990 268.848492791 65.853809603 268.935598638 65.847800619
56969340jw01155-o005_t018_nircam246.9461155POLYGON ICRS 268.904185522 65.886606704 268.861731057 65.889173626 268.855283968 65.871971352 268.897743825 65.869212484
56969363jw01155-o007_t018_nircam4767.1241155POLYGON 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
Table masked=True length=5
ArchiveFileIDfileSetNameopticalElementss_region
int64str25str103str121
144284832jw03435008001_0210l_00003CH12;SHORT, CH34;SHORT, F770W--
144283926jw03435008001_0210l_00004CH12;SHORT, CH34;SHORT, F770WPOLYGON ICRS 202.436247753 47.217452146 202.462884928 47.191799453 202.501022836 47.210063119 202.474394940 47.235724650
144284390jw03435008001_0210n_00001CH12;SHORT, CH34;SHORT, F770W--
144284225jw03435008001_0210n_00002CH12;SHORT, CH34;SHORT, F770W--
144283868jw03435008001_0210n_00003CH12;SHORT, CH34;SHORT, F770WPOLYGON 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
Table masked=True length=5
ArchiveFileIDfileSetNametargproptarg_ratarg_decs_region
int64str25str20float64float64str121
139986910jw01193026001_02101_00001VEGA279.236426614517138.78556769656323POLYGON ICRS 279.221673372 38.783464345 279.235110746 38.771687075 279.250219841 38.782160787 279.236782989 38.793939787
139986914jw01193026001_02101_00002VEGA279.236426615314138.7855676974483POLYGON ICRS 279.217845954 38.787075674 279.231284731 38.775298906 279.246393949 38.785773182 279.232955693 38.797551680
139986894jw01193026001_02101_00003VEGA279.236426616117238.78556769833999POLYGON ICRS 279.222594065 38.789571903 279.236032521 38.777794586 279.251142971 38.788268244 279.237705038 38.800047292
139986886jw01193026001_02101_00004VEGA279.236426616916338.78556769922733POLYGON ICRS 279.225013814 38.786427568 279.238451269 38.774649968 279.253561416 38.785123308 279.240124484 38.796902638
139984754jw01193027001_02101_00001VEGA-COPY-MIRI-CORON279.236426619141138.78556770169765POLYGON 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
Table masked=True length=0
ArchiveFileIDfileSetNametarg_rainstrumeexp_typeprogramproposal_typetargtypes_region
int64str1float64str1str1int64str1str1str1

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


Top of Page Space Telescope Logo