Observation#
- class scarlet2.Observation(data, weights, psf=None, wcs=None, channels=None, renderer=None, name=None)[source]#
Bases:
ModuleContent and definition of an observation
- property N#
Number of unmasked pixels in the observation
- __call__()#
Evaluate the model
- check_set_renderer(frame)[source]#
Check existence of
renderer, or set it by callingmatch()- Parameters:
frame (
Frame) – The frame to match- Return type:
None
- data: Array#
Observed data
- eval_chi_square_in_box_and_border(scene, border_width=3)[source]#
Evaluate the weighted mean (weighted by the inverse variance weights) of the squared residuals for each source. Chi square is also computed for the perimeter outside the box of with border_width.
- Parameters:
scene (
Scene) – Scene containing the sourcesborder_width (
int) – width of the border around the source box
- Return type:
Dictofsources indicesandtheir corresponding Dictofresiduals insideandoutside source box.
- get(name=None)#
Get parameter(s) from this module
- Parameters:
name (
str, optional) – Name of parameter. If not set, returns all parameters.- Returns:
requested data arrays for parameters
- Return type:
dict
- goodness_of_fit(model)[source]#
Evaluate the goodness of the model fit to the data
For a Gaussian noise model, the gof is defined as the averaged squared deviation of the model from the data, scaled by the variance of the data, aka mean chi squared :math:`
rac{1}{N}sum_i=1^N w_i (m_i - d_i)^2` with inverse variance weights \(w_i\).
Up to a normalization, the gof is identical to
log-likelihood.- model: array
The (pre-rendered) predicted data cube, typically from evaluating
Scene
float
- log_likelihood(model)[source]#
The logarithm the likelihood of
datagiven model- Parameters:
model (
array) – The (pre-rendered) predicted data cube, typically from evaluatingScene- Return type:
float
- match(frame, renderer=None)[source]#
Construct the mapping between frame (from the model) and this observation frame
- Parameters:
frame (
Frame) – Model frame, typicallyscarlet2.Scene.framefor the current scene.renderer (
Renderer, optional) – Custom transformation to translate the frame (from the model) to this observation frame. If not set, this method will attempt to create the mapping from the information in both frames.
- Return type:
None
- name: str#
Name to describe the observation
- property parameters#
Parameters defined for this module
- Returns:
name: (node, param) mapping for all parameters
- Return type:
dict
- renderer: (None, <class 'scarlet2.renderer.Renderer'>, <class 'equinox.nn._sequential.Sequential'>)#
Renderer to translate from the model frame the observation frame
- set(values)#
Set parameter(s) from this module with values
- Parameters:
values (
dict[str,jnp.array]) – values to replace parameters with, identified by their name- Returns:
new module with parameter(s) replaced by values
- Return type:
- weights: Array#
Statistical weights (usually inverse variance) for
log_likelihood()