From 32fd41f09e2c21b95a3f92b381ca902a2cb23307 Mon Sep 17 00:00:00 2001 From: Kayli Date: Tue, 14 Jan 2025 02:45:19 -0500 Subject: [PATCH] some PEP8 style fixes --- .../NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/notebooks/NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb b/notebooks/NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb index 493fb70..8fd2e3c 100644 --- a/notebooks/NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb +++ b/notebooks/NIRSPEC/ifu/JWPipeNB-NIRSpec-IFU.ipynb @@ -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)" ] }, @@ -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", @@ -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))" ] }, { @@ -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)}\")" ] @@ -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", @@ -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))"