ImageSource¶
- class toasty.pipeline.ImageSource[source]¶
Bases:
ABC
An abstract base class representing a source of images to be processed in the image-processing pipeline. An instance of this class might fetch images from an RSS feed or an AstroPix search.
Methods Summary
deserialize
(data)Create an instance of this class by deserializing configuration data.
fetch_candidate
(unique_id, cand_data_stream, ...)Download a candidate image and prepare it for processing.
Get the name of the section key used for this source's configuration data.
process
(unique_id, cand_data_stream, ...)Process an input into WWT format.
Generate a sequence of candidate input images that the pipeline may want to process.
Methods Documentation
- abstract classmethod deserialize(data)[source]¶
Create an instance of this class by deserializing configuration data.
- Parameters:
- datadict-like object
A dict-like object containing configuration items deserialized from a format such as JSON or YAML. The particular contents can vary depending on the implementation.
- Returns:
- An instance of cls
- abstract fetch_candidate(unique_id, cand_data_stream, cachedir)[source]¶
Download a candidate image and prepare it for processing.
- Parameters:
- unique_idstr
The unique ID returned by the
toasty.pipeline.CandidateInput
instance that was returned from the initial query.- cand_data_streamreadable stream returning bytes
A data stream returning the data that were saved when the candidate was queried (
toasty.pipeline.CandidateInput.save()
).- cachedirpath-like
A path pointing to a local directory inside of which the full image data and metadata should be cached.
- abstract classmethod get_config_key()[source]¶
Get the name of the section key used for this source’s configuration data.
- Returns:
- A string giving a key name usable in a YAML file.
- abstract process(unique_id, cand_data_stream, cachedir, builder)[source]¶
Process an input into WWT format.
- Parameters:
- unique_idstr
The unique ID returned by the
toasty.pipeline.CandidateInput
instance that was returned from the initial query.- cand_data_streamreadable stream returning bytes
A data stream returning the data that were saved when the candidate was queried (
toasty.pipeline.CandidateInput.save()
).- cachedirpath-like
A path pointing to a local directory inside of which the full image data and metadata should be cached.
- builder
toasty.builder.Builder
State object for constructing the WWT data files.
Notes
Your image processor should run the tile cascade, if needed, but the caller will take care of emitting the
index_rel.wtml
file.
- abstract query_candidates()[source]¶
Generate a sequence of candidate input images that the pipeline may want to process.
- Returns:
- A generator that yields a sequence of
toasty.pipeline.CandidateInput
instances.
- A generator that yields a sequence of