Skip to main content

Python tools for querying the MAST Archive

Project description

MASTQUERY

User-friendly tools for using the MAST Mashup API (https://mast.stsci.edu/api/v0/index.html)

Installation:

# From PIP
pip install mastquery

# *OR* from latest version of the respository
git clone https://github.com/gbrammer/mastquery.git
cd mastquery
pip install . 

Demo:

See also demo.ipynb.

>>> from mastquery import query, fetch

### Query associations
>>> tab = query.run_query(box=None, proposal_id=[11359],
                         instruments=['WFC3/IR'], 
                         filters=['G141'],
                         base_query=query.DEFAULT_QUERY)

>>> print(tab['obs_id', 'filter', 'exptime', 'proposal_id'])
  obs_id   filter  exptime  proposal_id
========   ======  =======  ===========
ib6o23010   G141    4211.7        11359

### Data products
>>> prod = query.get_products_table(tab, extensions=['RAW'])

>>> print(prod['observation_id', 'filter', 'productFilename'])
observation_id filter  productFilename  
============== ====== ==================
     ib6o23rsq   G141 ib6o23rsq_raw.fits
     ib6o23ruq   G141 ib6o23ruq_raw.fits
     ib6o23ryq   G141 ib6o23ryq_raw.fits
     ib6o23s0q   G141 ib6o23s0q_raw.fits
     
### Fetch products
>>> s3_lines = fetch.make_curl_script(prod, script_name=None, s3_sync=True)
>>> print(s3_lines[0])
aws s3 sync --request-payer requester --exclude="*.*" --include="*raw.fits" s3://stpubdata/hst/public/ib6o/ib6o23rsq/ .//

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mastquery-1.8.1.tar.gz (304.7 kB view details)

Uploaded Source

File details

Details for the file mastquery-1.8.1.tar.gz.

File metadata

  • Download URL: mastquery-1.8.1.tar.gz
  • Upload date:
  • Size: 304.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for mastquery-1.8.1.tar.gz
Algorithm Hash digest
SHA256 f6c8e2c30bc4b06d1274b8624d71f1a3ded6d8ee51da1f42f83413302e802cc6
MD5 62f3c78301a5c56d8704363cf9fab151
BLAKE2b-256 a8f015ceaa11f416bb23e37c2ffe4daf5e400e0f5abaf7f0f01d7d67a89b98a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page