Sort MeasurementSet by time stamp
Building, testing and releasing LASP if it has a tag / Build-Test-Ubuntu (push) Successful in 1m56s Details
Building, testing and releasing LASP if it has a tag / Release-Ubuntu (push) Has been skipped Details

This commit is contained in:
Casper Jansen 2024-03-14 11:31:07 +01:00
parent da023273d8
commit 33439354f8
1 changed files with 3 additions and 2 deletions

View File

@ -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