Skip to content

Commit

Permalink
some PEP8 style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kglidic committed Jan 14, 2025
1 parent 7860731 commit 32fd41f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions notebooks/NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"# Control logging level: INFO, WARNING, ERROR\n",
"# Run command loging.disable if want to hide logging\n",
"# ERROR messages.\n",
"#logging.disable(logging.ERROR)\n",
"# logging.disable(logging.ERROR)\n",
"warnings.simplefilter(\"ignore\", RuntimeWarning)"
]
},
Expand Down Expand Up @@ -227,7 +227,7 @@
"# the CRDS_CONTEXT environment variable. Here we show how this is done,\n",
"# although we leave the line commented out in order to use the default context.\n",
"# If you wish to specify a different context, uncomment the line below.\n",
"#os.environ['CRDS_CONTEXT'] = 'jwst_1298.pmap' # CRDS context for 1.16.0\n",
"# os.environ['CRDS_CONTEXT'] = 'jwst_1298.pmap' # CRDS context for 1.16.0\n",
"\n",
"# Set CRDS cache directory to user home if not already set.\n",
"if os.getenv('CRDS_PATH') is None:\n",
Expand Down Expand Up @@ -1070,7 +1070,8 @@
"if bg_dir:\n",
" rate_bg = sorted(glob.glob(det1_bgdir + '*_rate.fits'))\n",
" rateints_bg = sorted(glob.glob(det1_bgdir + '*_rateints.fits'))\n",
" print(f\"BACKGROUND | RATE[INTS] Files:\\n{'-'*20}\\n\" + \"\\n\".join(rate_bg + rateints_bg))"
" print(f\"BACKGROUND | RATE[INTS] Files:\\n{'-' * 20}\\n\"\n",
" + \"\\n\".join(rate_bg + rateints_bg))"
]
},
{
Expand Down Expand Up @@ -1246,13 +1247,14 @@
"if bg_dir:\n",
"\n",
" # Retrieve background observation number if not in demo_mode for filtering.\n",
" bg_observtn = globals().get('bg_observtn', fits.getval(rate_bg[0], 'observtn') if rate_bg else None)\n",
" bg_obs_asn = [asn for asn in spec2_asn_all if f\"-o{bg_observtn}\" in asn]\n",
" \n",
" bg_obs = globals().get('bg_observtn',\n",
" fits.getval(rate_bg[0], 'observtn') if rate_bg else None)\n",
" bg_obs_asn = [asn for asn in spec2_asn_all if f\"-o{bg_obs}\" in asn]\n",
"\n",
" # Filter for ASN files with leakcal exposures.\n",
" spec2_bg_asn_with_leakcal = [asn for asn in bg_obs_asn if is_leakcal_present(asn)]\n",
"\n",
" # Use leakcal ASNs if available, otherwise fallback to ASNs with just the background.\n",
" # Use leakcal ASNs if available, otherwise use ASNs with just the background.\n",
" spec2_bg_asn = spec2_bg_asn_with_leakcal or bg_obs_asn\n",
" print(f\"Stage 2 Background ASN Files:\\n{'-'*20}\\n{chr(10).join(spec2_bg_asn)}\")"
]
Expand Down Expand Up @@ -1388,8 +1390,8 @@
"\n",
" try:\n",
" asn_data = json.load(open(asn))\n",
" sci_file = os.path.basename(asn_data['products'][0]['members'][0]['expname'])\n",
" print(f\"Applying Stage 2 Corrections & Calibrations to: {sci_file}\")\n",
" scifile = os.path.basename(asn_data['products'][0]['members'][0]['expname'])\n",
" print(f\"Applying Stage 2 Corrections & Calibrations to: {scifile}\")\n",
"\n",
" spec2sci_result = Spec2Pipeline.call(asn,\n",
" save_results=True,\n",
Expand Down Expand Up @@ -1677,7 +1679,7 @@
" spec3_asn = os.path.join(asn_dir, asn_filename)\n",
" with open(spec3_asn, \"w\") as fd:\n",
" fd.write(serialized)\n",
" \n",
"\n",
" if isinstance(spec3_asn, str):\n",
" spec3_asn = [spec3_asn]\n",
" print(f\"Stage 3 ASN Files:\\n{'-'*20}\\n\" + \"\\n\".join(spec3_asn))"
Expand Down

0 comments on commit 32fd41f

Please sign in to comment.