astropy/astropy — pull request #3150 by astrofrog (2014-11-26 15:53:49+00:00)
Title: Example astropy.datasets module

As discussed in #3030 it would be nice to have a way to quickly access example datasets in the docs. In WCSAxes it allows us to write things like:

```
from wcsaxes import datasets, WCS
hdu = datasets.fetch_msx_hdu()
wcs = WCS(hdu.header)
```

that the user can re-run without downloading the dataset. This can also be useful for tests.

At the moment, the current PR makes it possible to do:

```
In [9]: from astropy.datasets import list_available_datasets, fetch_hdu

In [10]: list_available_datasets()
Out[10]:
['allsky/allsky_rosat.fits',
'galactic_center/gc_2mass_k.fits',
'galactic_center/gc_bolocam_gps.fits',
'galactic_center/gc_msx_e.fits',
'l1448/l1448_13co.fits']

In [11]: fetch_hdu('allsky/allsky_rosat.fits')
Out[11]:
```

This saves a little typing compared to simply giving the full URL for data.astropy.org.

This is just an example implementation so we can start discussing things. Other packages, such as WCSAxes, scikit-image, etc. actually specifically hard-code the few curated example datasets they want to include in their datasets module. I actually have a slight preference for this. That is, we would carefully decide which datasets to make available via this module to keep it simple. These would be datasets used in the docs, so that the examples look simple like the examples I showed above. If tests or internal parts of the code need datasets, they could just use the URL directly.

Anyway, just some thoughts for now - let me know what you think!

cc @eteq @larrybradley @cdeil