Skip to content

Commit

Permalink
Switching CRDS bestrefs call from subprocess shell call to the crds.a…
Browse files Browse the repository at this point in the history
…ssign_bestrefs() function based on Bandit security scan results.
  • Loading branch information
sean-lockwood committed Feb 3, 2025
1 parent b966413 commit 2ef7fe8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"from drizzlepac import tweakreg\n",
"from drizzlepac import astrodrizzle as ad\n",
"from astroquery.mast import Observations\n",
"from crds import assign_bestrefs\n",
"\n",
"# Custom package, copy_files.py should be in the same directory\n",
"import copy_files as cf\n",
Expand Down Expand Up @@ -416,7 +417,7 @@
"source": [
"## Download Reference Files\n",
"\n",
"The reference files for the STIS images are then updated in the image headers and downloaded (~250 MB). While the `crds.bestrefs` tool is also accessible inside of Python, it was designed with a command line interface in mind, therefore it is easiest to use it this way."
"The reference files for the STIS images are then updated in the image headers and downloaded (~250 MB). [The `crds.bestrefs` tool](https://hst-crds.stsci.edu/docs/cmdline_bestrefs/) is also accessible from the command line interface."
]
},
{
Expand All @@ -429,8 +430,9 @@
"# Find and update the headers with the best reference files and download them\n",
"def download_ref_files(image_list):\n",
" print('Downloading reference files for:\\n{}\\n'.format(image_list))\n",
" images = ' '.join(image_list)\n",
" subprocess.check_output('crds bestrefs --files {} --sync-references=1 --update-bestrefs'.format(images), shell=True, stderr=subprocess.DEVNULL)\n",
" errors = assign_bestrefs(image_list, sync_references=True, verbosity=-1)\n",
" if len(errors) > 0:\n",
" raise ValueError('Unexpected error(s) running CRDS assign_bestrefs script.')\n",
"\n",
"\n",
"# Check in the Notebook directory\n",
Expand Down

0 comments on commit 2ef7fe8

Please sign in to comment.