@@ -156,7 +156,6 @@ tables = service.tables
156156for tablename in tables.keys():
157157 if "tap_schema" not in tablename and "euclid" in tablename:
158158 tables[tablename].describe()
159-
160159```
161160
162161``` {code-cell} ipython3
@@ -171,7 +170,7 @@ table_spe= 'euclid_q1_spe_lines_line_features'
171170- List the column names
172171
173172``` {code-cell} ipython3
174- columns = tables[table_galaxy_candidates ].columns
173+ columns = tables[table_spe ].columns
175174print(len(columns))
176175```
177176
@@ -195,28 +194,30 @@ pd.set_option('display.max_colwidth', None)
195194## Find some objects with spectra in our tileID
196195
197196We specify the following conditions on our search:
198- - The two signal to noise ratio columns (spe_line_snr_gf and spe_line_snr_di ) should be greater than 5
197+ - Signal to noise ratio column ( _ gf = gaussian fit ) should be greater than 5
199198- We want to detect H-alpha.
200199- We choose in which tileID to search, usign the tileID from the first notebook.
201200- Choose spectroscopic redshift (spe_z) beween 1.4 and 1.6 and spe_z_prob greater than 0.999
201+ - H-alpha line flux should be more than 2x10^16 erg s^-1 cm^-2
202+ - Join the lines and galaxy candidates tables on object_id and spe_rank
202203
203204Finally we sort the data by descending spe_line_snr_gf to have the largest SNR H-alpha lines detected at the top.
204205
205206``` {code-cell} ipython3
206207adql = f"SELECT DISTINCT mer.object_id,mer.ra, mer.dec, mer.tileid, mer.flux_y_templfit, \
207208spe.spe_line_snr_gf,spe.spe_line_snr_di, spe.spe_line_name, spe.spe_line_central_wl_gf,\
208- spe.spe_line_ew_gf, galaxy.spe_z_err, galaxy.spe_z,galaxy.spe_z_prob \
209+ spe.spe_line_ew_gf, galaxy.spe_z_err, galaxy.spe_z,galaxy.spe_z_prob, spe.spe_line_flux_gf, spe.spe_line_flux_err_gf \
209210FROM {table_mer} AS mer \
210211JOIN {table_spe} AS spe \
211212ON mer.object_id = spe.object_id \
212213JOIN {table_galaxy_candidates} AS galaxy \
213- ON mer .object_id = galaxy.object_id \
214+ ON spe .object_id = galaxy.object_id AND spe.spe_rank = galaxy.spe_rank \
214215WHERE spe.spe_line_snr_gf >5 \
215- AND spe.spe_line_snr_di > 5 \
216216AND spe.spe_line_name = 'Halpha' \
217217AND mer.tileid = {tileID} \
218- AND galaxy.spe_z_prob > 0.999 \
218+ AND galaxy.spe_z_prob > 0.99 \
219219AND galaxy.spe_z BETWEEN 1.4 AND 1.6 \
220+ AND spe.spe_line_flux_gf > 2E-16 \
220221ORDER BY spe.spe_line_snr_gf DESC \
221222"
222223
@@ -225,18 +226,20 @@ result = service.search(adql)
225226
226227# Convert table to pandas dataframe and drop duplicates
227228result_table = result.to_qtable()
229+
230+ result_table['spe_line_flux_gf'].info.format = ".8e" # Scientific notation with 8 decimal places
231+ result_table['spe_line_flux_err_gf'].info.format = ".8e"
232+ result_table['object_id'] = result['object_id'].astype('int64')
228233```
229234
230235### Choose an object of interest, lets look at an object with a strong Halpha line detected with high SNR.
231236
232237``` {code-cell} ipython3
233- result_table['object_id'] = result['object_id'].astype('int64')
234-
235- obj_id = 2739401293646823742
238+ obj_id = 2737659721646729968
236239
237- obj_2739401293646823742 = result_table[(result_table['object_id'] == obj_id)]
240+ obj_tab = result_table[(result_table['object_id'] == obj_id)]
238241
239- obj_2739401293646823742
242+ obj_tab
240243```
241244
242245### Pull the spectrum of this object
@@ -265,7 +268,6 @@ with fits.open(BytesIO(response.content), memmap=True) as hdul:
265268 hdu = hdul[df2['hdu'].iloc[0]]
266269 dat = Table.read(hdu, format='fits', hdu=1)
267270 df_obj_irsa = dat.to_pandas()
268-
269271```
270272
271273### Now the data are read in, plot the spectrum with the H-alpha line labeled
0 commit comments