@@ -50,7 +50,7 @@ Optional plots of flux versus wavelength
5050
5151``` {code-cell} ipython3
5252# Uncomment the next line to install dependencies if needed.
53- # !pip install astropy "astroquery>=0.4.10"
53+ # !pip install numpy matplotlib astropy "astroquery>=0.4.10"
5454```
5555
5656``` {code-cell} ipython3
@@ -65,7 +65,7 @@ from astroquery.vizier import Vizier
6565from astroquery.ipac.irsa import Irsa
6666
6767import warnings
68- #suppress warnings about cache
68+ # suppress warnings about cache
6969warnings.filterwarnings(
7070 "ignore",
7171 message="XDG_CACHE_HOME is set",
@@ -92,8 +92,8 @@ Users interested in other instruments or wavelength ranges are encouraged to exp
9292We begin by loading a published catalog of debris disk host stars from VizieR.
9393
9494``` {code-cell} ipython3
95- vizier = Vizier() # this instantiates Vizier with its default parameters
96- vizier.ROW_LIMIT = 150
95+ vizier = Vizier()
96+ vizier.ROW_LIMIT = 150 # Override the default limit of 50
9797# VizieR catalog identifier for Mittal et al. (2015)
9898mittal = "J/ApJ/798/87"
9999
@@ -123,12 +123,12 @@ debris_disks.colnames
123123Lets see if any of these debris disks have spectra in the IRSA archive
124124
125125``` {code-cell} ipython3
126- # IRSA queries require sky coordinates,
126+ # IRSA queries require sky coordinates,
127127# so we convert the RA and Dec columns into a vectorized SkyCoord object.
128128coords = SkyCoord(ra=debris_disks["_RA"],
129- dec=debris_disks["_DE"],
130- unit=u.deg,
131- frame='icrs')
129+ dec=debris_disks["_DE"],
130+ unit=u.deg,
131+ frame='icrs')
132132
133133# Just to make this tutorial run faster, we will limit the number of debris disks
134134coords = coords[0:10]
@@ -140,11 +140,11 @@ It optionally plots the retrieved spectra and includes inline comments explainin
140140We provide this as a function so it can be easily lifted from this tutorial and used in your own work.
141141
142142``` {code-cell} ipython3
143- def query_and_plot_spectra(positions, *, plot=True, verbose = True):
143+ def query_and_plot_spectra(positions, *, plot=True, verbose= True):
144144 """
145145 Query IRSA for Spitzer IRS spectra near each target position using SSA.
146146
147-
147+
148148 Parameters
149149 ----------
150150 positions : astropy.coordinates.SkyCoord
@@ -154,13 +154,13 @@ def query_and_plot_spectra(positions, *, plot=True, verbose = True):
154154 verbose : bool, optional
155155 If True, print status messages about query results.
156156 """
157- #for each set of coordinates
157+ # for each set of coordinates
158158 for i, sc in enumerate(positions):
159159 # Retrieve the target name from the debris disk catalog
160160 target_name = debris_disks["Name"][i]
161-
161+
162162 # Query the IRSA SSA service around this position
163- result = Irsa.query_ssa(pos=sc,
163+ result = Irsa.query_ssa(pos=sc,
164164 radius=5*u.arcsec,
165165 collection='spitzer_irsenh')
166166
@@ -170,19 +170,19 @@ def query_and_plot_spectra(positions, *, plot=True, verbose = True):
170170 print(f"No IRS spectra available for target {target_name}")
171171 continue
172172
173- # Let the user know we have a winner
173+ # Let the user know we have a winner
174174 if verbose:
175175 print(f"Found {len(result)} spectrum(s) for {target_name}")
176176
177177 # Loop through each spectrum returned for the object
178178 for j, row in enumerate(result):
179-
179+
180180 # Each SSA row includes an access URL pointing to the spectrum
181181 spectrum_url = row['access_url']
182-
182+
183183 # Read the spectrum into an Astropy Table
184184 single_spec = Table.read(spectrum_url, format="ipac")
185-
185+
186186 # If plotting is enabled, plot the spectrum.
187187 if plot:
188188 plt.figure()
@@ -191,15 +191,15 @@ def query_and_plot_spectra(positions, *, plot=True, verbose = True):
191191 plt.plot(single_spec['wavelength'], single_spec['flux_density'], label=label)
192192 else:
193193 plt.plot(single_spec['wavelength'], single_spec['flux_density'])
194-
194+
195195 plt.xlabel("Wavelength (μm))")
196196 plt.ylabel("Flux ")
197197 plt.title(f"Spitzer IRS Spectrum for {target_name}")
198-
198+
199199 # If more than one spectrum was found, add a legend
200200 if len(result) > 1:
201201 plt.legend()
202-
202+
203203 plt.tight_layout()
204204 plt.show()
205205```
0 commit comments