Skip to content

Commit 0875467

Browse files
authored
Merge pull request #64 from /issues/63/euclid-name-error
Fix `NameError` in Euclid SPE notebook
2 parents e021d74 + f8e4ca4 commit 0875467

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tutorials/euclid_access/5_Euclid_intro_SPE_catalog.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ from io import BytesIO
6363
import re
6464
6565
import matplotlib.pyplot as plt
66+
import numpy as np
6667
import pandas as pd
6768
import requests
6869
@@ -236,6 +237,8 @@ result_table = result.to_qtable()
236237
### Choose an object of interest, lets look at an object with a strong Halpha line detected with high SNR.
237238

238239
```{code-cell} ipython3
240+
result_table['object_id'] = result['object_id'].astype('int64')
241+
239242
obj_id = 2739401293646823742
240243
241244
obj_2739401293646823742 = result_table[(result_table['object_id'] == obj_id)]
@@ -277,17 +280,16 @@ with fits.open(BytesIO(response.content), memmap=True) as hdul:
277280
Divide by 10000 to convert from Angstrom to micron
278281

279282
```{code-cell} ipython3
280-
wavelengths = df_obj['spe_line_central_wl_gf']/10000.
281-
line_names = df_obj['spe_line_name']
282-
snr_gf=df_obj['spe_line_snr_gf']
283+
wavelengths = obj_2739401293646823742['spe_line_central_wl_gf']/10000.
284+
line_names = obj_2739401293646823742['spe_line_name']
285+
snr_gf = obj_2739401293646823742['spe_line_snr_gf']
283286
284287
plt.plot(df_obj_irsa['WAVELENGTH']/10000., df_obj_irsa['SIGNAL'])
285288
286-
for wl, name,snr in zip(wavelengths, line_names,snr_gf):
289+
for wl, name, snr in zip(np.atleast_1d(wavelengths), np.atleast_1d(line_names), np.atleast_1d(snr_gf)):
287290
plt.axvline(wl, color='b', linestyle='--', alpha=0.3)
288291
plt.text(wl+0.02, .1, name+' SNR='+str(round(snr)), rotation=90, ha='center', va='bottom', fontsize=10)
289292
290-
291293
plt.xlabel('Wavelength (microns)')
292294
plt.ylabel('Flux (erg / (Angstrom s cm2))')
293295
plt.title(obj_id)

0 commit comments

Comments
 (0)