This commit is contained in:
Chris Beaumont 2014-03-17 09:34:54 -04:00
Родитель 038182fb53
Коммит 5898d5e636
2 изменённых файлов: 57 добавлений и 4 удалений

Просмотреть файл

@ -14,7 +14,7 @@ before_install:
- sudo ln -s /run/shm /dev/shm
install:
- conda install --yes pip numpy cython astropy setuptools pillow
- conda install --yes pip numpy=1.8 cython astropy setuptools
- pip install --use-mirrors pytest coveralls pytest-cov pyfits
- pip install --upgrade pillow
- (pip install --use-mirrors healpy && python -c "import healpy") || echo "could not install healpy"

Просмотреть файл

@ -10,11 +10,11 @@ Library to build WorldWide Telescope TOAST tiles.
### Dependencies
* Required: python (2.6, 2.7, 3.2, or 3.3), numpy, cython, Pillow/PIL
* Optional: astropy, healpy (for astronomy); pytest (for testing)
* Optional: astropy (for FITS IO), healpy (for HEALPIX data), pytest (for testing)
### Usage
```
```python
from toasty import toast
toast(sampler, depth, directory)
```
@ -33,6 +33,59 @@ Toasty provides a few basic sampler functions:
* **cartesian_sampler** for sampling from cartesian-projections
* **normalizer** for applying an intensity normalization after sampling
### Examples
To toast an all-sky, Cartesian projection, 8 byte image:
```python
from toasty import toast, cartesian_sampler
from skimage.io import imread
data = imread('allsky.png')
sampler = cartesian_sampler(data)
output = 'toast'
depth = 8 # approximately 0.165"/pixel at highest resolution
toast(sampler, depth, output)
```
To apply a log-stretch to an all sky FITS image:
```python
from toasty import toast, cartesian_sampler, normalizer
from astropy.io import fits
data = fits.open('allsky.fits')[0].data
vmin, vmax = 100, 65535
scaling = 'log'
contrast = 1
sampler = normalizer(cartesian_sampler(data), vmin, vmax
scaling, bias, contrast)
output = 'toast'
depth = 8
toast(sampler, depth, output)
```
To perform a custom transformation
```python
from toasty import toast
from astropy.io import fits
data = fits.open('allsky.fits')[0].data
def sampler(x, y):
"""
x and y are arrays, giving the RA/Dec centers
for each pixel to extract
"""
... code to extract a tile from `data` here ...
output = 'toast'
depth = 8
toast(sampler, depth, output)
```
See ``toasty.tile`` for documentation on these functions.
@ -49,4 +102,4 @@ This will start a web server, probably at [http://0.0.0.0:8000](http://0.0.0:800
For more information about using WorldWide Telescope with custom image data,
see [the official documentation](http://www.worldwidetelescope.org/Docs/worldwidetelescopedatafilesreference.html). The function `toasty.gen_wtml` can generate the wtml information for images generated with toasty.
For an example of tiles generated with Toasty (originally from [Aladin healpix images](http://alasky.u-strasbg.fr/cats/SIMBAD/)), see [The ADS All Sky Survey](http://adsass.s3-website-us-west-2.amazonaws.com/). The code used to generate these images is [here](https://github.com/ChrisBeaumont/adsass/blob/master/toast/toast.py).
For an example of tiles generated with Toasty (originally from [Aladin healpix images](http://alasky.u-strasbg.fr/cats/SIMBAD/)), see [The ADS All Sky Survey](http://adsass.org/wwt). The code used to generate these images is [here](https://github.com/ChrisBeaumont/adsass/blob/master/toast/toast.py).