forked from M-Labs/artiq
1
0
Fork 0

scan: fix deprecated shuffle parameter in python 3.11

This commit is contained in:
Florian Agbuya 2023-09-13 12:16:13 +08:00 committed by Sébastien Bourdeauducq
parent 5c85cef0c2
commit 6df85478e4
1 changed files with 2 additions and 4 deletions

View File

@ -83,8 +83,7 @@ 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:
rng = random.Random(seed) random.Random(seed).shuffle(self.sequence)
random.shuffle(self.sequence, rng.random)
def __iter__(self): def __iter__(self):
return iter(self.sequence) return iter(self.sequence)
@ -120,8 +119,7 @@ class CenterScan(ScanObject):
for i in range(n) for sign in [-1, 1]][1:] for i in range(n) for sign in [-1, 1]][1:]
if randomize: if randomize:
rng = random.Random(seed) random.Random(seed).shuffle(self.sequence)
random.shuffle(self.sequence, rng.random)
def __iter__(self): def __iter__(self):
return iter(self.sequence) return iter(self.sequence)