Skip to content

Commit

Permalink
Merge pull request #190 from NASA-NAVO/trjaffe-patch-1
Browse files Browse the repository at this point in the history
remove sdss
  • Loading branch information
tomdonaldson authored Dec 16, 2024
2 parents 7a24ffc + 7ee3ce2 commit 3eb1917
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions content/reference_notebooks/image_access.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ In this notebook, we show how to search for and retrieve images from VO services
- [3. Viewing the resulting image](#3-viewing-the-resulting-image)
- [JPG images](#jpg-images)
- [Fits files](#fits-files)
- [4. Example of data available through multiple services](#4-example-of-data-available-through-multiple-services)
- [Using HEASARC](#using-heasarc)
- [Using SDSS SkyServer](#using-sdss-skyserver)

+++

Expand Down Expand Up @@ -156,61 +153,3 @@ hdu_list.info()
```{code-cell} ipython3
plt.imshow(hdu_list[0].data, cmap='gray', origin='lower',vmax=0.1)
```

## 4. Example of data available through multiple services

Suppose we want Sloan DSS data. A generic query finds us a number of possibilities (note that this doesn't work for keywords=['sdss']; be flexible and try several search terms):

```{code-cell} ipython3
services = vo.regsearch(servicetype='sia', keywords=['sloan'], waveband='optical')
services.to_table()[np.where(np.isin(services.to_table()['short_name'], 'SDSSDR7'))]['ivoid', 'short_name']
```

So one of these is served by SDSS's SkyServer and the other by HEASARC's SkyView.

+++

### Using HEASARC

```{code-cell} ipython3
heasarc_dr7_service = [s for s in services if 'SDSSDR7' in s.short_name and 'heasarc' in s.ivoid][0]
sdss_table_heasarc = heasarc_dr7_service.search(pos=coords,size=0.2,format='image/fits')
sdss_table_heasarc.to_table()
```

```{code-cell} ipython3
## If you only run this once, you can do it in memory in one line:
## This fetches the FITS as an astropy.io.fits object in memory
# hdu_list = sdss_table_heasarc[0].getdataobj()
## But if you might run this notebook repeatedly with limited bandwidth,
## download it once and cache it.
# Get the filter g version
file_name=download_file(sdss_table_heasarc[0].getdataurl(), cache=True, timeout=600)
hdu_list = fits.open(file_name)
plt.imshow(hdu_list[0].data, cmap='gray', origin='lower', vmax=1200, vmin=1010)
```

### Using SDSS SkyServer

```{code-cell} ipython3
jhu_dr7_service = [s for s in services if 'SDSSDR7' in s.short_name and 'jhu' in s.ivoid][0]
# Note: jhu_dr7_service access url has hard-wired "format=image/fits".
# If you specify anythign else, it errors. If you specify nothing,
# then the search() method puts "format=all", which errors. So specify "format=None" for now.
sdss_table_jhu=jhu_dr7_service.search(pos=coords,size=0.2, format=None)
sdss_table_jhu.to_table().show_in_notebook(display_length = 5)
```

```{code-cell} ipython3
# Get the filter g version
file_name=download_file(sdss_table_jhu[1].getdataurl(), cache=True, timeout=600)
hdu_list = fits.open(file_name)
plt.imshow(hdu_list[0].data, cmap='gray', origin='lower',vmax=1200,vmin=1010)
```

It turns out that SkyView is just getting images by using the SIAP internally to get the data from the SDSS service. The point of the VO protocols is that you don't need to know where the data are coming from. But they can be processed differently.

0 comments on commit 3eb1917

Please sign in to comment.