diff --git a/_config.yml b/_config.yml
index 4f6d90f6a..7fb0b4692 100644
--- a/_config.yml
+++ b/_config.yml
@@ -57,6 +57,7 @@ exclude_patterns: [notebooks/DrizzlePac/align_mosaics/align_mosaics.ipynb,
notebooks/WFC3/ir_ima_visualization/IR_IMA_Visualization_with_an_Example_of_Time_Variable_Background.ipynb,
notebooks/WFC3/ir_scattered_light_calwf3_corrections/Correcting_for_Scattered_Light_in_IR_Exposures_Using_calwf3_to_Mask_Bad_Reads.ipynb,
notebooks/WFC3/ir_scattered_light_manual_corrections/Correcting_for_Scattered_Light_in_IR_Exposures_by_Manually_Subtracting_Bad_Reads.ipynb,
+ notebooks/WFC3/photometry_examples/phot_examples.ipynb,
notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb,
notebooks/WFC3/uvis_time_dependent_photometry/uvis_timedep_phot.ipynb,
notebooks/WFC3/zeropoints/zeropoints.ipynb]
diff --git a/_toc.yml b/_toc.yml
index ab120a711..cc28e3375 100644
--- a/_toc.yml
+++ b/_toc.yml
@@ -72,8 +72,8 @@ parts:
# - file: notebooks/WFC3/ir_scattered_light_calwf3_corrections/Correcting_for_Scattered_Light_in_IR_Exposures_Using_calwf3_to_Mask_Bad_Reads.ipynb
# - file: notebooks/WFC3/ir_scattered_light_manual_corrections/Correcting_for_Scattered_Light_in_IR_Exposures_by_Manually_Subtracting_Bad_Reads.ipynb
- file: notebooks/WFC3/persistence/wfc3_ir_persistence.ipynb
+ - file: notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb
- file: notebooks/WFC3/photometry_examples/phot_examples.ipynb
-# - file: notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb
- file: notebooks/WFC3/uvis_pam_corrections/WFC3_UVIS_Pixel_Area_Map_Corrections_for_Subarrays.ipynb
# - file: notebooks/WFC3/uvis_time_dependent_photometry/uvis_timedep_phot.ipynb
# - file: notebooks/WFC3/zeropoints/zeropoints.ipynb
diff --git a/notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb b/notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb
index d7a07f328..f8fe56f3d 100644
--- a/notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb
+++ b/notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.ipynb
@@ -12,7 +12,7 @@
"# Correcting for Helium Line Emission Background in IR Exposures using the \"Flatten-Ramp\" Technique\n",
"***\n",
"## Learning Goals\n",
- "This notebook shows how to identify IR exposures with time-variable Helium (1.083 micron) line emission background, and how to correct for it using the \"flatten-ramp\" technique. This method can be used to correct images affected by a sky background that does not vary across the field of view. For recommendations on correcting for spatially variable background due to scattered light, see the [IR IMA Visualization Notebook](https://github.com/spacetelescope/WFC3Library/tree/master/notebooks/ir_ima_visualization) (O'Connor 2023).\n",
+ "This notebook shows how to identify IR exposures with time-variable Helium (1.083 micron) line emission background, and how to correct for it using the \"flatten-ramp\" technique. This method can be used to correct images affected by a sky background that does not vary across the field of view. For recommendations on correcting for spatially variable background due to scattered light, see the [IR IMA Visualization Notebook](https://github.com/spacetelescope/hst_notebooks/tree/main/notebooks/WFC3/ir_ima_visualization) (O'Connor 2023).\n",
"\n",
"By the end of this tutorial, you will be able to:\n",
"\n",
@@ -128,19 +128,19 @@
},
"outputs": [],
"source": [
- "import os \n",
- "import glob \n",
+ "import os\n",
+ "import glob\n",
"import shutil\n",
"\n",
- "import numpy as np\n",
- "import pandas as pd\n",
- "import matplotlib.pyplot as plt\n",
- "%matplotlib inline\n",
- "\n",
"from astropy.io import fits\n",
"from astroquery.mast import Observations\n",
"from ccdproc import ImageFileCollection\n",
- "import wfc3tools\n"
+ "import wfc3tools\n",
+ "\n",
+ "import numpy as np\n",
+ "import pandas as pd\n",
+ "import matplotlib.pyplot as plt\n",
+ "%matplotlib inline"
]
},
{
@@ -162,16 +162,17 @@
"metadata": {},
"outputs": [],
"source": [
- "data_list = Observations.query_criteria(obs_id='IBOHBF*');\n",
- "Observations.download_products(data_list['obsid'],project='CALWF3',mrp_only=False,download_dir='./data',\n",
- " productSubGroupDescription=['ASN','RAW','IMA','FLT']);\n",
- "\n",
- "science_files = glob.glob('data/mastDownload/HST/*/*fits');\n",
+ "data_list = Observations.query_criteria(obs_id='IBOHBF*')\n",
+ "Observations.download_products(data_list['obsid'], project='CALWF3', mrp_only=False, download_dir='./data',\n",
+ " productSubGroupDescription=['ASN', 'RAW', 'IMA', 'FLT'])\n",
"\n",
+ "science_files = glob.glob(\"data/mastDownload/HST/*/*fits\")\n",
"for im in science_files:\n",
- " root = im.split('/')[-1];\n",
- " os.rename(im,'./'+root);\n",
- "shutil.rmtree('data/');"
+ " root = os.path.basename(im)\n",
+ " new_path = os.path.join(\"./\", root)\n",
+ " os.rename(im, new_path)\n",
+ "\n",
+ "shutil.rmtree(\"data/\")"
]
},
{
@@ -187,9 +188,13 @@
"metadata": {},
"outputs": [],
"source": [
+ "# printing observation conditions for visits used\n",
"collec = ImageFileCollection('./',\n",
- " keywords=[\"asn_id\",\"targname\",\"filter\",\"samp_seq\",\"nsamp\",\"exptime\",\n",
- " \"postarg1\",\"postarg2\",\"date-obs\",\"time-obs\",], glob_include=\"*flt.fits\", ext=0)\n",
+ " keywords=[\"asn_id\", \"targname\", \"filter\",\n",
+ " \"samp_seq\", \"nsamp\", \"exptime\",\n",
+ " \"postarg1\", \"postarg2\", \"date-obs\",\n",
+ " \"time-obs\"],\n",
+ " glob_include=\"*flt.fits\", ext=0)\n",
"out_table = collec.summary\n",
"out_table"
]
@@ -227,19 +232,19 @@
"metadata": {},
"outputs": [],
"source": [
- "flt1=fits.getdata('ibohbfb7q_flt.fits',ext=1)\n",
- "flt2=fits.getdata('ibohbfb9q_flt.fits',ext=1)\n",
+ "flt1 = fits.getdata('ibohbfb7q_flt.fits', ext=1)\n",
+ "flt2 = fits.getdata('ibohbfb9q_flt.fits', ext=1)\n",
"\n",
- "fig=plt.figure(figsize=(20,8))\n",
- "ax1=fig.add_subplot(1,2,1)\n",
- "ax2=fig.add_subplot(1,2,2)\n",
+ "fig = plt.figure(figsize=(20, 8))\n",
+ "ax1 = fig.add_subplot(1, 2, 1)\n",
+ "ax2 = fig.add_subplot(1, 2, 2)\n",
"\n",
- "A = ax1.imshow(flt1, vmin=0.25,vmax=1.25,cmap='Greys_r',origin='lower')\n",
- "B = ax2.imshow(flt2, vmin=1.25,vmax=2.25,cmap='Greys_r',origin='lower')\n",
- "ax1.set_title('ibohbfb7q (Linear Bkg)',fontsize=20)\n",
- "ax2.set_title('ibohbfb9q (Time Variable Bkg)',fontsize=20)\n",
- "fig.colorbar(A,ax=ax1)\n",
- "fig.colorbar(B,ax=ax2)"
+ "A = ax1.imshow(flt1, vmin=0.25, vmax=1.25, cmap='Greys_r', origin='lower')\n",
+ "B = ax2.imshow(flt2, vmin=1.25, vmax=2.25, cmap='Greys_r', origin='lower')\n",
+ "ax1.set_title('ibohbfb7q (Linear Bkg)', fontsize=20)\n",
+ "ax2.set_title('ibohbfb9q (Time Variable Bkg)', fontsize=20)\n",
+ "fig.colorbar(A, ax=ax1)\n",
+ "fig.colorbar(B, ax=ax2)"
]
},
{
@@ -262,15 +267,15 @@
"flt1f = flt1.flatten()\n",
"flt2f = flt2.flatten()\n",
"\n",
- "fig=plt.figure(figsize=(20,5))\n",
- "ax1=fig.add_subplot(1,2,1)\n",
- "ax2=fig.add_subplot(1,2,2)\n",
+ "fig = plt.figure(figsize=(20, 5))\n",
+ "ax1 = fig.add_subplot(1, 2, 1)\n",
+ "ax2 = fig.add_subplot(1, 2, 2)\n",
"\n",
- "n, bins, patches = ax1.hist(flt1f,bins=200,range=(0,1))\n",
- "n, bins, patches = ax2.hist(flt2f,bins=200,range=(1,2))\n",
+ "n, bins, patches = ax1.hist(flt1f, bins=200, range=(0, 1))\n",
+ "n, bins, patches = ax2.hist(flt2f, bins=200, range=(1, 2))\n",
"\n",
- "ax1.set_title('ibohbfb7q (Linear Bkg)',fontsize=15)\n",
- "ax2.set_title('ibohbfb9q (Time Variable Bkg)',fontsize=15)"
+ "ax1.set_title('ibohbfb7q (Linear Bkg)', fontsize=15)\n",
+ "ax2.set_title('ibohbfb9q (Time Variable Bkg)', fontsize=15)"
]
},
{
@@ -296,13 +301,13 @@
"metadata": {},
"outputs": [],
"source": [
- "imafiles = ('ibohbfb7q_ima.fits','ibohbfb9q_ima.fits')\n",
- "fig, axarr = plt.subplots(1,2,figsize=(15,5))\n",
+ "imafiles = ('ibohbfb7q_ima.fits', 'ibohbfb9q_ima.fits')\n",
+ "fig, axarr = plt.subplots(1, 2, figsize=(15, 5))\n",
"fig.set_dpi(100)\n",
"\n",
"for i, ima in enumerate(imafiles):\n",
- " time, counts = wfc3tools.pstat(ima,stat='midpt',units='counts',plot=False)\n",
- " axarr[i].plot(time,counts,'+',markersize=8)\n",
+ " time, counts = wfc3tools.pstat(ima, stat='midpt', units='counts', plot=False)\n",
+ " axarr[i].plot(time, counts, '+', markersize=8)\n",
" axarr[i].set_title(ima)\n",
" axarr[i].set_xlabel('Exposure Time (s)')\n",
" axarr[i].set_ylabel('Counts (e-)')"
@@ -322,14 +327,14 @@
"metadata": {},
"outputs": [],
"source": [
- "imafiles = ('ibohbfb7q_ima.fits','ibohbfb9q_ima.fits')\n",
- "ylim = [(0.3,0.7),(0.3,1.8)]\n",
- "fig, axarr = plt.subplots(1,2,figsize=(15,5))\n",
+ "imafiles = ('ibohbfb7q_ima.fits', 'ibohbfb9q_ima.fits')\n",
+ "ylim = [(0.3, 0.7), (0.3, 1.8)]\n",
+ "fig, axarr = plt.subplots(1, 2, figsize=(15, 5))\n",
"fig.set_dpi(100)\n",
"\n",
"for i, ima in enumerate(imafiles):\n",
- " time, counts = wfc3tools.pstat(ima,stat='midpt',units='rate',plot=False)\n",
- " axarr[i].plot(time,counts,'+',markersize=8)\n",
+ " time, counts = wfc3tools.pstat(ima, stat='midpt', units='rate', plot=False)\n",
+ " axarr[i].plot(time, counts, '+', markersize=8)\n",
" axarr[i].set_title(ima)\n",
" axarr[i].set_xlabel('Exposure Time (s)')\n",
" axarr[i].set_ylabel('Count Rate (e-/s)')\n",
@@ -394,13 +399,15 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "scrolled": true
+ },
"outputs": [],
"source": [
"raw_files = glob.glob('*_raw.fits')\n",
"\n",
- "for fil in raw_files:\n",
- " !crds bestrefs --files $fil --sync-references=1 --update-bestrefs;"
+ "for file in raw_files:\n",
+ " !crds bestrefs --files $file --sync-references=1 --update-bestrefs;"
]
},
{
@@ -418,16 +425,19 @@
"metadata": {},
"outputs": [],
"source": [
+ "# Renaming files\n",
"os.rename('ibohbfb9q_ima.fits', 'ibohbfb9q_ima_orig.fits')\n",
"os.rename('ibohbfb9q_flt.fits', 'ibohbfb9q_flt_orig.fits')\n",
"\n",
+ "# Updating the raw file\n",
"raw_file = 'ibohbfb9q_raw.fits'\n",
- "raw=fits.open(raw_file,mode='update')\n",
- "raw[0].header['CRCORR'] ='OMIT'\n",
- "raw.flush()\n",
+ "with fits.open(raw_file, mode='update') as raw:\n",
+ " raw[0].header['CRCORR'] = 'OMIT'\n",
"\n",
- "wfc3tools.calwf3(raw_file );\n",
+ "# Running wfc3tools.calwf3\n",
+ "wfc3tools.calwf3(raw_file)\n",
"\n",
+ "# Renaming the processed flt file\n",
"os.rename('ibohbfb9q_flt.fits', 'ibohbfb9q_flt_norampfit.fits')"
]
},
@@ -449,36 +459,31 @@
"metadata": {},
"outputs": [],
"source": [
- "ima = fits.open(raw_file.replace('raw','ima'), mode ='update')\n",
- "\n",
- "# You can define a subregion for stats. Here we use the whole image, minus the 5 pixel wide overscan regions\n",
- "stats_region =[[5,1014], [5,1014]]\n",
- "slx = slice(stats_region[0][0], stats_region[0][1])\n",
- "sly = slice(stats_region[1][0], stats_region[1][1])\n",
- "\n",
- "# Subtract the median countrate from each read and add back the full exposure countrate to preserve pixel statistics\n",
- " \n",
- "total_countrate = np.median(ima['SCI',1].data[sly, slx])\n",
- "median = []\n",
- "sci_num = []\n",
- "for i in range(ima[0].header['NSAMP'] -1):\n",
- " med = np.median(ima['SCI',i+1].data[sly, slx])\n",
- " ima['SCI',i+1].data += total_countrate - med\n",
- " print('%s, [SCI,%d], median_bkg: %.2f' %(raw_file, i+1, med))\n",
- " sci_num.append(i+1)\n",
- " median.append(med)\n",
- " \n",
- "plt.figure(figsize=(8,5))\n",
- "plt.plot(sci_num,median)\n",
- "plt.gca().invert_xaxis()\n",
- "plt.title(\"Median Background vs. SCI Exposure Number\")\n",
- "plt.xlabel('SCI Exposure Number')\n",
- "plt.ylabel('Median Background Value (e-)')\n",
- "# Turn back on the ramp fitting for running calwf3 in the next step\n",
- "ima[0].header['CRCORR'] ='PERFORM'\n",
- "\n",
- "# Write the updated IMA\n",
- "ima.flush()"
+ "with fits.open(raw_file.replace('raw', 'ima'), mode='update') as ima:\n",
+ " # You can define a subregion for stats. Here we use the whole image, minus the 5 pixel wide overscan regions\n",
+ " stats_region = [[5, 1014], [5, 1014]]\n",
+ " slx = slice(stats_region[0][0], stats_region[0][1])\n",
+ " sly = slice(stats_region[1][0], stats_region[1][1])\n",
+ "\n",
+ " # Subtract the median countrate from each read and add back the full exposure countrate to preserve pixel statistics\n",
+ " total_countrate = np.median(ima['SCI', 1].data[sly, slx])\n",
+ " median = []\n",
+ " sci_num = []\n",
+ " for i in range(ima[0].header['NSAMP'] - 1):\n",
+ " med = np.median(ima['SCI', i + 1].data[sly, slx])\n",
+ " ima['SCI', i + 1].data += total_countrate - med\n",
+ " print(f'{raw_file}, [SCI, {i + 1}], median_bkg: {med:.2f}')\n",
+ " sci_num.append(i + 1)\n",
+ " median.append(med)\n",
+ "\n",
+ " plt.figure(figsize=(8, 5))\n",
+ " plt.plot(sci_num, median)\n",
+ " plt.gca().invert_xaxis()\n",
+ " plt.title(\"Median Background vs. SCI Exposure Number\")\n",
+ " plt.xlabel('SCI Exposure Number')\n",
+ " plt.ylabel('Median Background Value (e-)')\n",
+ " # Turn back on the ramp fitting for running calwf3 in the next step\n",
+ " ima[0].header['CRCORR'] = 'PERFORM'"
]
},
{
@@ -505,12 +510,12 @@
"metadata": {},
"outputs": [],
"source": [
- "wfc3tools.calwf3(raw_file.replace('raw','ima'));\n",
+ "wfc3tools.calwf3(raw_file.replace('raw', 'ima'))\n",
"\n",
- "### Clean up and rename files\n",
+ "# Clean up and rename files\n",
"os.remove('ibohbfb9q_ima.fits')\n",
- "os.rename('ibohbfb9q_ima_ima.fits','ibohbfb9q_ima.fits')\n",
- "os.rename('ibohbfb9q_ima_flt.fits','ibohbfb9q_flt.fits')"
+ "os.rename('ibohbfb9q_ima_ima.fits', 'ibohbfb9q_ima.fits')\n",
+ "os.rename('ibohbfb9q_ima_flt.fits', 'ibohbfb9q_flt.fits')"
]
},
{
@@ -536,27 +541,27 @@
"metadata": {},
"outputs": [],
"source": [
- "##Display the images\n",
- "flt1 =fits.getdata('ibohbfb7q_flt.fits' ,ext=1)\n",
- "flt2 =fits.getdata('ibohbfb9q_flt_orig.fits',ext=1)\n",
- "flt2corr=fits.getdata('ibohbfb9q_flt.fits' ,ext=1)\n",
+ "# Display the images\n",
+ "flt1 = fits.getdata('ibohbfb7q_flt.fits', ext=1)\n",
+ "flt2 = fits.getdata('ibohbfb9q_flt_orig.fits', ext=1)\n",
+ "flt2corr = fits.getdata('ibohbfb9q_flt.fits', ext=1)\n",
"\n",
- "fig=plt.figure(figsize=(20,10))\n",
- "ax1=fig.add_subplot(1,3,1)\n",
- "ax2=fig.add_subplot(1,3,2)\n",
- "ax3=fig.add_subplot(1,3,3)\n",
+ "fig = plt.figure(figsize=(20, 10))\n",
+ "ax1 = fig.add_subplot(1, 3, 1)\n",
+ "ax2 = fig.add_subplot(1, 3, 2)\n",
+ "ax3 = fig.add_subplot(1, 3, 3)\n",
"\n",
- "A = ax1.imshow(flt1, vmin=0.25,vmax=1.25,cmap='Greys_r',origin='lower')\n",
- "B = ax2.imshow(flt2, vmin=1.30,vmax=2.30,cmap='Greys_r',origin='lower')\n",
- "C = ax3.imshow(flt2corr,vmin=1.30,vmax=2.30,cmap='Greys_r',origin='lower')\n",
+ "A = ax1.imshow(flt1, vmin=0.25, vmax=1.25, cmap='Greys_r', origin='lower')\n",
+ "B = ax2.imshow(flt2, vmin=1.30, vmax=2.30, cmap='Greys_r', origin='lower')\n",
+ "C = ax3.imshow(flt2corr, vmin=1.30, vmax=2.30, cmap='Greys_r', origin='lower')\n",
"\n",
- "ax1.set_title('ibohbfb7q (Linear Bkg)' ,fontsize=20)\n",
- "ax2.set_title('ibohbfb9q (Time Variable Bkg)' ,fontsize=20)\n",
- "ax3.set_title('ibohbfb9q (Corrected Bkg)',fontsize=20)\n",
+ "ax1.set_title('ibohbfb7q (Linear Bkg)', fontsize=20)\n",
+ "ax2.set_title('ibohbfb9q (Time Variable Bkg)', fontsize=20)\n",
+ "ax3.set_title('ibohbfb9q (Corrected Bkg)', fontsize=20)\n",
"\n",
- "fig.colorbar(A,ax=ax1,shrink=.5)\n",
- "fig.colorbar(B,ax=ax2,shrink=.49)\n",
- "fig.colorbar(C,ax=ax3,shrink=.5)"
+ "fig.colorbar(A, ax=ax1, shrink=.5)\n",
+ "fig.colorbar(B, ax=ax2, shrink=.49)\n",
+ "fig.colorbar(C, ax=ax3, shrink=.5)"
]
},
{
@@ -573,23 +578,23 @@
"metadata": {},
"outputs": [],
"source": [
- "### Plot the histograms\n",
- "flt1f = flt1.flatten()\n",
- "flt2f = flt2.flatten()\n",
+ "# Plot the histograms\n",
+ "flt1f = flt1.flatten()\n",
+ "flt2f = flt2.flatten()\n",
"flt2fcorr = flt2corr.flatten()\n",
"\n",
- "fig=plt.figure(figsize=(20,5))\n",
- "ax1=fig.add_subplot(1,3,1)\n",
- "ax2=fig.add_subplot(1,3,2)\n",
- "ax3=fig.add_subplot(1,3,3)\n",
+ "fig = plt.figure(figsize=(20, 5))\n",
+ "ax1 = fig.add_subplot(1, 3, 1)\n",
+ "ax2 = fig.add_subplot(1, 3, 2)\n",
+ "ax3 = fig.add_subplot(1, 3, 3)\n",
"\n",
- "n, bins, patches = ax1.hist(flt1f, bins=200,range=(0,1))\n",
- "n, bins, patches = ax2.hist(flt2f, bins=200,range=(1,2))\n",
- "n, bins, patches = ax3.hist(flt2fcorr,bins=200,range=(1,2))\n",
+ "n, bins, patches = ax1.hist(flt1f, bins=200, range=(0, 1))\n",
+ "n, bins, patches = ax2.hist(flt2f, bins=200, range=(1, 2))\n",
+ "n, bins, patches = ax3.hist(flt2fcorr, bins=200, range=(1, 2))\n",
"\n",
- "ax1.set_title('ibohbfb7q (Linear Bkg)',fontsize=20)\n",
- "ax2.set_title('ibohbfb9q (Time Variable Bkg)',fontsize=20)\n",
- "ax3.set_title('ibohbfb9q (Corrected)',fontsize=20)"
+ "ax1.set_title('ibohbfb7q (Linear Bkg)', fontsize=20)\n",
+ "ax2.set_title('ibohbfb9q (Time Variable Bkg)', fontsize=20)\n",
+ "ax3.set_title('ibohbfb9q (Corrected)', fontsize=20)"
]
},
{
@@ -607,14 +612,14 @@
"metadata": {},
"outputs": [],
"source": [
- "imafiles = ('ibohbfb9q_ima_orig.fits','ibohbfb9q_ima.fits')\n",
- "ylim = [(0.3,0.7),(0.3,1.8)]\n",
- "fig, axarr = plt.subplots(1,2,figsize=(15,5))\n",
+ "imafiles = ('ibohbfb9q_ima_orig.fits', 'ibohbfb9q_ima.fits')\n",
+ "ylim = [(0.3, 0.7), (0.3, 1.8)]\n",
+ "fig, axarr = plt.subplots(1, 2, figsize=(15, 5))\n",
"fig.set_dpi(100)\n",
"\n",
"for i, ima in enumerate(imafiles):\n",
- " time, counts = wfc3tools.pstat(ima,stat='midpt',units='counts',plot=False)\n",
- " axarr[i].plot(time,counts,'+',markersize=8)\n",
+ " time, counts = wfc3tools.pstat(ima, stat='midpt', units='counts', plot=False)\n",
+ " axarr[i].plot(time, counts, '+', markersize=8)\n",
" axarr[i].set_title(ima)\n",
" axarr[i].set_xlabel('Exposure Time (s)')\n",
" axarr[i].set_ylabel('counts (e-)')"
@@ -633,14 +638,14 @@
"metadata": {},
"outputs": [],
"source": [
- "imafiles = ('ibohbfb9q_ima_orig.fits','ibohbfb9q_ima.fits')\n",
- "ylim = [(0.3,1.8),(0.3,1.8)]\n",
- "fig, axarr = plt.subplots(1,2,figsize=(15,5))\n",
+ "imafiles = ('ibohbfb9q_ima_orig.fits', 'ibohbfb9q_ima.fits')\n",
+ "ylim = [(0.3, 1.8), (0.3, 1.8)]\n",
+ "fig, axarr = plt.subplots(1, 2, figsize=(15, 5))\n",
"fig.set_dpi(100)\n",
"\n",
"for i, ima in enumerate(imafiles):\n",
- " time, counts = wfc3tools.pstat(ima,stat='midpt',units='rate',plot=False)\n",
- " axarr[i].plot(time,counts,'+',markersize=8)\n",
+ " time, counts = wfc3tools.pstat(ima, stat='midpt', units='rate', plot=False)\n",
+ " axarr[i].plot(time, counts, '+', markersize=8)\n",
" axarr[i].set_title(ima)\n",
" axarr[i].set_xlabel('Exposure Time (s)')\n",
" axarr[i].set_ylabel('Count Rate (e-/s)')\n",
@@ -661,30 +666,30 @@
"metadata": {},
"outputs": [],
"source": [
- "w=np.where((0. < flt1f) & (flt1f < 1.))\n",
- "flt1_mean= np.mean(flt1f[w])\n",
- "flt1_med =np.median(flt1f[w])\n",
- "flt1_std = np.std(flt1f[w])\n",
+ "w = np.where((0. < flt1f) & (flt1f < 1.))\n",
+ "flt1_mean = np.mean(flt1f[w])\n",
+ "flt1_med = np.median(flt1f[w])\n",
+ "flt1_std = np.std(flt1f[w])\n",
"\n",
- "w=np.where((1. < flt2f) & (flt2f < 2.))\n",
- "flt2_mean= np.mean(flt2f[w])\n",
- "flt2_med =np.median(flt2f[w])\n",
- "flt2_std = np.std(flt2f[w])\n",
+ "w = np.where((1. < flt2f) & (flt2f < 2.))\n",
+ "flt2_mean = np.mean(flt2f[w])\n",
+ "flt2_med = np.median(flt2f[w])\n",
+ "flt2_std = np.std(flt2f[w])\n",
"\n",
- "w=np.where((1. < flt2fcorr) & (flt2fcorr < 2.))\n",
- "flt2f_mean= np.mean(flt2fcorr[w])\n",
- "flt2f_med =np.median(flt2fcorr[w])\n",
- "flt2f_std = np.std(flt2fcorr[w])\n",
+ "w = np.where((1. < flt2fcorr) & (flt2fcorr < 2.))\n",
+ "flt2f_mean = np.mean(flt2fcorr[w])\n",
+ "flt2f_med = np.median(flt2fcorr[w])\n",
+ "flt2f_std = np.std(flt2fcorr[w])\n",
"\n",
- "ramp = ['Linear Bkg','Time Variable Bkg','Corrected Bkg']\n",
- "filename = ['ibohbfb7q_flt','ibohbfb9q_flt_orig.fits','ibohbfb9q_flt.fits']\n",
- "mean = [flt1_mean,flt2_mean,flt2f_mean]\n",
- "med = [flt1_med,flt2_med,flt2f_med]\n",
- "std = [flt1_std,flt2_std,flt2f_std]\n",
+ "ramp = ['Linear Bkg', 'Time Variable Bkg', 'Corrected Bkg']\n",
+ "filename = ['ibohbfb7q_flt', 'ibohbfb9q_flt_orig.fits', 'ibohbfb9q_flt.fits']\n",
+ "mean = [flt1_mean, flt2_mean, flt2f_mean]\n",
+ "med = [flt1_med, flt2_med, flt2f_med]\n",
+ "std = [flt1_std, flt2_std, flt2f_std]\n",
"\n",
"Table = {\n",
- " \"RAMP\" : ramp,\n",
- " \"Filename\" : filename,\n",
+ " \"RAMP\": ramp,\n",
+ " \"Filename\": filename,\n",
" \"Mean\": mean,\n",
" \"Median\": med,\n",
" \"Stdev\": std,\n",
@@ -715,19 +720,19 @@
"metadata": {},
"outputs": [],
"source": [
- "##Display the images\n",
- "flt2 =fits.getdata('ibohbfb9q_flt_orig.fits',ext=1)\n",
- "flt2corr=fits.getdata('ibohbfb9q_flt.fits',ext=1)\n",
+ "# Display the images\n",
+ "flt2 = fits.getdata('ibohbfb9q_flt_orig.fits', ext=1)\n",
+ "flt2corr = fits.getdata('ibohbfb9q_flt.fits', ext=1)\n",
"\n",
- "fig=plt.figure(figsize=(20,8))\n",
- "ax1=fig.add_subplot(1,2,1)\n",
- "ax2=fig.add_subplot(1,2,2)\n",
+ "fig = plt.figure(figsize=(20, 8))\n",
+ "ax1 = fig.add_subplot(1, 2, 1)\n",
+ "ax2 = fig.add_subplot(1, 2, 2)\n",
"\n",
- "ax1.imshow( flt2[520:720,750:970], vmin=1.3,vmax=2.5,cmap='Greys_r',origin='lower')\n",
- "ax2.imshow(flt2corr[520:720,750:970], vmin=1.3,vmax=2.5,cmap='Greys_r',origin='lower')\n",
+ "ax1.imshow(flt2[520:720, 750:970], vmin=1.3, vmax=2.5, cmap='Greys_r', origin='lower')\n",
+ "ax2.imshow(flt2corr[520:720, 750:970], vmin=1.3, vmax=2.5, cmap='Greys_r', origin='lower')\n",
"\n",
- "ax1.set_title('ibohbfb9q (Time Variable Bkg)',fontsize=20)\n",
- "ax2.set_title('ibohbfb9q (Corrected Bkg)',fontsize=20)"
+ "ax1.set_title('ibohbfb9q (Time Variable Bkg)', fontsize=20)\n",
+ "ax2.set_title('ibohbfb9q (Corrected Bkg)', fontsize=20)"
]
},
{
@@ -764,7 +769,8 @@
"\n",
"**Author:** Ky Huynh, Jennifer Mack, WFC3 Instrument Team\n",
"\n",
- "**Updated On:** 2023-05-25\n",
+ "**Published On:** 2023-05-25
\n",
+ "**Updated On:** 2023-11-21\n",
"\n",
"## Citations \n",
"\n",
@@ -809,7 +815,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.13"
+ "version": "3.11.6"
},
"varInspector": {
"cols": {
@@ -842,5 +848,5 @@
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/notebooks/WFC3/tvb_flattenramp/pre-requirements.sh b/notebooks/WFC3/tvb_flattenramp/pre-requirements.sh
new file mode 100644
index 000000000..7a1a9a5b2
--- /dev/null
+++ b/notebooks/WFC3/tvb_flattenramp/pre-requirements.sh
@@ -0,0 +1 @@
+conda install --yes -c conda-forge hstcal==2.7.4
diff --git a/notebooks/WFC3/tvb_flattenramp/requirements.txt b/notebooks/WFC3/tvb_flattenramp/requirements.txt
new file mode 100644
index 000000000..8a70a2065
--- /dev/null
+++ b/notebooks/WFC3/tvb_flattenramp/requirements.txt
@@ -0,0 +1,8 @@
+astropy==5.1
+astroquery==0.4.6
+ccdproc==2.3.1
+matplotlib==3.5.2
+numpy==1.24.2
+pandas==1.5.3
+wfc3tools==1.4.0
+crds==11.16.7