Skip to content

Commit

Permalink
add mast download for specific file suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ell Bogat committed Dec 4, 2024
1 parent 7fd38d5 commit a089665
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spaceKLIP/psflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,24 @@ def get_sciref_files(sci_target, refdb, idir=None,
def download_mast(ref_db,token=None,
overwrite=False,exists_ok=True,
progress=False, verbose=False,
suffix=None, # e.g. 'calints'
base_dir=os.path.join('DATA','MAST_DOWNLOAD')):

for fname in list(ref_db.FILENAME):
fnames = list(ref_db.FILENAME)

# Update file suffix if provided
if not suffix == None:
new_suffix = suffix.strip('_')

for ff,fname in enumerate(fnames):
fname_split = fname.split('_')
new_fname = '_'.join(fname_split[:-1]) + f'_{new_suffix}.fits'

fnames[ff] = new_fname

# Download each file
for fname in fnames:

mast.get_mast_filename(fname,
outputdir=base_dir,
overwrite=overwrite, exists_ok=exists_ok,
Expand Down

0 comments on commit a089665

Please sign in to comment.