Skip to content

Commit 12454c7

Browse files
authored
Merge pull request #285 from BBN-Q/complex_numpy
fixed np.complex compatibility with new numpy
2 parents d1bc6e2 + 455e472 commit 12454c7

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

QGL/PatternUtils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def hash_pulse(shape):
3737
return hashlib.sha1(shape.tostring()).hexdigest()
3838

3939

40-
TAZKey = hash_pulse(np.zeros(1, dtype=np.complex))
40+
TAZKey = hash_pulse(np.zeros(1, dtype=np.complex128))
4141

4242

4343
def delay(sequences, delay):
@@ -403,4 +403,3 @@ def decouple_CR_pulses(seq, CR_qs, CR_decoupled_qs):
403403
elif any([pulse.channel == ChannelLibraries.EdgeFactory(*qsCR) for qsCR in CR_qs]):# and pulse.channel == seq_el.seq[k+2].channel:
404404
seq_el.seq[k+1] = reduce(operator.mul, [seq_el.seq[k+1]] + [X(q) for q in CR_decoupled_qs])
405405
return seq
406-

QGL/drivers/APSPattern.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def length(self):
112112
def length(self, value):
113113
self._length = value
114114

115-
115+
116116

117117
def preprocess(seqs, shapeLib, T):
118118
for seq in seqs:
@@ -163,11 +163,11 @@ def compress_sequences(seqs):
163163
repl_seq = []
164164
while length > MAX_TRIGGER_COUNT:
165165
repl_entry = copy(seq[idx+skip])
166-
repl_entry.length = MAX_TRIGGER_COUNT
166+
repl_entry.length = MAX_TRIGGER_COUNT
167167
repl_seq.append(repl_entry)
168-
length -= MAX_TRIGGER_COUNT
168+
length -= MAX_TRIGGER_COUNT
169169
final_entry = copy(seq[idx+skip])
170-
final_entry.length = length
170+
final_entry.length = length
171171
repl_seq.append(final_entry)
172172
seq[idx+skip:idx+skip+1] = repl_seq
173173
skip += len(repl_seq) - 1
@@ -201,7 +201,7 @@ def wf_sig(wf):
201201
wf.frequency)
202202

203203

204-
TAZShape = np.zeros(1, dtype=np.complex)
204+
TAZShape = np.zeros(1, dtype=np.complex128)
205205
TAZKey = hash_pulse(TAZShape)
206206

207207

@@ -766,7 +766,7 @@ def read_sequence_file(fileName):
766766
chanStrs = ['ch1', 'ch2', 'ch3', 'ch4']
767767
chanStrs2 = ['chan_1', 'chan_2', 'chan_3', 'chan_4']
768768
mrkStrs = ['ch1m1', 'ch2m1', 'ch3m1', 'ch4m1']
769-
769+
770770
data = {}
771771
with open(fileName, 'rb') as FID:
772772
target_hw = FID.read(4).decode('utf-8')
@@ -781,14 +781,14 @@ def read_sequence_file(fileName):
781781
data[channel]["isIQMode"] = bool(struct.unpack('?', FID.read(1))[0])
782782
wf_len = struct.unpack('<Q', FID.read(8))[0]
783783
data[channel]["waveformLib"] = np.frombuffer(FID.read(2*wf_len), dtype=np.int16)
784-
784+
785785
has_LLs = [struct.unpack('?', FID.read(1))[0] for i in range(2)]
786786
for LLexists, chanct in zip(has_LLs, [0,2]):
787787
if LLexists:
788-
788+
789789
channel = channels[chanct]
790-
numKeys = struct.unpack('<Q', FID.read(8))[0]
791-
numEntries = struct.unpack('<Q', FID.read(8))[0]
790+
numKeys = struct.unpack('<Q', FID.read(8))[0]
791+
numEntries = struct.unpack('<Q', FID.read(8))[0]
792792
data[channel]["linkListData"] = {}
793793
data[channel]["linkListData"]["numLLEntries"] = numEntries
794794
for i in range(numKeys): #key, dataVec in LLDataVecs.items():

0 commit comments

Comments
 (0)