Skip to content

Commit 70d4b96

Browse files
committed
MAINT: cleanup imports and empty cells
1 parent d17e448 commit 70d4b96

File tree

4 files changed

+47
-172
lines changed

4 files changed

+47
-172
lines changed

tutorials/euclid_access/1_Euclid_intro_MER_images.md

Lines changed: 20 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -54,45 +54,29 @@ Each MER image is approximately 1.47 GB. On Caltech wifi this takes between 1-5
5454
## Imports
5555

5656
```{code-cell} ipython3
57-
# Uncomment the next lines to install dependencies if needed
57+
# Uncomment the next line to install dependencies if needed.
58+
# !pip install numpy astropy matplotlib pyvo sep>=1.4 fsspec pandas
59+
```
5860

59-
# Installation for pip
60-
# !pip install sep
61-
# !pip install astropy
62-
# !pip install pyvo
63-
# !pip install requests
64-
# !pip install fsspec[http]
61+
```{code-cell} ipython3
62+
import re
6563
64+
import numpy as np
65+
import pandas as pd
6666
67-
# Installation for conda
68-
# !conda install -c conda-forge sep
69-
# !conda install -c conda-forge astropy
70-
# !conda install -c conda-forge pyvo
71-
# !conda install requests
72-
# !conda install -c conda-forge fsspec requests aiohttp
73-
```
67+
import matplotlib.pyplot as plt
68+
from matplotlib.patches import Ellipse
7469
75-
```{code-cell} ipython3
76-
from astropy.io import fits
7770
from astropy.coordinates import SkyCoord
78-
from astropy import units
79-
from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStretch, ZScaleInterval, SquaredStretch
71+
from astropy.io import fits
8072
from astropy.nddata import Cutout2D
81-
from astropy.wcs import WCS
8273
from astropy.utils.data import download_file
74+
from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStretch, ZScaleInterval, SquaredStretch
75+
from astropy.wcs import WCS
76+
from astropy import units as u
8377
84-
import numpy as np
85-
import matplotlib.pyplot as plt
86-
from matplotlib.patches import Ellipse
87-
import os
88-
from os import listdir
89-
from os.path import isfile, join
90-
import pandas as pd
91-
import glob
92-
import sep
93-
import re
9478
import pyvo as vo
95-
import fsspec
79+
import sep
9680
```
9781

9882
# Introduction to Euclid Q1 MER mosaics
@@ -103,15 +87,8 @@ import fsspec
10387
Below are the object name and coordinates and our search radius
10488

10589
```{code-cell} ipython3
106-
name = 'HD 168151'
107-
108-
ra = 273.474451
109-
dec = 64.397273
110-
111-
search_radius = 1.5 * units.arcmin
112-
pos = SkyCoord(ra=ra, dec=dec, unit='deg')
113-
114-
coord = SkyCoord(ra, dec, unit=(units.deg,units.deg), frame='icrs')
90+
search_radius = 10 * u.arcsec
91+
coord = SkyCoord.from_name('HD 168151')
11592
```
11693

11794
Use IRSA to search for all Euclid data on this target.
@@ -121,14 +98,13 @@ This query will return any image with pixels that overlap the search region.
12198
```{code-cell} ipython3
12299
irsa_service= vo.dal.sia2.SIA2Service('https://irsadev.ipac.caltech.edu/SIA')
123100
124-
im_table = irsa_service.search(pos=(pos.ra.deg, pos.dec.deg, 10*units.arcsec),
125-
collection='euclid_DpdMerBksMosaic')
101+
image_table = irsa_service.search(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
126102
```
127103

128104
Convert the table to pandas dataframe
129105

130106
```{code-cell} ipython3
131-
df_im_irsa=im_table.to_table().to_pandas()
107+
df_im_irsa=image_table.to_table().to_pandas()
132108
```
133109

134110
Change the settings so we can see all the columns in the dataframe and the full column width (to see the full long URL)
@@ -155,14 +131,6 @@ df_im_euclid.head()
155131
print('There are',len(df_im_euclid),'MER images of this object/MER tile.')
156132
```
157133

158-
```{code-cell} ipython3
159-
160-
```
161-
162-
```{code-cell} ipython3
163-
164-
```
165-
166134
## 2. Retrieve a Euclid Q1 MER mosaic image in the VIS bandpass
167135

168136
+++
@@ -282,7 +250,7 @@ filters
282250
```{code-cell} ipython3
283251
######################## User defined section ############################
284252
## How large do you want the image cutout to be?
285-
im_cutout= 1.0 * units.arcmin
253+
im_cutout= 1.0 * u.arcmin
286254
287255
## What is the center of the cutout?
288256
## For now choosing a random location on the image
@@ -294,7 +262,7 @@ dec = 64.525
294262
# ra = 273.474451
295263
# dec = 64.397273
296264
297-
coords_cutout = SkyCoord(ra, dec, unit=(units.deg,units.deg), frame='icrs')
265+
coords_cutout = SkyCoord(ra, dec, unit=(u.deg, u.deg), frame='icrs')
298266
299267
##########################################################################
300268
@@ -434,7 +402,6 @@ print("Found", len(sources_thr), "objects above flux threshold")
434402
We plot the VIS cutout with the sources detected overplotted with a red ellipse
435403

