stack_observations#
- scarlet2.stack_observations(observations, model_frame, name=None)[source]#
Stack observations into a single one on the grid of model_frame
Observations from different instruments or epochs can be treated as extra channels of one observation. Rendering then vectorizes over all channels at once instead of looping over observations (see #287).
Any observation that does not already sample the same sky pixel grid as model_frame (the same WCS orientation and scale, up to an integer pixel offset) is first resampled onto it via
CorrelatedObservation.from_resampling(), which turns it into aCorrelatedObservation. If that makes even one input observation correlated (because it was passed in that way, or because it needed resampling), every other observation is promoted to aCorrelatedObservationas well, viaCorrelatedObservation.from_observation(), so that they can all be concatenated as one consistent noise model.The
data, PSF and (forCorrelatedObservation)maskandcorrelation_functionof each observation are padded (marking the new pixels invalid) or trimmed to the spatial extent of model_frame and concatenated along the channel axis; the channel lists are concatenated as well.- Parameters:
observations (
listofObservation) – Observations to stack. They must all carry a PSF, and their channels must be mutually distinct.model_frame (
Frame) – Frame defining the common spatial grid, typicallyscarlet2.Scene.frame.name (
str, optional) – Name of the stacked observation. Defaults to the joined names of the inputs.
- Returns:
A single observation on the spatial grid of model_frame, with as many channels as all observations combined.
CorrelatedObservationunless every input is a plainObservationthat already shares the grid of model_frame.- Return type: