Skip to content

Commit

Permalink
Update workshop for Build 14 (#31)
Browse files Browse the repository at this point in the history
* Add webpsf env variable for source detection

* Update download script

* Fix syntax

* Update webbpsf for external users

* update webbpsf path

* Update webb psf directory

* Update webb psf directory again
  • Loading branch information
ddavis-stsci authored Jun 25, 2024
1 parent 7f98139 commit 8ec615a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
8 changes: 5 additions & 3 deletions 05-Intro_Roman_Pipeline/05-Intro_Roman_Pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "875abca6",
"metadata": {},
"outputs": [],
"source": [
"from romancal.pipeline import ExposurePipeline"
"from romancal.pipeline import ExposurePipeline\n",
"import os\n",
"os.environ[\"WEBBPSF_PATH\"] = os.getcwd()+\"/../data/webbpsf-data\""
]
},
{
Expand Down Expand Up @@ -487,7 +489,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
21 changes: 15 additions & 6 deletions data/download.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import shutil
from pathlib import Path
import requests



from astropy.utils.data import download_file

REMOTE_URL = "https://data.science.stsci.edu/redirect/Roman/Roman_Data_Workshop/"
REMOTE_PATHS = [
"ExampleData/Build13/r0000101001001001001_01101_0001_WFI01_uncal.asdf",
"ExampleData/Build13/r0000101001001001001_01101_0001_WFI01_cal.asdf",
"ExampleData/Build13/r0000101001001001001_01101_0001_WFI16_uncal.asdf",
"ExampleData/Build13/r0000101001001001001_01101_0001_WFI16_cal.asdf",
"ExampleData/Build13/r0000201001001001001_01101_0001_WFI01_cal.asdf",
"ExampleData/Build14/r0000101001001001001_01101_0001_WFI01_uncal.asdf",
"ExampleData/Build14/r0000101001001001001_01101_0001_WFI01_cal.asdf",
"ExampleData/Build14/r0000101001001001001_01101_0001_WFI16_uncal.asdf",
"ExampleData/Build14/r0000101001001001001_01101_0001_WFI16_cal.asdf",
"ExampleData/Build14/r0000201001001001001_01101_0001_WFI01_cal.asdf",
"ExampleData/jw01448013001_02105_00001_nis_rate.fits",
"ExampleData/jw01448013001_02106_00001_nis_rate.fits",
"ExampleData/jw01448013001_02106_00001_nis_cat.ecsv",
Expand All @@ -19,6 +22,7 @@
"ExampleData/jwst_niriss_wavelengthrange_0002.asdf",
]
LOCAL_DIRECTORY = Path(__file__).parent
WEBBPSF_DATA = Path('./data')/'Webbpsf-data-LATEST.tar.gz'


def download_data(overwrite: bool = False):
Expand All @@ -29,8 +33,13 @@ def download_data(overwrite: bool = False):
filename = download_file(REMOTE_URL + remote_path)
shutil.move(filename, local_path)

print("Done downloading files")
response = requests.get('https://stsci.box.com/shared/static/qxpiaxsjwo15ml6m4pkhtk36c9jgj70k.gz')

with open(WEBBPSF_DATA, 'wb') as f:
f.write(response.content)

print("Done downloading files")

if __name__ == "__main__":
download_data()
shutil.unpack_archive(WEBBPSF_DATA, Path('./data'))

0 comments on commit 8ec615a

Please sign in to comment.