Skip to content

Commit 5b93a30

Browse files
committed
Use SpectrumDM service in 3_Euclid_intro_1D_spectra.md
1 parent c83ae45 commit 5b93a30

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

tutorials/euclid_access/3_Euclid_intro_1D_spectra.md

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -100,40 +100,26 @@ result = Irsa.query_tap(adql_object).to_table()
100100
Pull out the file name from the ``result`` table:
101101

102102
```{code-cell} ipython3
103-
file_uri = urllib.parse.urljoin(Irsa.tap_url, result['uri'][0])
104-
file_uri
103+
spectrum_path = urllib.parse.urljoin(Irsa.tap_url, result['path'][0])
104+
spectrum_path
105105
```
106106

107107
## 3. Read in the spectrum for only our specific object
108108

109-
Currently IRSA has the spectra stored in very large files containing multiple (14220) extensions with spectra of many targets within one tile. You can choose to read in the big file below to see what it looks like (takes a few mins to load) or skip this step and just read in the specific extension we want for the 1D spectra (recommended).
109+
`spectrum_path` is a url that will return a VOTable containing the spectrum of our object.
110110

111111
```{code-cell} ipython3
112-
# hdul = fits.open(file_uri)
113-
# hdul.info()
114-
```
115-
116-
Open the large FITS file without loading it entirely into memory, pulling out just the extension we want for the 1D spectra of our object
117-
118-
```{code-cell} ipython3
119-
with fits.open(file_uri) as hdul:
120-
spectrum = QTable.read(hdul[result['hdu'][0]], format='fits')
121-
122-
spec_header = hdul[result['hdu'][0]].header
112+
spectrum = QTable.read(spectrum_path)
123113
```
124114

125115
```{code-cell} ipython3
126116
spectrum
127117
```
128118

129-
```{code-cell} ipython3
130-
spec_header
131-
```
132-
133119
## 4. Plot the image of the extracted spectrum
134120

135121
```{tip}
136-
As we use astropy.visualization's ``quantity_support``, matplotlib automatically picks up the axis units from the quantitites we plot.
122+
As we use astropy.visualization's ``quantity_support``, matplotlib automatically picks up the axis units from the quantities we plot.
137123
```
138124

139125
```{code-cell} ipython3
@@ -143,15 +129,11 @@ quantity_support()
143129
```{note}
144130
The 1D combined spectra table contains 6 columns, below are a few highlights:
145131
146-
- WAVELENGTH is in Angstroms by default
147-
- SIGNAL is the flux and should be multiplied by the FSCALE factor in the header
132+
- WAVELENGTH is in Angstroms by default.
133+
- SIGNAL is the flux. The scale factor is included in the units.
148134
- MASK values can be used to determine which flux bins to discard. MASK = odd and MASK >=64 means the flux bins not be used.
149135
```
150136

151-
```{code-cell} ipython3
152-
signal_scaled = spectrum['SIGNAL'] * spec_header['FSCALE']
153-
```
154-
155137
We investigate the MASK column to see which flux bins are recommended to keep vs "Do Not Use"
156138

157139
```{code-cell} ipython3
@@ -165,19 +147,19 @@ We use the MASK column to create a boolean mask for values to ignore. We use the
165147
```{code-cell} ipython3
166148
bad_mask = (spectrum['MASK'].value % 2 == 1) | (spectrum['MASK'].value >= 64)
167149
168-
plt.plot(spectrum['WAVELENGTH'].to(u.micron), np.ma.masked_where(bad_mask, signal_scaled), color='black', label='Spectrum')
169-
plt.plot(spectrum['WAVELENGTH'], np.ma.masked_where(~bad_mask, signal_scaled), color='red', label='Do not use')
170-
plt.plot(spectrum['WAVELENGTH'], np.sqrt(spectrum['VAR']) * spec_header['FSCALE'], color='grey', label='Error')
150+
plt.plot(spectrum['WAVELENGTH'].to(u.micron), np.ma.masked_where(bad_mask, spectrum['SIGNAL']), color='black', label='Spectrum')
151+
plt.plot(spectrum['WAVELENGTH'], np.ma.masked_where(~bad_mask, spectrum['SIGNAL']), color='red', label='Do not use')
152+
plt.plot(spectrum['WAVELENGTH'], np.sqrt(spectrum['VAR']), color='grey', label='Error')
171153
172154
plt.legend(loc='upper right')
173-
plt.ylim(-0.15E-16, 0.25E-16)
155+
plt.ylim(-0.15, 0.25)
174156
plt.title(f'Object ID {obj_id}')
175157
```
176158

177159
## About this Notebook
178160

179-
**Author**: Tiffany Meshkat, Anahita Alavi, Anastasia Laity, Andreas Faisst, Brigitta Sipőcz, Dan Masters, Harry Teplitz, Jaladh Singhal, Shoubaneh Hemmati, Vandana Desai
161+
**Author**: Tiffany Meshkat, Anahita Alavi, Anastasia Laity, Andreas Faisst, Brigitta Sipőcz, Dan Masters, Harry Teplitz, Jaladh Singhal, Shoubaneh Hemmati, Vandana Desai, Troy Raen
180162

181-
**Updated**: 2025-03-31
163+
**Updated**: 2025-09-23
182164

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

0 commit comments

Comments
 (0)