MetadataView#
- class lsst.images.MetadataView(native, external)#
Bases:
MutableMapping[str,MetadataValue|ExternalMetadataValue]Combined view of an image’s native and external metadata.
- Parameters:
native (
_NativeMetadata) – Metadata that is part of the image’s data model.external (
ExternalMetadata) – Read-only metadata carried in from an external source.
Notes
Lookups check
nativefirst, matching case exactly, and thenexternal, ignoring case. Writes and deletes go tonativeonly, and adding a new key that case-insensitively matches anexternalkey raisesKeyError. Iteration yields the exact-case union of the keys of both.When a key is repeated in the external source, which of its values
[]returns is unspecified; useget_allto obtain every value.Attributes Summary
Read-only metadata carried in from an external source, such as the primary header of a FITS file (
serialization.ExternalMetadata).Metadata that is part of the image's data model and is saved with it (
MutableMapping).Methods Summary
clear()copy()Return a plain
dictcopy of the native metadata.get(k[,d])get_all(key)Return every value for a key.
items()keys()pop(k[,d])value.
popitem()as a 2-tuple; but raise KeyError if D is empty.
setdefault(k[,d])update([E, ]**F)If E present and has a .keys() method, does:
values()Attributes Documentation
- external#
Read-only metadata carried in from an external source, such as the primary header of a FITS file (
serialization.ExternalMetadata).
- native#
Metadata that is part of the image’s data model and is saved with it (
MutableMapping).Keys are case-sensitive. Adding a key that case-insensitively matches a key of
externalraisesKeyError; a key that is already present may always be updated.
Methods Documentation
- copy()#
Return a plain
dictcopy of the native metadata.- Returns:
metadata – A copy of the native metadata.
- Return type:
- get(k[, d]) D[k] if k in D, else d. d defaults to None.#
- get_all(key)#
Return every value for a key.
- items() a set-like object providing a view on D's items#
- keys() a set-like object providing a view on D's keys#
- pop(k[, d]) v, remove specified key and return the corresponding#
value. If key is not found, d is returned if given, otherwise KeyError is raised.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D#
- update([E, ]**F) None. Update D from mapping/iterable E and F.#
- If E present and has a .keys() method, does:
for k in E.keys(): D[k] = E[k]
- If E present and lacks .keys() method, does:
for (k, v) in E: D[k] = v
- In either case, this is followed by:
for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values#