ObservationGroup#

class astro_metadata_translator.ObservationGroup(members, translator_class=None, pedantic=None)#

Bases: MutableSequence[ObservationInfo]

A collection of ObservationInfo headers.

Parameters:

Methods Summary

extremes()

Return the oldest observation in the group and the newest.

from_simple(simple)

Convert simplified form back to ObservationGroup.

insert(index, value)

S.insert(index, value) -- insert value before index

model_dump_json(**kwargs)

Serialize to JSON using Pydantic-compatible semantics.

model_validate_json(json_data, **kwargs)

Deserialize from JSON using Pydantic-compatible semantics.

newest()

Return the newest observation in the group.

oldest()

Return the oldest observation in the group.

property_values(property)

Return a set of values associated with the specified property.

reverse()

S.reverse() -- reverse IN PLACE

sort([key, reverse])

to_simple()

Convert the group to simplified form.

Methods Documentation

extremes()#

Return the oldest observation in the group and the newest.

If there is only one member of the group, the newest and oldest can be the same observation.

Return type:

tuple[ObservationInfo, ObservationInfo]

Returns:

classmethod from_simple(simple)#

Convert simplified form back to ObservationGroup.

Parameters:

simple (list of dict) – Object returned by to_simple.

Returns:

group – Reconstructed group.

Return type:

ObservationGroup

insert(index, value)#

S.insert(index, value) – insert value before index

Parameters:
Return type:

None

model_dump_json(**kwargs)#

Serialize to JSON using Pydantic-compatible semantics.

Parameters:

**kwargs (Any) – Parameters passed to pydantic.BaseModel.model_dump_json.

Returns:

json_data – JSON string representing the model.

Return type:

str

classmethod model_validate_json(json_data, **kwargs)#

Deserialize from JSON using Pydantic-compatible semantics.

Parameters:
Returns:

group – Model constructed from the JSON.

Return type:

ObservationGroup

newest()#

Return the newest observation in the group.

Returns:

newest – The newest ObservationInfo in the ObservationGroup.

Return type:

ObservationInfo

oldest()#

Return the oldest observation in the group.

Returns:

oldest – The oldest ObservationInfo in the ObservationGroup.

Return type:

ObservationInfo

property_values(property)#

Return a set of values associated with the specified property.

Parameters:

property (str) – Property of an ObservationInfo.

Returns:

values – All the distinct values for that property within this group.

Return type:

set

reverse()#

S.reverse() – reverse IN PLACE

Return type:

None

sort(key=None, reverse=False)#
Parameters:
Return type:

None

to_simple()#

Convert the group to simplified form.

Returns:

simple – Simple form is a list containing the simplified dict form of each ObservationInfo.

Return type:

list of dict