Skip to content

Commit

Permalink
move crds config to right below imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gibsongreen committed Nov 13, 2024
1 parent bc8d377 commit 602fba8
Showing 1 changed file with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,49 @@
"from jwst.photom import PhotomStep"
]
},
{
"cell_type": "markdown",
"id": "d6b0fc4b",
"metadata": {},
"source": [
"## Set CRDS Path and Server"
]
},
{
"cell_type": "markdown",
"id": "bb09075d-b0ba-4bee-b6c5-a2f27b767b6a",
"metadata": {},
"source": [
"Before running the pipeline steps, we need to ensure our our CRDS environment is configured. This includes defining a CRDS cache directory in which to keep the reference files that will be used by the calibration pipeline.\n",
"\n",
"If the root directory for the local CRDS cache has not already been set, it will be created in the home directory."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ab935ab-a215-4fe3-8aad-b3dae5a017bb",
"metadata": {},
"outputs": [],
"source": [
"# Check whether the local CRDS cache directory has been set.\n",
"# If not, set it to the user home directory\n",
"if (os.getenv('CRDS_PATH') is None):\n",
" os.environ['CRDS_PATH'] = os.path.join(os.path.expanduser('~'), 'crds')\n",
"# Check whether the CRDS server URL has been set. If not, set it.\n",
"if (os.getenv('CRDS_SERVER_URL') is None):\n",
" os.environ['CRDS_SERVER_URL'] = 'https://jwst-crds.stsci.edu'\n",
"\n",
"# Echo CRDS path and context in use\n",
"print('CRDS local filepath:', os.environ['CRDS_PATH'])\n",
"print('CRDS file server:', os.environ['CRDS_SERVER_URL'])\n",
"\n",
"# import crds after setting up the required environment variables\n",
"from crds import client\n",
"if client.get_crds_server() != os.environ['CRDS_SERVER_URL']:\n",
" client.set_crds_server('https://jwst-crds.stsci.edu')"
]
},
{
"cell_type": "markdown",
"id": "117e4ec7-610c-4d11-82f4-756971dc23e0",
Expand Down Expand Up @@ -223,49 +266,6 @@
"get_jwst_file(wfss_file)"
]
},
{
"cell_type": "markdown",
"id": "d6b0fc4b",
"metadata": {},
"source": [
"## Set CRDS Path and Server"
]
},
{
"cell_type": "markdown",
"id": "faa27c94",
"metadata": {},
"source": [
"Before running the pipeline steps, we need to ensure our our CRDS environment is configured. This includes defining a CRDS cache directory in which to keep the reference files that will be used by the calibration pipeline.\n",
"\n",
"If the root directory for the local CRDS cache has not already been set, it will be created in the home directory."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "da17a337",
"metadata": {},
"outputs": [],
"source": [
"# Check whether the local CRDS cache directory has been set.\n",
"# If not, set it to the user home directory\n",
"if (os.getenv('CRDS_PATH') is None):\n",
" os.environ['CRDS_PATH'] = os.path.join(os.path.expanduser('~'), 'crds')\n",
"# Check whether the CRDS server URL has been set. If not, set it.\n",
"if (os.getenv('CRDS_SERVER_URL') is None):\n",
" os.environ['CRDS_SERVER_URL'] = 'https://jwst-crds.stsci.edu'\n",
"\n",
"# Echo CRDS path and context in use\n",
"print('CRDS local filepath:', os.environ['CRDS_PATH'])\n",
"print('CRDS file server:', os.environ['CRDS_SERVER_URL'])\n",
"\n",
"# import crds after setting up the required environment variables\n",
"from crds import client\n",
"if client.get_crds_server() != os.environ['CRDS_SERVER_URL']:\n",
" client.set_crds_server('https://jwst-crds.stsci.edu')"
]
},
{
"cell_type": "markdown",
"id": "ab5f3c78-258f-49c4-99c4-87e26f0972cf",
Expand Down

0 comments on commit 602fba8

Please sign in to comment.