436404
```{code-cell} ipython3
437-
438405
fig, ax = plt.subplots()
439406
m, s = np.mean(data_sub), np.std(data_sub)
440407
im = ax.imshow(data_sub, cmap='gray', origin='lower', norm=ImageNormalize(img2, interval=ZScaleInterval(), stretch=SquaredStretch()))

tutorials/euclid_access/2_Euclid_intro_MER_catalog.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,14 @@ Each entry in the MER catalog is a single source containing all its photometry f
4646
## Imports
4747

4848
```{code-cell} ipython3
49-
# Uncomment the next lines to install dependencies if needed
50-
51-
# Installation for pip
52-
# !pip install sep
53-
# !pip install astropy
54-
# !pip install pyvo
55-
56-
57-
# Installation for conda
58-
# !conda install -c conda-forge sep
59-
# !conda install -c conda-forge astropy
60-
# !conda install -c conda-forge pyvo
49+
# Uncomment the next line to install dependencies if needed
50+
# !pip install numpy matplotlib pyvo
6151
```
6252

6353
```{code-cell} ipython3
64-
from astropy.io import fits
65-
from astropy.coordinates import SkyCoord
66-
from astropy import units
67-
from astropy.wcs import WCS
68-
from astropy.io.votable import parse
69-
7054
import numpy as np
7155
import matplotlib.pyplot as plt
72-
import os
73-
from os import listdir
74-
from os.path import isfile, join
75-
import pandas as pd
76-
import glob
77-
import sep
56+
7857
import pyvo as vo
7958
```
8059

tutorials/euclid_access/3_Euclid_intro_1D_spectra.md

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,21 @@ This notebook provides an introduction to the SIR 1D spectra released as part of
5050
## Imports
5151

5252
```{code-cell} ipython3
53-
# Uncomment the next lines to install dependencies if needed
54-
55-
# Installation for pip
56-
# !pip install astropy
57-
# !pip install pyvo
58-
59-
60-
# Installation for conda
61-
# !conda install -c conda-forge astropy
62-
# !conda install -c conda-forge pyvo
53+
# Uncomment the next line to install dependencies if needed
54+
# !pip install matplotlib pandas requests astropy pyvo
6355
```
6456

6557
```{code-cell} ipython3
66-
from astropy.io import fits
67-
from astropy.coordinates import SkyCoord
68-
from astropy import units
69-
from astropy.wcs import WCS
70-
from astropy.table import Table
71-
from astropy.units import UnitsWarning
58+
from io import BytesIO
7259
73-
import warnings
74-
import math
75-
import numpy as np
7660
import matplotlib.pyplot as plt
77-
import os
78-
from os import listdir
79-
from os.path import isfile, join
8061
import pandas as pd
81-
import glob
82-
import pyvo as vo
83-
from io import BytesIO
8462
import requests
63+
64+
from astropy.io import fits
65+
from astropy.table import Table
66+
67+
import pyvo as vo
8568
```
8669

8770
# Introduction to Euclid Q1 1D spectra
@@ -121,10 +104,6 @@ pd.set_option('display.max_colwidth', None)
121104
# pd.reset_option('display.max_colwidth')
122105
```
123106

124-
```{code-cell} ipython3
125-
126-
```
127-
128107
## 2. Search for the spectrum of a specific galaxy in the 1D spectra table
129108

