MultiTanDataSource¶
-
class
toasty.multi_tan.
MultiTanDataSource
(paths, hdu_index=0)[source]¶ Bases:
object
Generate tiles from a collection of images on a common TAN projection.
Some large astronomical images are stored as a collection of sub-images that share a common tangential projection, a format is that is nice and easy to convert into a WWT “study” tile pyramid. This class can process a collection of such images and break them into the highest-resolution layer of such a tile pyramid.
Methods Summary
Read the input images to determine the global pixelation of this data set.
create_wtml
([name, url_prefix, fov_factor, …])Create a WTML document with the proper metadata for this data set.
generate_deepest_layer_numpy
(pio[, percentiles])Fill in the deepest layer of the tile pyramid with Numpy-format data.
Methods Documentation
-
compute_global_pixelization
()[source]¶ Read the input images to determine the global pixelation of this data set.
This function reads the FITS headers of all of the input data files to determine the overall image size and the parameters of its tiling as a WWT study.
-
create_wtml
(name='MultiTan', url_prefix='./', fov_factor=1.7, bandpass='Visible', description_text='', credits_text='Created by toasty, part of the AAS WorldWide Telescope.', credits_url='', thumbnail_url='')[source]¶ Create a WTML document with the proper metadata for this data set.
compute_global_pixelization()
must have been called first.- Parameters
- namestr, defaults to “MultiTan”
The dataset name to embed in the WTML file.
- url_prefixstr, default to “./”
The beginning of the URL path to the tile data. The URL given in the WTML will be “URL_PREFIX{1}/{3}/{3}_{2}.png”
- fov_factorfloat, defaults to 1.7
The WTML file specifies the height of viewport that the client should zoom to when viewing this image. The value used is fov_factor times the height of the image.
- bandpassstr, defaults to “Visible”
The bandpass of the image, as chosen from a menu of options supported by the WTML format: “Gamma”, “HydrogenAlpha”, “IR”, “Microwave”, “Radio”, “Ultraviolet”, “Visible”, “VisibleNight”, “XRay”.
- description_textstr, defaults to “”
Free text describing what this image is.
- credits_textstr, defaults to a toasty credit
A brief textual credit of who created and processed the image data.
- credits_url: str, defaults to “”
A URL with additional image credit information, or the empty string if no such URL is available.
- thumbnail_urlstr, defaults to “”
A URL of a thumbnail image (96x45 JPEG) representing this image data set, or the empty string for a default to be used.
- Returns
- folderxml.etree.ElementTree.Element
An XML element containing the WWT metadata.
Examples
To convert the returned XML structure into text, use
xml.etree.ElementTree.tostring()
: >>> from xml.etree import ElementTree as etree >>> folder = data_source.create_wtml() >>> print(etree.tostring(folder))
-
generate_deepest_layer_numpy
(pio, percentiles=[1, 99])[source]¶ Fill in the deepest layer of the tile pyramid with Numpy-format data.
- Parameters
- pio
toasty.pyramid.PyramidIO
A
PyramidIO
instance to manage the I/O with the tiles in the tile pyramid.- percentilesiterable of numbers
This is a list of percentile points to calculate while reading the data. Each number should be between 0 and 100. For each high-resolution tile, the percentiles are computed; then the median across all tiles is computed and returned.
- pio
- Returns
- percentilesdict mapping numbers to numbers
This dictionary contains the result of the median-percentile computation. The keys are the values provided in the percentiles parameter. The values are the median of each percentile across all of the tiles.
Notes
The implementation assumes that if individual images overlap, we can just use the pixels from any one of them without caring which particular one we choose.
Because this operation involves reading the complete image data set, it offers a convenient opportunity to do some statistics on the data. This motivates the presence of the percentiles feature.
-