wwt_data_formats/docs/imagesets.rst

49 строки
1.3 KiB
ReStructuredText
Исходник Постоянная ссылка Обычный вид История

2019-12-05 01:59:46 +03:00
.. _image-sets:
==============
WWT Image Sets
==============
2023-10-24 16:01:50 +03:00
Images in WorldWide Telescope can come in a variety of formats:
2019-12-05 01:59:46 +03:00
- Standard bitmapped images like PNG or JPG files
- Scientific data in FITS files
- Large-size images converted into tile pyramids
2020-02-26 06:20:09 +03:00
Such images are described as ``<ImageSet>`` XML fragments in several of the WWT
file formats. In this package, the corresponding data structure is
:class:`wwt_data_formats.imageset.ImageSet`. Read the class documentation for
detailed explanations of the different imageset parameters.
2020-02-26 06:20:09 +03:00
The high-level structure of a standard, minimal WTML file to show a single image is:
.. code-block::
2020-02-26 06:20:09 +03:00
<Folder ...>
<Place ...>
<ForegroundImageSet ...>
<ImageSet ...>
...
</ImageSet>
</ForegroundImageSet>
</Place>
</Folder>
The corresponding code using ``wwt_data_formats`` is::
from wwt_data_formats import folder, place, imageset
f = folder.Folder()
pl = place.Place()
imgset = imageset.ImageSet()
pl.foreground_image_set = imgset
f.children = [pl]
This can then be written to XML with::
from wwt_data_formats import write_xml_doc
with open('myfile.wtml', 'wt', encoding='utf8') as f:
2020-02-26 06:20:09 +03:00
write_xml_doc(f.to_xml(), dest_stream=f)