From 2f0e6c62609eb6edee6e29e7d3f021c2e748afc4 Mon Sep 17 00:00:00 2001 From: gibsongreen Date: Thu, 7 Nov 2024 22:22:12 -0500 Subject: [PATCH] ensure pipeline steps have access to necessary reference files --- .../BoxExtraction_using_Grismconf_CRDS.ipynb | 25 ++++++++++++++++++- .../requirements.txt | 3 ++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/BoxExtraction_using_Grismconf_CRDS.ipynb b/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/BoxExtraction_using_Grismconf_CRDS.ipynb index cea559e0e..74a89bd97 100755 --- a/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/BoxExtraction_using_Grismconf_CRDS.ipynb +++ b/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/BoxExtraction_using_Grismconf_CRDS.ipynb @@ -69,6 +69,7 @@ "import requests\n", "from scipy.stats import sigmaclip\n", "\n", + "from crds import client\n", "import grismconf\n", "from jwst.assign_wcs import AssignWcsStep\n", "from jwst.flatfield import FlatFieldStep\n", @@ -198,7 +199,7 @@ "id": "41068262-9a54-46c5-a9d2-ca2217ad1fee", "metadata": {}, "source": [ - "## Download Data" + "## Download Data and Ensure CRDS Configuration" ] }, { @@ -223,6 +224,28 @@ "get_jwst_file(wfss_file)" ] }, + { + "cell_type": "markdown", + "id": "faa27c94", + "metadata": {}, + "source": [ + "If CRDS is not configured, set the CRDS server URL and define a local cache path \n", + "to ensure the pipeline steps can access reference files as needed." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "af7a4057", + "metadata": {}, + "outputs": [], + "source": [ + "if os.environ.get(\"CRDS_PATH\") is None:\n", + " client.set_crds_server('https://jwst-crds.stsci.edu')\n", + " os.environ[\"CRDS_SERVER_URL\"] = \"https://jwst-crds.stsci.edu\"\n", + " os.environ[\"CRDS_PATH\"] = \"\"" + ] + }, { "cell_type": "markdown", "id": "ab5f3c78-258f-49c4-99c4-87e26f0972cf", diff --git a/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/requirements.txt b/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/requirements.txt index c6b18c9f1..94cdddf08 100755 --- a/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/requirements.txt +++ b/notebooks/NIRCam/NIRCam_WFSS_Box_extraction/requirements.txt @@ -5,4 +5,5 @@ jwst >= 1.16.0 matplotlib >= 3.9.2 numpy == 1.26.4 requests >= 2.32.3 -scipy >= 1.14.1 \ No newline at end of file +scipy >= 1.14.1 +crds >= 12.0.4 \ No newline at end of file