Python API Reference¶
toasty Package¶
toasty.builder Module¶
Building up WWT imagery data sets.
This gets a little complex since the generation of a tiled image involves several tasks that may or may not be implemented in several, swappable ways: generating the tiled pixel data; positioning the image on the sky; filling in metadata; and so on. We try to provide a framework that allows the implementations of different tasks to be swapped out without getting too airy and abstract.
toasty.cli Module¶
Entrypoint for the “toasty” command-line interface.
Functions¶
|
|
|
|
|
|
|
The entrypoint for the “toasty” command-line interface. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toasty.image Module¶
Low-level loading and handling of images.
Here, images are defined as 2D data buffers stored in memory. Images might be small, if dealing with an individual tile, or extremely large, if loading up a large study for tiling.
toasty.merge Module¶
General tools for merging and downsampling tiles
The Merger Protocol¶
A “merger” is a callable that takes four input tiles and downsamples them into
a smaller tile. Its prototype is merger(big) -> small
, where big is a
Numpy array of at least 2 dimensions whose first two axes are both 512
elements in size. The return value small should have the same number of
dimensions as the input, two initial axes of size 256, and remaining axes the
same size as the input.
To efficiently vectorize two-by-two downsampling, a useful trick is to reshape
the (512, 512)
input tile into a shape (256, 2, 256, 2)
. You can then
use functions like np.mean()
with an argument axes=(1, 3)
to vectorize
the operation over sets of four adjacent pixels.
Functions¶
|
A merger function that averages quartets of pixels. |
|
Downsample image tiles all the way to the top of the pyramid. |
toasty.multi_tan Module¶
Generate tiles from a collection of images on a common TAN projection.
TODO: shuld be migrated to wwt_data_formats.
Classes¶
|
Generate tiles from a collection of images on a common TAN projection. |
toasty.openexr Module¶
Loading OpenEXR files.
This is very primitive support. Implemented for:
https://svs.gsfc.nasa.gov/4851
Functions¶
|
Load an OpenEXR file |
toasty.pipeline Module¶
A framework for automating the ingest of source images into the formats used by AAS WorldWide Telescope.
Classes¶
An ImageSource that obtains its inputs from a query to the AstroPix service. |
|
|
An InputImage obtained from an AstroPix query result. |
|
A CandidateInput obtained from an AstroPix query. |
|
I/O for pipeline processing that uses Microsoft Azure Blob Storage. |
|
An abstract base class for an input image whose data are stored as an RGB bitmap that we will read into memory all at once using the |
An abstract base class representing an image from one of our sources. |
|
An abstract base class representing a source of images to be processed in the image-processing pipeline. |
|
|
An abstract base class representing an image to be processed by the pipeline. |
|
I/O for pipeline processing using the local disk. |
Raised when an image is provided to the pipeline but for some reason we’re not going to be able to get it into a WWT-compatible form. |
|
An abstract base class for I/O relating to pipeline processing. |
toasty.pyramid Module¶
General tools for working with tile pyramids.
Toasty and the AAS WorldWide Telescope support two kinds of tile pyramid formats: the all-sky TOAST projection, and “studies” which are tile pyramids rooted in a subset of the sky using a tangential projection. Both kinds of tile pyramids have much in common, and this module implements their overlapping functionality.
Functions¶
|
Return the total number of tiles in a WWT tile pyramid of depth depth. |
|
Generate a pyramid of tile positions. |
|
Determine if one tile is a child of another. |
Ugh, this implementation is so dumb. |
|
|
Return the children of a tile position. |
|
Return a tile position’s parent. |
|
Return the number of tiles in the WWT tile pyramid layer at depth depth. |
toasty.samplers Module¶
“Sampler” functions that fetch image data as a function of sky coordinates.
The Sampler Protocol¶
A sampler is a callable object that obeys the following signature: func(lon,
lat) -> data
, where lon and lat are 2D numpy arrays of spherical
coordinates measured in radians, and the returned data array is a numpy
array of at least two dimensions whose first two axes have the same shape as
lon and lat. The data array gives the map values sampled at the
corresponding coordinates. Its additional dimensions can be used to encode
color information: one standard is for data to have a dtype of
np.uint8
and a shape of (ny, nx, 3)
, where the final axis samples
RGB colors.
Functions¶
|
Create a sampler function for all-sky data in a “plate carrée” projection. |
Create a sampler function for all-sky data in a “plate carrée” projection using Galactic coordinates. |
|
Create a sampler function for planetary data in a “plate carrée” projection. |
|
|
Create a sampler for HEALPix data read from a FITS file. |
|
Create a sampler for HEALPix image data. |
toasty.study Module¶
Common routines for tiling images anchored to the sky in a gnomonic (tangential) projection.
Functions¶
|
Tile an image as a study, loading the whole thing into memory. |
Classes¶
|
Information about how a WWT “study” image is broken into tiles. |
toasty.toast Module¶
Computations for the TOAST projection scheme and tile pyramid format.
TODO this all needs to be ported to modern Toasty infrastructure and wwt_data_formats.
Functions¶
|
Generate a pyramid of TOAST tiles in deepest-first order. |
|
Generate a layer of the TOAST tile pyramid through direct sampling. |
|
Calculate the area of a TOAST tile in steradians. |