Skip to content

Commit

Permalink
Merge pull request #145 from FDauphin/add_calwf3_recal_tvb
Browse files Browse the repository at this point in the history
Add calwf3 recal tvb
  • Loading branch information
FDauphin authored Nov 27, 2023
2 parents 99af657 + 4865a58 commit 4155d24
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
12 changes: 12 additions & 0 deletions notebooks/WFC3/calwf3_recalibration/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
This Jupyter notebook provides `calwf3` reprocessing examples to improve calibrated WFC3/IR images affected by time-variable background (TVB). The notebook shows how to diagnose images with poor-quality ramp fits and rerun `calwf3` with the 'CRCORR' step turned off. This method is described as the 'Last-minus-first' technique [WFC3 ISR 2016-16](https://www.stsci.edu/files/live/sites/www/files/home/hst/instrumentation/wfc3/documentation/instrument-science-reports-isrs/_documents/2016/WFC3-2016-16.pdf). See Section 3.5.2 of the [WFC3 Data Handbook](https://hst-docs.stsci.edu/wfc3dhb) for more information.

Dependencies:

Install the necessary packages using the pre-requirements.sh and requirements.txt:

bash pre-requirements.sh
pip install -r requirements.txt

If necessary, also install jupyter notebook:

pip install notebook

21 changes: 11 additions & 10 deletions notebooks/WFC3/calwf3_recalibration/calwf3_recal_tvb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"<a id=\"imports\"></a>\n",
"## 1. Imports\n",
"\n",
"This notebook assumes you have created the virtual environment in [WFC3 Library's](https://github.com/spacetelescope/WFC3Library) installation instructions.\n",
"This notebook assumes you have installed the required libraries as described [here](https://github.com/spacetelescope/hst_notebooks/tree/main/notebooks/WFC3/calwf3_recalibration).\n",
"\n",
"We import:\n",
"- *glob* for finding lists of files\n",
Expand Down Expand Up @@ -122,8 +122,9 @@
"science_files = glob.glob('data/mastDownload/HST/*/*fits')\n",
"\n",
"for im in science_files:\n",
" root = im.split('/')[-1]\n",
" os.rename(im, './'+root)\n",
" root = os.path.basename(im)\n",
" new_path = os.path.join('.', root)\n",
" os.rename(im, new_path)\n",
"\n",
"data_directory = './data'\n",
"\n",
Expand Down Expand Up @@ -389,14 +390,14 @@
"metadata": {},
"outputs": [],
"source": [
"os.mkdir('orig/')\n",
"os.makedirs('orig/', exist_ok=True)\n",
"\n",
"for imas in glob.glob('ibohbf*_ima.fits'):\n",
" shutil.move(imas, 'orig/')\n",
"for flts in glob.glob('ibohbf*_flt.fits'):\n",
" shutil.move(flts, 'orig/') \n",
"for driz in glob.glob('ibohbf*_drz.fits'):\n",
" shutil.move(driz, 'orig/') "
"for file_pattern in ['ibohbf*_ima.fits', 'ibohbf*_flt.fits', 'ibohbf*_drz.fits']:\n",
" for file in glob.glob(file_pattern):\n",
" destination_path = os.path.join('orig', os.path.basename(file))\n",
" if os.path.isfile(destination_path):\n",
" os.remove(destination_path)\n",
" shutil.move(file, destination_path) "
]
},
{
Expand Down

0 comments on commit 4155d24

Please sign in to comment.