Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to use S3 files #25

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions notebooks/data_visualization/data_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"import matplotlib.pyplot as plt\n",
"\n",
"from jdaviz import Imviz\n",
"import roman_datamodels as rdm"
"import roman_datamodels as rdm\n",
"import s3fs"
]
},
{
Expand Down Expand Up @@ -91,7 +92,7 @@
"## Loading data\n",
"For both of our examples, we will use the same data file. The example of creating static images can be used on any `numpy.ndarray` object and the WCS axes may be optionally included with any `astropy.wcs.WCS` object. The Jdaviz example below is designed to work for Roman, but Jdaviz can also work with other data and file types. For the interested reader, a link to the Jdaviz documentation is provided in the Additional Resources section below.\n",
"\n",
"A fuller explanation of how to load and work with Roman ASDF files is provided in the notebook tutorial XX, and we assume that the reader has already consulted that tutorial. For now, we will read in the data using the `roman_datamodels` package."
"A fuller explanation of how to load and work with Roman ASDF files is provided in the notebook tutorial Working with ASDF, and we assume that the reader has already consulted that tutorial. For now, we will read in the data using the `roman_datamodels` package."
]
},
{
Expand All @@ -100,7 +101,12 @@
"metadata": {},
"outputs": [],
"source": [
"file = rdm.open('r0000101001001001001_01101_0001_WFI16_cal.asdf')"
"asdf_dir_uri = 's3://roman-sci-test-data-prod-summer-beta-test/'\n",
"fs = s3fs.S3FileSystem()\n",
"\n",
"asdf_file_uri = asdf_dir_uri + 'ROMANISIM/DENSE_REGION/R0.5_DP0.5_PA0/r0000101001001001001_01101_0001_WFI16_cal.asdf'\n",
"with fs.open(asdf_file_uri, 'rb') as f:\n",
" file = rdm.open(f)"
]
},
{
Expand Down Expand Up @@ -213,8 +219,14 @@
"metadata": {},
"outputs": [],
"source": [
"imviz.load_data('r0000101001001001001_01101_0001_WFI16_cal.asdf', data_label='WFI16_POS1')\n",
"# imviz.load_data('r0000101001001001001_01101_0002_WFI16_cal.asdf', ext='dq', data_label='WFI16 DQ')"
"asdf_dir_uri = 's3://roman-sci-test-data-prod-summer-beta-test/'\n",
"fs = s3fs.S3FileSystem()\n",
"\n",
"asdf_file_uri = asdf_dir_uri + 'ROMANISIM/DENSE_REGION/R0.5_DP0.5_PA0/r0000101001001001001_01101_0001_WFI16_cal.asdf'\n",
"with fs.open(asdf_file_uri, 'rb') as f:\n",
" file = rdm.open(f)\n",
" imviz.load_data(file, data_label='WFI16_POS1')\n",
" # imviz.load_data(file, ext='dq', data_label='WFI16 DQ')"
]
},
{
Expand Down Expand Up @@ -252,7 +264,10 @@
"metadata": {},
"outputs": [],
"source": [
"imviz.load_data('r0000101001001001001_01101_0002_WFI16_cal.asdf', data_label='WFI16_POS2')\n",
"asdf_file_uri = asdf_dir_uri + 'ROMANISIM/DENSE_REGION/R0.47_DP0.51_PA0/r0000101001001001001_01101_0002_WFI16_cal.asdf'\n",
"with fs.open(asdf_file_uri, 'rb') as f:\n",
" file = rdm.open(f)\n",
" imviz.load_data(file, data_label='WFI16_POS2')\n",
"\n",
"viewer = imviz.default_viewer\n",
"viewer.stretch_options\n",
Expand Down
Loading