ObservationGroup¶
-
class
astro_metadata_translator.
ObservationGroup
(members, translator_class=None, pedantic=None)¶ Bases:
collections.abc.MutableSequence
A collection of
ObservationInfo
headers.Parameters: - members : iterable of
ObservationInfo
ordict
-like ObservationInfo
to seed the group membership. Ifdict
-like values are used they will be passed to theObservationInfo
constructor.- translator_class :
MetadataTranslator
-class, optional If any of the members is not an
ObservationInfo
, translator class to pass to theObservationInfo
constructor. IfNone
the translation class will be determined automatically.- pedantic :
bool
, optional If any of the members is not an
ObservationInfo
, passed to theObservationInfo
constructor to control whether a failed translation is fatal or not.None
indicates that theObservationInfo
constructor default should be used.
Methods Summary
append
(value)S.append(value) – append value to the end of the sequence clear
()count
(value)extend
(values)S.extend(iterable) – extend sequence by appending elements from the iterable extremes
()Return the oldest observation in the group and the newest. index
(value, [start, [stop]])Raises ValueError if the value is not present. insert
(index, value)S.insert(index, value) – insert value before index newest
()Return the newest observation in the group. oldest
()Return the oldest observation in the group. pop
([index])Raise IndexError if list is empty or index is out of range. property_values
(property)Return a set of values associated with the specified property. remove
(value)S.remove(value) – remove first occurrence of value. reverse
()S.reverse() – reverse IN PLACE sort
([key, reverse])Methods Documentation
-
append
(value)¶ S.append(value) – append value to the end of the sequence
-
clear
() → None -- remove all items from S¶
-
count
(value) → integer -- return number of occurrences of value¶
-
extend
(values)¶ S.extend(iterable) – extend sequence by appending elements from the iterable
-
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.
Returns: - oldest :
ObservationInfo
Oldest observation.
- newest :
ObservationInfo
Newest observation.
- oldest :
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
insert
(index, value)¶ S.insert(index, value) – insert value before index
-
newest
()¶ Return the newest observation in the group.
Returns: - newest :
ObservationInfo
The newest
ObservationInfo
in theObservationGroup
.
- newest :
-
oldest
()¶ Return the oldest observation in the group.
Returns: - oldest :
ObservationInfo
The oldest
ObservationInfo
in theObservationGroup
.
- oldest :
-
pop
([index]) → item -- remove and return item at index (default last).¶ Raise IndexError if list is empty or index is out of range.
-
property_values
(property)¶ Return a set of values associated with the specified property.
Parameters: - property :
str
Property of an
ObservationInfo
Returns: - values :
set
All the distinct values for that property within this group.
- property :
-
remove
(value)¶ S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
-
reverse
()¶ S.reverse() – reverse IN PLACE
-
sort
(key=None, reverse=False)¶
- members : iterable of