BackgroundMap#

class lsst.images.BackgroundMap(backgrounds: Iterable[Background] = (), subtracted: str | None = None)#

Bases: Mapping[str, Background]

A mapping of background models associated with an image.

Unlike most image characterization objects, the best background model often depends on the science case, and hence we may want to associate more than one with an image.

Attributes Summary

subtracted

The background subtracted from this image (Background | None).

Methods Summary

add(name, field[, description, is_subtracted])

Add a new background to the map.

copy()

Return a copy of the background map.

get(key[, default])

Return the background with the given key or the given default value.

items()

keys()

serialize(archive)

Write a background map to an archive.

values()

Attributes Documentation

subtracted#

The background subtracted from this image (Background | None).

Notes#

If None, none of the backgrounds in this map were subtracted from the image. This does not necessarily mean no background at all was subtracted (e.g. in a coadd, backgrounds are generally subtracted from the input images before they are combined, and the sum of those backgrounds may not be available in a coadd background map.)

Methods Documentation

add(name: str, field: Field, description: str = '', *, is_subtracted: bool = False) None#

Add a new background to the map.

Parameters#

name

Unique name for this background model.

field

The background field itself.

description

A description of how this background model was produced and/or how it should be used.

is_subtracted

Whether this background is the one that was subtracted from the image this background map is attached to.

Notes#

There are no guards against is_subtracted=True being passed for multiple different backgrounds; correctness is up to the caller. Note that we only allow one background to be subtracted at once (incremental backgrounds should be modeled via fields.SumField, not multiple named entries in this map).

copy() BackgroundMap#

Return a copy of the background map.

get(key: str, default: V | None = None) Background | V | None#

Return the background with the given key or the given default value.

items() a set-like object providing a view on D's items#
keys() a set-like object providing a view on D's keys#
serialize(archive: OutputArchive[Any]) BackgroundMapSerializationModel#

Write a background map to an archive.

values() an object providing a view on D's values#