forked from M-Labs/artiq
scannable: fix RangeScan randomize seeding
This commit is contained in:
parent
07c71bf020
commit
bdf1ca25c6
|
@ -361,6 +361,7 @@ class ScanEntry(LayoutWidget):
|
||||||
state[ty]["stop"] = default["stop"]
|
state[ty]["stop"] = default["stop"]
|
||||||
state[ty]["npoints"] = default["npoints"]
|
state[ty]["npoints"] = default["npoints"]
|
||||||
state[ty]["randomize"] = default["randomize"]
|
state[ty]["randomize"] = default["randomize"]
|
||||||
|
state[ty]["seed"] = default["seed"]
|
||||||
elif ty == "ExplicitScan":
|
elif ty == "ExplicitScan":
|
||||||
state[ty]["sequence"] = default["sequence"]
|
state[ty]["sequence"] = default["sequence"]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -78,9 +78,8 @@ class RangeScan(ScanObject):
|
||||||
self.sequence = [i*dx + start for i in range(npoints)]
|
self.sequence = [i*dx + start for i in range(npoints)]
|
||||||
|
|
||||||
if randomize:
|
if randomize:
|
||||||
if seed is not None:
|
rng = random.Random(seed)
|
||||||
random.seed(seed)
|
random.shuffle(self.sequence, rng.random)
|
||||||
random.shuffle(self.sequence)
|
|
||||||
|
|
||||||
@portable
|
@portable
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
|
Loading…
Reference in New Issue