BackgroundMap#

class lsst.images.BackgroundMap(backgrounds=(), subtracted=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.

Parameters:
  • backgrounds (Iterable[Background], default: ()) – Background models to include in the map, keyed by their name.

  • subtracted (str | None, default: None) – Name of the background that has been subtracted from the image, or None if no background has been subtracted.

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, field, description='', *, is_subtracted=False)#

Add a new background to the map.

Parameters:
  • name (str) – Unique name for this background model.

  • field (TypeAliasType) – The background field itself.

  • description (str, default: '') – A description of how this background model was produced and/or how it should be used.

  • is_subtracted (bool, default: False) – Whether this background is the one that was subtracted from the image this background map is attached to.

Return type:

None

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()#

Return a copy of the background map.

Return type:

BackgroundMap

get(key, default=None)#

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

Parameters:
Return type:

Union[Background, TypeVar(V), None]

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)#

Write a background map to an archive.

Parameters:

archive (OutputArchive[Any]) – Archive to write to.

Return type:

BackgroundMapSerializationModel

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

This page was last modified on .