Sort MeasurementSet by time stamp
This commit is contained in:
parent
da023273d8
commit
33439354f8
@ -27,6 +27,8 @@ class MeasurementSet(list):
|
||||
if any([not isinstance(i, Measurement) for i in mlist]):
|
||||
raise TypeError('Object in list should be of Measurement type')
|
||||
|
||||
# Sort by time stamp, otherwise the order is random
|
||||
mlist.sort(key=lambda x: x.time, reverse=True)
|
||||
super().__init__(mlist)
|
||||
|
||||
def getNewestReferenceMeasurement(self, mtype: MeasurementType):
|
||||
@ -44,7 +46,7 @@ class MeasurementSet(list):
|
||||
if mnewest.time < m.time:
|
||||
mnewest = m
|
||||
return mnewest
|
||||
|
||||
|
||||
def getNewestReferenceMeasurements(self):
|
||||
"""Returns a dictionary with newest measurement of each type that is not specific returns None in case no measurement is found."""
|
||||
newest = {}
|
||||
@ -106,4 +108,3 @@ class MeasurementSet(list):
|
||||
return all([first == meas.channelConfig for meas in self])
|
||||
else:
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user