130109
```{code-cell} ipython3

tutorials/euclid_access/5_Euclid_intro_SPE_catalog.md

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ These notebooks focus on how to access, download, and process Euclid Q1 data fro
3737

3838
Every one dimensional spectrum is processed through a template and line fitting pipeline, producing several different 'SPE' catalogs. This notebook provides an introduction to the SPE catalogs released as part of Euclid Q1. Other Euclid notebooks show how to use other data products released as part of Euclid Q1.
3939

40-
```{code-cell} ipython3
41-
42-
```
4340

4441
### NOTE to testers -- please log in to IPAC vpn to access the IRSAdev data. After the Q1 data release, we will not need to use the IPAC VPN or the irsadev site.
4542

@@ -48,47 +45,27 @@ Every one dimensional spectrum is processed through a template and line fitting
4845
## Imports
4946

5047
```{code-cell} ipython3
51-
# Uncomment the next lines to install dependencies if needed
52-
53-
# Installation for pip
54-
# !pip install sep
55-
# !pip install astropy
56-
# !pip install pyvo
57-
58-
59-
# Installation for conda
60-
# !conda install -c conda-forge sep
61-
# !conda install -c conda-forge astropy
62-
# !conda install -c conda-forge pyvo
48+
# Uncomment the next line to install dependencies if needed
49+
# !pip install matplotlib pandas astropy pyvo
6350
```
6451

6552
```{code-cell} ipython3
66-
from astropy.io import fits
67-
from astropy.coordinates import SkyCoord
68-
from astropy import units
69-
from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStretch
70-
from astropy.nddata import Cutout2D
71-
from astropy.wcs import WCS
72-
from astropy.table import Table
73-
from astropy.utils.data import download_file
53+
from io import BytesIO
54+
import re
7455
75-
import numpy as np
7656
import matplotlib.pyplot as plt
77-
import os
78-
from os import listdir
79-
from os.path import isfile, join
8057
import pandas as pd
81-
import glob
82-
import sep
83-
import pyvo as vo
84-
import re
85-
from io import BytesIO
8658
import requests
87-
```
8859
89-
# Introduction to Euclid Q1 SPE catalog
60+
from astropy.coordinates import SkyCoord
61+
from astropy.io import fits
62+
from astropy.table import Table
63+
from astropy import units as u
64+
from astropy.utils.data import download_file
65+
from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStretch
9066
91-
+++
67+
import pyvo as vo
68+
```
9269

9370
## 1. Find the MER Tile ID that corresponds to a given RA and Dec
9471

@@ -98,10 +75,10 @@ In this case, choose the coordinates from the first notebook to save time downlo
9875
ra = 273.474451
9976
dec = 64.397273
10077
101-
search_radius = 1.5 * units.arcmin
78+
search_radius = 1.5 * u.arcmin
10279
pos = SkyCoord(ra=ra, dec=dec, unit='deg')
10380
104-
coord = SkyCoord(ra, dec, unit=(units.deg,units.deg), frame='icrs')
81+
coord = SkyCoord(ra, dec, unit=(u.deg, u.deg), frame='icrs')
10582
```
10683

10784
### Use IRSA to search for all Euclid data on this target
@@ -111,12 +88,11 @@ This searches specifically in the euclid_DpdMerBksMosaic "collection" which is t
11188
```{code-cell} ipython3
11289
irsa_service= vo.dal.sia2.SIA2Service('https://irsadev.ipac.caltech.edu/SIA')
11390
114-
im_table = irsa_service.search(pos=(pos.ra.deg, pos.dec.deg, 10*units.arcsec),
91+
im_table = irsa_service.search(pos=(pos.ra.deg, pos.dec.deg, 10*u.arcsec),
11592
collection='euclid_DpdMerBksMosaic')
11693
11794
## Convert the table to pandas dataframe
11895
df_im_irsa=im_table.to_table().to_pandas()
119-
12096
```
12197

12298
```{code-cell} ipython3
@@ -346,41 +322,15 @@ plt.ylabel('Flux (erg / (Angstrom s cm2))')
346322
plt.title(obj_id)
347323
```
348324

349-
```{code-cell} ipython3
350-
351-
```
352-
353325
## Additional Resources
354326

355327
If you have any issues accessing data from the archives, please contact the helpdesk directly: IRSA ([email protected]) and ESA (https://support.cosmos.esa.int/euclid).
356328

357-
```{code-cell} ipython3
358-
359-
```
329+
+++
360330

361331
## About this Notebook
362332

363333
**Author(s)**: Tiffany Meshkat <br>
364334
**Keyword(s)**: Euclid, Q1, spe catalog <br>
365335
**First published**: March 19, 2025 <br>
366336
**Last updated**: March 19, 2025
367-
368-
```{code-cell} ipython3
369-
370-
```
371-
372-
```{code-cell} ipython3
373-
374-
```
375-
376-
```{code-cell} ipython3
377-
378-
```
379-
380-
```{code-cell} ipython3
381-
382-
```
383-
384-
```{code-cell} ipython3
385-
386-
```

0 commit comments

Comments
 (0)