Skip to content

Commit

Permalink
PEP8 style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kglidic committed Nov 4, 2024
1 parent 57e8678 commit a4bf82b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions notebooks/NIRSPEC/FS_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@
" integration=None,\n",
" extname='data',\n",
" cmap='viridis',\n",
" bad_color=(1,0.7,0.7),\n",
" bad_color=(1, 0.7, 0.7),\n",
" vmin=None,\n",
" vmax=None,\n",
" scale='asinh',\n",
Expand Down Expand Up @@ -659,7 +659,7 @@
" plot_resample=True,\n",
" plot_errors=False,\n",
" cmap='viridis',\n",
" bad_color=(1,0.7,0.7),\n",
" bad_color=(1, 0.7, 0.7),\n",
" aspect='auto',\n",
" vmin=None,\n",
" vmax=None,\n",
Expand Down Expand Up @@ -759,7 +759,7 @@
" total_plots = len(products) + bool(file_types['x1d'])\n",
" height_ratios = [1] * len(products) + ([3] if bool(file_types['x1d']) else [])\n",
" fig, axes = plt.subplots(total_plots, 1, figsize=(15, 5*total_plots), sharex=False,\n",
" height_ratios=height_ratios)\n",
" height_ratios=height_ratios)\n",
" fig.subplots_adjust(hspace=0.2, wspace=0.2)\n",
" ax2d, ax1d = (axes[:-1], axes[-1]) if bool(file_types['x1d']) else (axes, None)\n",
"\n",
Expand All @@ -785,7 +785,7 @@
" except ValueError:\n",
" print(f\"Error: source_id '{source_id}' is invalid.\")\n",
" print(f\"Available source_ids: \"\n",
" f\"{[slit.source_id for slit in model.slits][:5]}\")\n",
" f\"{[slit.source_id for slit in model.slits][:5]}\")\n",
" break\n",
"\n",
" # Check if 'fixed_slit' exists, otherwise fall back to 'slitlet_id'\n",
Expand Down Expand Up @@ -825,7 +825,7 @@
" wcsobj = slit_model.meta.wcs # Obtaining the WCS object from the meta data.\n",
" y, x = np.mgrid[:slit_model.data.shape[0], :slit_model.data.shape[1]]\n",
" # Coordinate transform from detector space (pixels) to sky (RA, DEC).\n",
" det2sky = wcsobj.get_transform('detector','world')\n",
" det2sky = wcsobj.get_transform('detector', 'world')\n",
" ra, dec, s2dwave = det2sky(x, y) # RA/Dec, wavelength (microns) for each pixel.\n",
" s2dwaves = s2dwave[0, :] # Single row since this is the rectified spectrum.\n",
" x_arr = np.arange(0, slit_model.data.shape[1], int(len(slit_model.data[1]) / 4))\n",
Expand Down Expand Up @@ -874,7 +874,7 @@
" wave_fill[1:-1],\n",
" wave_1d[igap+1:]])\n",
"\n",
" if prefix !='RE-EXTRACTION ':\n",
" if prefix != 'RE-EXTRACTION ':\n",
" num_rows, num_waves = data_2d.shape\n",
" fill_2d = np.zeros(shape=(num_rows, num_fill-1))*np.nan\n",
" data_2d = np.concatenate([data_2d[:, :igap+1],\n",
Expand All @@ -887,7 +887,7 @@
" errs_1d = np.concatenate([errs_1d[:igap+1],\n",
" fill_1d, errs_1d[igap+1:]])\n",
" else:\n",
" num_fill=0\n",
" num_fill = 0\n",
" num_waves = len(wave_1d)\n",
"\n",
" label_1d = (f'{slit_model.meta.instrument.detector} '\n",
Expand Down Expand Up @@ -951,12 +951,11 @@
" plt.subplots_adjust(left=0.05, right=0.85)\n",
" units = slit_model.meta.bunit_data\n",
" cbar_ax = fig.add_axes([ax2d[i].get_position().x1 + 0.02,\n",
" ax2d[i].get_position().y0, 0.02,\n",
" ax2d[i].get_position().height])\n",
" ax2d[i].get_position().y0, 0.02,\n",
" ax2d[i].get_position().height])\n",
" cbar = fig.colorbar(im, cax=cbar_ax)\n",
" cbar.set_label(units, fontsize=12) # Set the font size.\n",
"\n",
"\n",
" # ------------------ Construct titles for plots ------------------\n",
"\n",
" title_2d = (f\"{title_prefix + ' ' if title_prefix else ''}\"\n",
Expand Down Expand Up @@ -1171,7 +1170,7 @@
"\n",
" print(f\"Science files selected for downloading: {len(sci_files_to_download)}\")\n",
" print(f\"Background files selected for downloading: {len(bg_files_to_download)}\")\n",
" print(f\"ASN files selected for downloading: {len(asn_files_to_download)}\")\n"
" print(f\"ASN files selected for downloading: {len(asn_files_to_download)}\")"
]
},
{
Expand Down Expand Up @@ -1344,7 +1343,7 @@
"det1dict['group_scale'], det1dict['dq_init'], det1dict['saturation'] = {}, {}, {}\n",
"det1dict['superbias'], det1dict['refpix'] = {}, {}\n",
"det1dict['linearity'], det1dict['dark_current'] = {}, {}\n",
"det1dict['jump'], det1dict['ramp_fit'], det1dict['gain_scale']= {}, {}, {}\n",
"det1dict['jump'], det1dict['ramp_fit'], det1dict['gain_scale'] = {}, {}, {}\n",
"\n",
"# Overrides for whether or not certain steps should be skipped (example).\n",
"det1dict['linearity']['skip'] = False # This is the default.\n",
Expand Down Expand Up @@ -1575,10 +1574,10 @@
" MAST_rate_file = get_jwst_file(os.path.basename(rate_file),\n",
" save_directory=mast_products_dir)\n",
" display_rate(MAST_rate_file, vmin=-0.1, vmax=1,\n",
" aspect=10, scale='asinh', title_prefix='MAST') #, extname='dq')\n",
" aspect=10, scale='asinh', title_prefix='MAST') # , extname='dq')\n",
"\n",
"display_rate(rate_file, vmin=-0.1, vmax=1,\n",
" aspect=10, scale='asinh', title_prefix='REPROCESSED') #, extname='dq')"
" aspect=10, scale='asinh', title_prefix='REPROCESSED') # , extname='dq')"
]
},
{
Expand Down Expand Up @@ -2454,7 +2453,7 @@
"\n",
"print(f\"Stage 3 CAL Products:\\n{'-'*20}\\n\" + \"\\n\".join(stage3_cal))\n",
"print(f\"Stage 3 S3D Products:\\n{'-'*20}\\n\" + \"\\n\".join(stage3_s2d))\n",
"print(f\"Stage 3 X1D Products:\\n{'-'*20}\\n\" + \"\\n\".join(stage3_x1d))\n"
"print(f\"Stage 3 X1D Products:\\n{'-'*20}\\n\" + \"\\n\".join(stage3_x1d))"
]
},
{
Expand Down

0 comments on commit a4bf82b

Please sign in to comment.