Commit c53682b6 authored by payno's avatar payno

[utils][unique value] fix guess unique value when axis is 1, not relative and give the cycle_length

parent 6ac7d907
Pipeline #6624 passed with stage
in 2 minutes and 31 seconds
......@@ -71,6 +71,11 @@ class TestOperationStream(unittest.TestCase):
self.assertTrue(len(metadatautils.getUnique(self.experiment,
kind=POSITIONER_METADATA,
key='obpitch')) is 2)
self.assertTrue(len(metadatautils.getUnique(self.experiment,
kind=POSITIONER_METADATA,
key='obpitch',
axis=1,
cycle_length=2)) is 2)
self.applyDimsDef()
self.assertTrue(self.experiment.dims.ndim is 2)
self.assertTrue(self.experiment.dims.shape == (31, 2))
......
......@@ -75,6 +75,6 @@ def getUnique(experiment, key, kind, relative_prev_val=False, cycle_length=None,
res.append(value[0])
except Exception as e:
_logger.error("fail to load %s, %s cause %s" % (kind, key, e.message))
if cycle_length is not None and len(res) >= cycle_length:
if cycle_length is not None and len(numpy.unique(res)) >= cycle_length:
break
return numpy.unique(res)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment