Skip to content

Commit c83ae45

Browse files
committed
Use SpectrumDM service in euclid-cloud-access.md
1 parent c1dc0bd commit c83ae45

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tutorials/cloud_access/euclid-cloud-access.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ spec_association_tbl
277277
If you picked a target other than what this notebook uses, it's possible that there is no spectrum associated for your target's object ID. In that case, `spec_association_tbl` will contain 0 rows.
278278
```
279279

280-
In above table, we can see that the `uri` column gives us location of spectra file on IBE. We can map it to S3 bucket key to retrieve spectra file from the cloud. This is a very big FITS spectra file with multiple extensions where each extension contains spectrum of one object. The `hdu` column gives us the extension number for our object. So let's extract both of these.
280+
In above table, we can see that the `path` column gives us a url that can be used to call the SpectrumDM service to get the spectrum of our object. We can map it to an S3 bucket key to retrieve a spectra file from the cloud. This is a very big FITS spectra file with multiple extensions where each extension contains spectrum of one object. The `hdu` column gives us the extension number for our object. So let's extract both of these.
281281

282282
```{code-cell} ipython3
283-
spec_fpath_key = spec_association_tbl['uri'][0].replace('ibe/data/euclid/', '')
283+
spec_fpath_key = spec_association_tbl['path'][0].replace('api/spectrumdm/convert/euclid/', '').split('?')[0]
284284
spec_fpath_key
285285
```
286286

@@ -295,14 +295,16 @@ Again, we use astropy's lazy-loading capability of FITS to only retrieve the spe
295295
with fits.open(f's3://{BUCKET_NAME}/{spec_fpath_key}', fsspec_kwargs={'anon': True}) as hdul:
296296
spec_hdu = hdul[object_hdu_idx]
297297
spec_tbl = Table.read(spec_hdu)
298+
spec_header = spec_hdu.header
298299
```
299300

300301
```{code-cell} ipython3
301302
spec_tbl
302303
```
303304

304305
```{code-cell} ipython3
305-
plt.plot(spec_tbl['WAVELENGTH'], spec_tbl['SIGNAL'])
306+
# The signal needs to be multiplied by the scale factor in the header.
307+
plt.plot(spec_tbl['WAVELENGTH'], spec_header['FSCALE'] * spec_tbl['SIGNAL'])
306308
plt.xlabel(spec_tbl['WAVELENGTH'].unit.to_string('latex_inline'))
307309
plt.ylabel(spec_tbl['SIGNAL'].unit.to_string('latex_inline'))
308310
@@ -311,8 +313,8 @@ plt.title(f'Spectrum of Target: {target_name}\n(Euclid Object ID: {object_id})')
311313

312314
## About this Notebook
313315

314-
**Author:** Jaladh Singhal (IRSA Developer) in conjunction with Vandana Desai, Brigitta Sipőcz, Tiffany Meshkat and the IPAC Science Platform team
316+
**Author:** Jaladh Singhal (IRSA Developer) in conjunction with Vandana Desai, Brigitta Sipőcz, Tiffany Meshkat, Troy Raen, and the IRSA Data Science Team
315317

316-
**Updated:** 2025-03-17
318+
**Updated:** 2025-09-23
317319

318320
**Contact:** the [IRSA Helpdesk](https://irsa.ipac.caltech.edu/docs/help_desk.html) with questions or reporting problems.

0 commit comments

Comments
 (0)