Skip to content

Commit 03aba72

Browse files
committed
Swapping some pyvo calls for astroquery for 1_euclid
1 parent 657538f commit 03aba72

File tree

1 file changed

+13
-34
lines changed

1 file changed

+13
-34
lines changed

tutorials/euclid_access/1_Euclid_intro_MER_images.md

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Each MER image is approximately 1.47 GB. Downloading can take some time.
5858

5959
```{code-cell} ipython3
6060
# Uncomment the next line to install dependencies if needed.
61-
# !pip install numpy 'astropy>=5.3' matplotlib pyvo 'sep>=1.4' fsspec pandas
61+
# !pip install numpy 'astropy>=5.3' matplotlib 'astroquery>=0.4.10' 'sep>=1.4' fsspec
6262
```
6363

6464
```{code-cell} ipython3
@@ -78,7 +78,7 @@ from astropy.visualization import ImageNormalize, PercentileInterval, AsinhStret
7878
from astropy.wcs import WCS
7979
from astropy import units as u
8080
81-
import pyvo as vo
81+
from astroquery.ipac.irsa import Irsa
8282
import sep
8383
8484
# Copy-on-write is more performant and avoids unexpected modifications of the original DataFrame.
@@ -95,44 +95,23 @@ coord = SkyCoord.from_name('HD 168151')
9595

9696
Use IRSA's Simple Image Access (SIA) API to search for all Euclid MER mosaics that overlap with the search region you have specified. We specify the euclid_DpdMerBksMosaic "collection" because it lists all of the multiwavelength MER mosaics, along with their associated catalogs.
9797

98-
```{code-cell} ipython3
99-
irsa_service= vo.dal.sia2.SIA2Service('https://irsa.ipac.caltech.edu/SIA')
100-
101-
image_table = irsa_service.search(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
102-
```
103-
104-
Convert the table to pandas dataframe
105-
106-
```{code-cell} ipython3
107-
df_im_irsa=image_table.to_table().to_pandas().reset_index()
108-
```
98+
```{tip}
99+
The IRSA SIA collections can be listed using using the ``list_collections`` method, we can filter on the ones containing "euclid" in the collection name:
109100
110-
Change the settings so we can see all the columns in the dataframe and the full column width (to see the full long URL)
111-
112-
```{code-cell} ipython3
113-
pd.set_option('display.max_columns', None)
114-
pd.set_option('display.max_colwidth', None)
115-
116-
117-
## Can use the following lines to reset the max columns and column width of pandas
118-
# pd.reset_option('display.max_columns')
119-
# pd.reset_option('display.max_colwidth')
101+
Irsa.list_collections(filter='euclid')
120102
```
121103

122104
```{code-cell} ipython3
123-
df_im_irsa
105+
image_table = Irsa.query_sia(pos=(coord, search_radius), collection='euclid_DpdMerBksMosaic')
124106
```
125107

126-
This dataframe contains lots of datasets that have been "Euclidized", which means that they have been put on a common pixel scale chosen for the Euclid mission. Choose "science" as the data product subtype to see all science images of this tile.
108+
This table lists all MER mosaic images available in this search position. These mosaics include the Euclid VIS, Y, J, H images, as well as ground-based telescopes which have been put on the same pixel scale. For more information, see the [Euclid documentation at IPAC](https://euclid.caltech.edu/page/euclid-faq-tech/).
127109

128-
```{code-cell} ipython3
129-
df_im_euclid=df_im_irsa[ (df_im_irsa['dataproduct_subtype']=='science')].reset_index()
130-
131-
df_im_euclid
132-
```
110+
Note that there are various image types are returned as well, we filter out the `science` images from these:
133111

134112
```{code-cell} ipython3
135-
print('There are',len(df_im_euclid),'MER images of this object/MER tile.')
113+
science_images = image_table[image_table['dataproduct_subtype'] == 'science']
114+
science_images
136115
```
137116

138117
## 2. Retrieve a Euclid Q1 MER mosaic image in the VIS bandpass
@@ -144,8 +123,8 @@ print('There are',len(df_im_euclid),'MER images of this object/MER tile.')
144123
Note that 'access_estsize' is in units of kb
145124

146125
```{code-cell} ipython3
147-
filename = df_im_euclid[df_im_euclid['energy_bandpassname']=='VIS']['access_url'].to_list()[0]
148-
filesize = df_im_euclid[df_im_euclid['energy_bandpassname']=='VIS']['access_estsize'].to_list()[0]/1000000
126+
filename = science_images[science_images['energy_bandpassname']=='VIS']['access_url'][0]
127+
filesize = science_images[science_images['energy_bandpassname']=='VIS']['access_estsize'][0]/1000000
149128
150129
print(filename)
151130
@@ -216,7 +195,7 @@ We'd like to take a look at the multiwavelength images of our object, but the fu
216195
```
217196

218197
```{code-cell} ipython3
219-
urls = df_im_euclid['access_url'].to_list()
198+
urls = science_images['access_url']
220199
221200
urls
222201
```

0 commit comments

Comments
 (0)