Skip to content

Commit

Permalink
Address additional style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
haticekaratay committed Oct 4, 2023
1 parent 3dbb58a commit a8b33b9
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,31 @@
"\n",
"# ----------------------------------------------General Imports-----------------------------------------------------\n",
"\n",
"import numpy as np\n",
"import warnings\n",
"warnings.filterwarnings('ignore') # Set to 'default' to turn warnings back on\n",
"import numpy as np # noqa\n",
"import warnings # noqa\n",
"warnings.filterwarnings('ignore') # Set to 'default' to turn warnings back on\n",
"\n",
"# --------------------------------------------File Operation Imports------------------------------------------------\n",
"\n",
"import glob\n",
"import os\n",
"import json\n",
"from shutil import copy\n",
"import glob # noqa\n",
"import os # noqa\n",
"import json # noqa\n",
"from shutil import copy # noqa\n",
"\n",
"# --------------------------------------------Astropy/Astroquery Imports--------------------------------------------\n",
"\n",
"from astropy.io import fits\n",
"from astropy import wcs\n",
"from astropy.wcs import WCS\n",
"from astropy.visualization import ImageNormalize, ManualInterval, LogStretch, LinearStretch, AsinhStretch\n",
"from astroquery.mast import Observations\n",
"from astropy.io import fits # noqa\n",
"from astropy import wcs # noqa\n",
"from astropy.wcs import WCS # noqa\n",
"from astropy.visualization import ImageNormalize, ManualInterval, LogStretch, LinearStretch, AsinhStretch # noqa\n",
"from astroquery.mast import Observations # noqa\n",
"\n",
"# ------------------------------------------------Plotting Imports--------------------------------------------------\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"from matplotlib.patches import Circle\n",
"import matplotlib.gridspec as grd\n",
"from matplotlib import cm\n",
"import matplotlib.pyplot as plt # noqa\n",
"import matplotlib as mpl # noqa\n",
"import matplotlib.gridspec as grd # noqa\n",
"from matplotlib import cm # noqa\n",
"\n",
"# Use this version for non-interactive plots (easier scrolling of the notebook)\n",
"%matplotlib inline\n",
Expand Down Expand Up @@ -274,12 +273,12 @@
"\n",
" # SCI Extension: [Type:ImageHDU Cards:92 Dimensions:(57, 61, 973) Format:float32]\n",
" cube = s3d[1].data # Science data\n",
" wcs = WCS(s3d[1].header) # World Coordinate System (WCS) Transformation keywords \n",
" wmap = s3d[4].data # 3-D weight image giving the relative weights of the output spaxels.\n",
" cdelt1 = s3d[1].header['CDELT1']*3600. # Axis 1 coordinate increment at reference point \n",
" cdelt2 = s3d[1].header['CDELT2']*3600. # Axis 2 coordinate increment at reference point \n",
" cdelt3 = s3d[1].header['CDELT3'] # Axis 3 coordinate increment at reference point \n",
" crval3 = s3d[1].header['CRVAL3'] # third axis value at the reference pixel \n",
" wcs = WCS(s3d[1].header) # World Coordinate System (WCS) Transformation keywords # noqa\n",
" wmap = s3d[4].data # 3-D weight image giving the relative weights of the output spaxels.\n",
" cdelt1 = s3d[1].header['CDELT1']*3600. # Axis 1 coordinate increment at reference point # noqa\n",
" cdelt2 = s3d[1].header['CDELT2']*3600. # Axis 2 coordinate increment at reference point # noqa\n",
" cdelt3 = s3d[1].header['CDELT3'] # Axis 3 coordinate increment at reference point \n",
" crval3 = s3d[1].header['CRVAL3'] # Third axis value at the reference pixel \n",
"\n",
" # Wavelength range of the grating/filter combination\n",
" wavstart = s3d[1].header['WAVSTART']\n",
Expand All @@ -297,7 +296,7 @@
" wavelengths = wavelength_slices[0]\n",
" spaxel_loc = spaxel_locs[0]\n",
" vmin_vmax_vals = vmin_vmax[0]\n",
" \n",
" \n",
" if y_scale:\n",
" y_scales = y_scale[0]\n",
"\n",
Expand All @@ -313,7 +312,7 @@
" spaxel_loc = spaxel_locs[0]\n",
" vmin_vmax_vals = vmin_vmax[0]\n",
" if y_scale:\n",
" y_scales = y_scale[0]\n",
" y_scales = y_scale[0]\n",
"\n",
" # Loop through each wavelength slices\n",
" for i, wave_slice in enumerate(wavelengths):\n",
Expand Down Expand Up @@ -351,7 +350,6 @@
" ax1.tick_params(axis='both', which='major', labelsize=20)\n",
" ax1.coords[0].set_ticklabel(rotation=13, ha='right', pad=24)\n",
"\n",
" \n",
" # ------------------------------------------Spaxel 1-D Spectrum---------------------------------------------\n",
" \n",
" # Zoom in on a Spaxel: Spectrum\n",
Expand Down Expand Up @@ -394,7 +392,7 @@
" slice_wmap = ax3.imshow(slice_mean_wmap, norm=slice_norm_wmap, origin='lower', aspect='auto', cmap=cmap) # plot slice\n",
"\n",
" cb_wmap = fig.colorbar(slice_wmap, fraction=0.046, pad=0.04)\n",
" cb_wmap.set_label('Weight', labelpad=-1, fontsize = 22)\n",
" cb_wmap.set_label('Weight', labelpad=-1, fontsize=22)\n",
" cb_wmap.ax.tick_params(labelsize=20)\n",
" cb_wmap.ax.yaxis.get_offset_text().set_fontsize(20)\n",
" \n",
Expand All @@ -417,8 +415,7 @@
" fig.tight_layout(rect=[0, 0, 0.98, 0.98])\n",
"\n",
" if save_figure:\n",
" fig.savefig(root+\".png\", dpi=24, bbox_inches=\"tight\")\n",
"\n"
" fig.savefig(root+\".png\", dpi=24, bbox_inches=\"tight\")"
]
},
{
Expand All @@ -438,7 +435,7 @@
"outputs": [],
"source": [
"# To rerun the notebook and all the pipeline steps set runflag=True\n",
"runflag = True \n",
"runflag = True\n",
"\n",
"# Demo directory -- contains pre-computed products\n",
"if not runflag:\n",
Expand Down Expand Up @@ -586,7 +583,7 @@
" title='Countrate Image \\n Detector: {} \\n 8-Cycle Dither Position Index: {} \\n GRATING/FILTER: {}/{}'.format(ratefile_open.meta.instrument.detector,\n",
" ratefile_open.meta.dither.position_number, \n",
" ratefile_open.meta.instrument.grating,\n",
" ratefile_open.meta.instrument.filter)) #rate files have units of DN/s\n",
" ratefile_open.meta.instrument.filter)) # Rate files have units of DN/s\n",
" \n",
" show_image(ratefile_dq, 0, 10, units='Bit Value', scale='linear', zoom_in=[650, 700, 1250, 1300], ysize=20, xsize=20,\n",
" title='Data Quality Map \\n Detector: {} \\n 8-Cycle Dither Position Index: {} \\n GRATING/FILTER: {}/{}'.format(ratefile_open.meta.instrument.detector,\n",
Expand Down Expand Up @@ -857,7 +854,7 @@
" title='Countrate Image \\n Detector: {} \\n 8-Cycle Dither Position Index: {} \\n GRATING/FILTER: {}/{}'.format(ratefile_open.meta.instrument.detector,\n",
" ratefile_open.meta.dither.position_number, \n",
" ratefile_open.meta.instrument.grating,\n",
" ratefile_open.meta.instrument.filter)) # rate files have units of DN/s\n",
" ratefile_open.meta.instrument.filter)) # Rate files have units of DN/s\n",
" \n",
" show_image(ratefile_dq, 0, 10, units='Bit Value', scale='linear', zoom_in=[650, 700, 1250, 1300], ysize=20, xsize=20,\n",
" title='Data Quality Map \\n Detector: {} \\n 8-Cycle Dither Position Index: {} \\n GRATING/FILTER: {}/{}'.format(ratefile_open.meta.instrument.detector,\n",
Expand Down
Loading

0 comments on commit a8b33b9

Please sign in to comment.