Skip to content

Commit

Permalink
PEP 8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackie-Brown committed Oct 30, 2024
1 parent 0da014d commit a03f487
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 12,
"id": "520b8fa0",
"metadata": {},
"outputs": [],
"source": [
"def plot_contrast(texp, tsubexp, peakpixel_countrate, readnoise=8.9, sdark=0.288, \\\n",
" szodi=2.45, searth=1.34, extract_box_size=3, plot_psfintensity=True, target_name=None, feature=None, \\\n",
" comp_sep = None, comp_contrast=None, disk_profile=None, disk_contrast=None, \\\n",
"def plot_contrast(texp, tsubexp, peakpixel_countrate, readnoise=8.9, sdark=0.288, szodi=2.45, \n",
" searth=1.34, extract_box_size=3, plot_psfintensity=True, target_name=None, feature=None, \n",
" comp_sep=None, comp_contrast=None, disk_profile=None, disk_contrast=None, \n",
" disk_filename=None, save_fig=None, **kwargs):\n",
" \"\"\"\n",
" plot_contrast\n",
Expand Down Expand Up @@ -197,12 +197,12 @@
" \n",
" \"\"\"\n",
" \n",
" data = np.loadtxt('GO12923raw.dat', usecols=(0,1,2)) \n",
" data = np.loadtxt('GO12923raw.dat', usecols=(0, 1, 2))\n",
" # This file corresponds to the azimuthally averaged STIS PSF wings, with column 1 being the radius in arcsecs and\n",
" # column 2 is the contrast. This is the PSF intensity that is an optional parameter to plot on the contrast curve.\n",
" rawr =data[:,0]\n",
" rawcont = data[:,1]\n",
" rawcont_error = data[:,2]\n",
" rawr = data[:, 0]\n",
" rawcont = data[:, 1]\n",
" #rawcont_error = data[:, 2]\n",
" \n",
" spsf = rawcont * peakpixel_countrate # PSF intensity\n",
"\n",
Expand All @@ -213,7 +213,7 @@
" n2poiss = extract_box_size * tsubexp * spsf # poission noise^2\n",
"\n",
" spec_int = 0.00128*(rawr/0.05071)**(-2.86) \n",
" #empirical fit to the average speckle intensity as a function of radius (Debes et al. 2019)\n",
" # empirical fit to the average speckle intensity as a function of radius (Debes et al. 2019)\n",
"\n",
" n2spec = (spec_int*tsubexp)**2 * peakpixel_countrate**2 * extract_box_size**2 * tsubexp/texp # speckle noise\n",
"\n",
Expand All @@ -227,18 +227,18 @@
" cperpix_3sigma = totnoise_3sigma / (peakpixel_countrate/0.23*0.5*tsubexp)\n",
" cperpix_1sigma = totnoise_1sigma / (peakpixel_countrate/0.23*0.5*tsubexp)\n",
" \n",
" contrast_plot = plt.figure(figsize=(14,10))\n",
" contrast_plot = plt.figure(figsize=(14, 10))\n",
"\n",
" plt.plot(rawr, cperpix_5sigma, label = 'Predicted Limit 5$\\sigma$', color='lightsteelblue')\n",
" plt.plot(rawr, cperpix_3sigma, label = 'Predicted Limit 3$\\sigma$', color='steelblue')\n",
" plt.plot(rawr, cperpix_1sigma, label = 'Predicted Limit 1$\\sigma$', color='midnightblue')\n",
" plt.plot(rawr, cperpix_5sigma, label=f\"Predicted Limit 5 sigma\", color='lightsteelblue')\n",
" plt.plot(rawr, cperpix_3sigma, label=f\"Predicted Limit 3 sigma\", color='steelblue')\n",
" plt.plot(rawr, cperpix_1sigma, label=f\"Predicted Limit 1 sigma\", color='midnightblue')\n",
"\n",
" plt.fill_between(rawr, cperpix_5sigma, color='lightsteelblue')\n",
" plt.fill_between(rawr, cperpix_3sigma, color='steelblue')\n",
" plt.fill_between(rawr, cperpix_1sigma, color='midnightblue')\n",
"\n",
" if plot_psfintensity == True: # option to plot the PSF intensity on the contrast plot\n",
" plt.plot(rawr, rawcont, ls='--', label = 'PSF Intensity', color='black', linewidth=2)\n",
" if plot_psfintensity: # option to plot the PSF intensity on the contrast plot\n",
" plt.plot(rawr, rawcont, ls='--', label='PSF Intensity', color='black', linewidth=2)\n",
" else:\n",
" None \n",
" \n",
Expand Down Expand Up @@ -267,9 +267,9 @@
" raise NameError(\"Surface brightness profile file name is not specified.\")\n",
" \n",
" diskfilename = disk_filename\n",
" disk_sb_profile = np.loadtxt(diskfilename, usecols=(0,1)) # contrast as a function of radius, rawr here is in arcsecs\n",
" disk_r = disk_sb_profile[:,0]\n",
" disk_cont = disk_sb_profile[:,1] \n",
" disk_sb_profile = np.loadtxt(diskfilename, usecols=(0, 1)) # contrast as a function of radius, rawr here is in arcsecs\n",
" disk_r = disk_sb_profile[:, 0]\n",
" disk_cont = disk_sb_profile[:, 1]\n",
" plt.plot(disk_r, disk_cont, ls='--', linewidth=4, color='orange', label=target_name)\n",
" \n",
" elif diskprofile == None:\n",
Expand All @@ -284,15 +284,15 @@
" plt.legend(fontsize=18, loc='best', markerscale=0.5)\n",
" plt.xlabel('Separation (\")', fontsize=20)\n",
" plt.ylabel('Contrast Sensitivity', fontsize=20)\n",
" plt.xlim(0.2,1.2)\n",
" plt.xlim(0.2, 1.2)\n",
" plt.yscale('log')\n",
" plt.tick_params(axis='both', which='both', labelsize=20, size=6)\n",
" \n",
" if 'save_fig' not in kwargs:\n",
" None\n",
" else:\n",
" savefig=kwargs['save_fig']\n",
" if savefig == True:\n",
" savefig = kwargs['save_fig']\n",
" if savefig:\n",
" contrast_plot.savefig('STIS_contrast_plot_'+target_name+'.pdf')"
]
},
Expand Down Expand Up @@ -433,7 +433,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "stis",
"display_name": "test",
"language": "python",
"name": "python3"
},
Expand All @@ -447,7 +447,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit a03f487

Please sign in to comment.