Skip to content

Commit

Permalink
add auto download of OPDS as needed for trending plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrin committed Apr 2, 2024
1 parent ea86eea commit 229f978
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions webbpsf/trending.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
import poppy
import webbpsf

def _read_opd(filename):
"""Trivial utilty function to read OPD from a WSS-output FITS file"""
def _read_opd(filename, auto_download=True):
"""Trivial utilty function to read OPD from a WSS-output FITS file
If the file does not exist locally, try to retrieve it from MAST automatically."""
full_file_path = os.path.join(webbpsf.utils.get_webbpsf_data_path(), 'MAST_JWST_WSS_OPDs', filename)
if not os.path.exists(full_file_path) and auto_download:
webbpsf.mast_wss.mast_retrieve_opd(filename)
opdhdu = fits.open(full_file_path)
opd = opdhdu[1].data.copy()
return opd, opdhdu
Expand Down

0 comments on commit 229f978

Please sign in to comment.