Skip to content

Commit 5fd0db1

Browse files
committed
20-10-2022; Spectrum_M4I_6631_X8 module corrected
1) A keyword 'increment' of the pulse changed to 'length_increment to be consistent with PB_ESR_Pro 500 2) Documentation corrected 3) AWG nutation script corrected
1 parent ee360d7 commit 5fd0db1

File tree

5 files changed

+233
-52
lines changed

5 files changed

+233
-52
lines changed

atomize/device_modules/Spectrum_M4I_6631_X8.py

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def awg_stop(self):
522522
pass
523523

524524
def awg_pulse(self, name = 'P0', channel = 'CH0', func = 'SINE', frequency = '200 MHz', phase = 0,\
525-
delta_phase = 0, phase_list = [], length = '16 ns', sigma = '16 ns', increment = '0 ns', start = '0 ns', delta_start = '0 ns', d_coef = 1, n = 1):
525+
delta_phase = 0, phase_list = [], length = '16 ns', sigma = '0 ns', length_increment = '0 ns', start = '0 ns', delta_start = '0 ns', d_coef = 1, n = 1):
526526
"""
527527
A function for awg pulse creation;
528528
The possible arguments:
@@ -544,7 +544,7 @@ def awg_pulse(self, name = 'P0', channel = 'CH0', func = 'SINE', frequency = '20
544544
"""
545545
if self.test_flag != 'test':
546546
pulse = {'name': name, 'channel': channel, 'function': func, 'frequency': frequency, 'phase' : phase,\
547-
'delta_phase': delta_phase, 'length': length, 'sigma': sigma, 'increment': increment, 'start': start,\
547+
'delta_phase': delta_phase, 'length': length, 'sigma': sigma, 'length_increment': increment, 'start': start,\
548548
'delta_start': delta_start, 'amp': d_coef, 'phase_list': phase_list, 'n': n }
549549

550550
self.pulse_array.append( pulse )
@@ -568,7 +568,7 @@ def awg_pulse(self, name = 'P0', channel = 'CH0', func = 'SINE', frequency = '20
568568

569569
elif self.test_flag == 'test':
570570
pulse = {'name': name, 'channel': channel, 'function': func, 'frequency': frequency, 'phase' : phase,\
571-
'delta_phase' : delta_phase, 'length': length, 'sigma': sigma, 'increment': increment, 'start': start,\
571+
'delta_phase' : delta_phase, 'length': length, 'sigma': sigma, 'length_increment': increment, 'start': start,\
572572
'delta_start': delta_start, 'amp': d_coef, 'phase_list': phase_list, 'n': n }
573573

574574
if channel == 'CH0':
@@ -959,10 +959,10 @@ def func(*, name1, name2): defines a function without default values of key argu
959959

960960
#self.awg_update_test()
961961

962-
def awg_redefine_increment(self, *, name, increment):
962+
def awg_redefine_length_increment(self, *, name, length_increment):
963963
"""
964-
A function for redefining increment of the specified pulse.
965-
awg_redefine_increment(name = 'P0', increment = '10 ns') changes increment of the 'P0' pulse to '10 ns'.
964+
A function for redefining length increment of the specified pulse.
965+
awg_redefine_increment(name = 'P0', length_increment = '10 ns') changes length increment of the 'P0' pulse to '10 ns'.
966966
The main purpose of the function is non-uniform sampling.
967967
968968
def func(*, name1, name2): defines a function without default values of key arguments
@@ -973,7 +973,7 @@ def func(*, name1, name2): defines a function without default values of key argu
973973

974974
while i < len( self.pulse_array ):
975975
if name == self.pulse_array[i]['name']:
976-
self.pulse_array[i]['increment'] = str(increment)
976+
self.pulse_array[i]['length_increment'] = str(length_increment)
977977
self.increment_count = 1
978978
else:
979979
pass
@@ -987,7 +987,7 @@ def func(*, name1, name2): defines a function without default values of key argu
987987
while i < len( self.pulse_array ):
988988
if name == self.pulse_array[i]['name']:
989989
# checks
990-
temp_increment = increment.split(" ")
990+
temp_increment = length_increment.split(" ")
991991
if temp_increment[1] in self.timebase_dict:
992992
coef = self.timebase_dict[temp_increment[1]]
993993
p_increment = coef*float(temp_increment[0])
@@ -996,7 +996,7 @@ def func(*, name1, name2): defines a function without default values of key argu
996996
else:
997997
assert( 1 == 2 ), 'Incorrect time dimension (ms, us, ns)'
998998

999-
self.pulse_array[i]['increment'] = str(increment)
999+
self.pulse_array[i]['length_increment'] = str(length_increment)
10001000
self.increment_count = 1
10011001
else:
10021002
pass
@@ -1195,11 +1195,11 @@ def awg_increment(self, *pulses):
11951195
if len(pulses) == 0:
11961196
i = 0
11971197
while i < len( self.pulse_array ):
1198-
if int( self.pulse_array[i]['increment'][:-3] ) == 0:
1198+
if int( self.pulse_array[i]['length_increment'][:-3] ) == 0:
11991199
pass
12001200
else:
12011201
# convertion to ns
1202-
temp = self.pulse_array[i]['increment'].split(' ')
1202+
temp = self.pulse_array[i]['length_increment'].split(' ')
12031203
if temp[1] in self.timebase_dict:
12041204
flag = self.timebase_dict[temp[1]]
12051205
d_length = int(float(temp[0]))*flag
@@ -1239,11 +1239,11 @@ def awg_increment(self, *pulses):
12391239
if element in self.pulse_name_array:
12401240
pulse_index = self.pulse_name_array.index(element)
12411241

1242-
if int( self.pulse_array[pulse_index]['increment'][:-3] ) == 0:
1242+
if int( self.pulse_array[pulse_index]['length_increment'][:-3] ) == 0:
12431243
pass
12441244
else:
12451245
# convertion to ns
1246-
temp = self.pulse_array[pulse_index]['increment'].split(' ')
1246+
temp = self.pulse_array[pulse_index]['length_increment'].split(' ')
12471247
if temp[1] in self.timebase_dict:
12481248
flag = self.timebase_dict[temp[1]]
12491249
d_length = int(float(temp[0]))*flag
@@ -1264,13 +1264,13 @@ def awg_increment(self, *pulses):
12641264
else:
12651265
pass
12661266

1267-
if self.pulse_array[i]['function'] == 'SINE':
1268-
self.pulse_array[i]['length'] = str( leng + d_length ) + ' ns'
1269-
self.pulse_array[i]['sigma'] = str( sigm + d_length ) + ' ns'
1270-
elif self.pulse_array[i]['function'] == 'GAUSS' or self.pulse_array[i]['function'] == 'SINC':
1267+
if self.pulse_array[pulse_index]['function'] == 'SINE':
1268+
self.pulse_array[pulse_index]['length'] = str( leng + d_length ) + ' ns'
1269+
self.pulse_array[pulse_index]['sigma'] = str( sigm + d_length ) + ' ns'
1270+
elif self.pulse_array[pulse_index]['function'] == 'GAUSS' or self.pulse_array[i]['function'] == 'SINC':
12711271
ratio = leng/sigm
1272-
self.pulse_array[i]['length'] = str( leng + ratio*d_length ) + ' ns'
1273-
self.pulse_array[i]['sigma'] = str( sigm + d_length ) + ' ns'
1272+
self.pulse_array[pulse_index]['length'] = str( leng + ratio*d_length ) + ' ns'
1273+
self.pulse_array[pulse_index]['sigma'] = str( sigm + d_length ) + ' ns'
12741274

12751275
self.increment_count = 1
12761276
self.current_phase_index = 0
@@ -1280,11 +1280,11 @@ def awg_increment(self, *pulses):
12801280
if len(pulses) == 0:
12811281
i = 0
12821282
while i < len( self.pulse_array ):
1283-
if int( self.pulse_array[i]['increment'][:-3] ) == 0:
1283+
if int( self.pulse_array[i]['length_increment'][:-3] ) == 0:
12841284
pass
12851285
else:
12861286
# convertion to ns
1287-
temp = self.pulse_array[i]['increment'].split(' ')
1287+
temp = self.pulse_array[i]['length_increment'].split(' ')
12881288
if temp[1] in self.timebase_dict:
12891289
flag = self.timebase_dict[temp[1]]
12901290
d_length = int(float(temp[0]))*flag
@@ -1307,9 +1307,15 @@ def awg_increment(self, *pulses):
13071307

13081308
ratio = leng/sigm
13091309
if ( leng + ratio*d_length ) <= self.max_pulse_length:
1310-
self.pulse_array[i]['length'] = str( leng + d_length ) + ' ns'
1310+
if self.pulse_array[i]['function'] == 'SINE':
1311+
self.pulse_array[i]['length'] = str( leng + d_length ) + ' ns'
1312+
self.pulse_array[i]['sigma'] = str( sigm + d_length ) + ' ns'
1313+
elif self.pulse_array[i]['function'] == 'GAUSS' or self.pulse_array[i]['function'] == 'SINC':
1314+
#ratio = leng/sigm
1315+
self.pulse_array[i]['length'] = str( leng + ratio*d_length ) + ' ns'
1316+
self.pulse_array[i]['sigma'] = str( sigm + d_length ) + ' ns'
13111317
else:
1312-
assert(1 == 2), 'Exceeded maximum pulse length (1900 ns) when increment the pulse'
1318+
assert(1 == 2), 'Exceeded maximum pulse length' + str(self.max_pulse_length) + 'when increment the pulse'
13131319

13141320
i += 1
13151321

@@ -1322,11 +1328,11 @@ def awg_increment(self, *pulses):
13221328
if element in self.pulse_name_array:
13231329

13241330
pulse_index = self.pulse_name_array.index(element)
1325-
if int( self.pulse_array[pulse_index]['increment'][:-3] ) == 0:
1331+
if int( self.pulse_array[pulse_index]['length_increment'][:-3] ) == 0:
13261332
pass
13271333
else:
13281334
# convertion to ns
1329-
temp = self.pulse_array[pulse_index]['increment'].split(' ')
1335+
temp = self.pulse_array[pulse_index]['length_increment'].split(' ')
13301336
if temp[1] in self.timebase_dict:
13311337
flag = self.timebase_dict[temp[1]]
13321338
d_length = int(float(temp[0]))*flag
@@ -1349,9 +1355,15 @@ def awg_increment(self, *pulses):
13491355

13501356
ratio = leng/sigm
13511357
if ( leng + ratio*d_length ) <= self.max_pulse_length:
1352-
self.pulse_array[pulse_index]['length'] = str( leng + d_length ) + ' ns'
1358+
if self.pulse_array[pulse_index]['function'] == 'SINE':
1359+
self.pulse_array[pulse_index]['length'] = str( leng + d_length ) + ' ns'
1360+
self.pulse_array[pulse_index]['sigma'] = str( sigm + d_length ) + ' ns'
1361+
elif self.pulse_array[pulse_index]['function'] == 'GAUSS' or self.pulse_array[i]['function'] == 'SINC':
1362+
#ratio = leng/sigm
1363+
self.pulse_array[pulse_index]['length'] = str( leng + ratio*d_length ) + ' ns'
1364+
self.pulse_array[pulse_index]['sigma'] = str( sigm + d_length ) + ' ns'
13531365
else:
1354-
assert(1 == 2), 'Exceeded maximum pulse length (1900 ns) when increment the pulse'
1366+
assert(1 == 2), 'Exceeded maximum pulse length' + str(self.max_pulse_length) + 'when increment the pulse'
13551367

13561368
self.increment_count = 1
13571369
self.current_phase_index = 0
@@ -2454,11 +2466,11 @@ def awg_pulse_sequence(self, *, pulse_type, pulse_start, pulse_delta_start,\
24542466
# pulse length. It is better to define the same buffer length
24552467
# for each segment, since in this case we should not worry about
24562468
# saving the information about memory size for each segments
2457-
self.max_pulse_length = max( pulse_length_smp )
2469+
max_pulse_length = max( pulse_length_smp )
24582470
max_start = max( pulse_start_smp )
24592471
max_delta_start = max( pulse_delta_start_smp )
24602472
# buffer length is defined from the largest delay
2461-
#segment_length = self.closest_power_of_two( max_start + self.max_pulse_length + max_delta_start*arguments_array[7] )
2473+
#segment_length = self.closest_power_of_two( max_start + max_pulse_length + max_delta_start*arguments_array[7] )
24622474
# buffer length is defined from the repetiton rate
24632475
segment_length = seq_rep_rate
24642476

@@ -3224,9 +3236,9 @@ def preparing_buffer_multi(self):
32243236
# assert(1 == 2), 'Number of segments are not equal to the number of AWG pulses'
32253237

32263238
# finding the maximum pulse length to create a buffer
3227-
self.max_pulse_length = max( max_length_array )
3228-
#buffer_per_max_pulse = self.closest_power_of_two( self.max_pulse_length )
3229-
buffer_per_max_pulse = self.round_to_closest( self.max_pulse_length , 32 )
3239+
max_pulse_length = max( max_length_array )
3240+
#buffer_per_max_pulse = self.closest_power_of_two( max_pulse_length )
3241+
buffer_per_max_pulse = self.round_to_closest( max_pulse_length , 32 )
32303242
if buffer_per_max_pulse < 32:
32313243
buffer_per_max_pulse = 32
32323244
general.message('Buffer size was rounded to the minimal available value (32 samples)')
@@ -3259,9 +3271,9 @@ def preparing_buffer_multi(self):
32593271
assert(1 == 2), 'Number of segments are not equal to the number of AWG pulses'
32603272

32613273
# finding the maximum pulse length to create a buffer
3262-
self.max_pulse_length = max( max_length_array )
3263-
#buffer_per_max_pulse = self.closest_power_of_two( self.max_pulse_length )
3264-
buffer_per_max_pulse = self.round_to_closest( self.max_pulse_length , 32 )
3274+
max_pulse_length = max( max_length_array )
3275+
#buffer_per_max_pulse = self.closest_power_of_two( max_pulse_length )
3276+
buffer_per_max_pulse = self.round_to_closest( max_pulse_length , 32 )
32653277
if buffer_per_max_pulse < 32:
32663278
buffer_per_max_pulse = 32
32673279
general.message('Buffer size was rounded to the minimal available value (32 samples)')
@@ -3462,9 +3474,9 @@ def preparing_buffer_single(self):
34623474
max_length_array.append( max( element[:,4] ))
34633475

34643476
# finding the maximum pulse length to create a buffer
3465-
self.max_pulse_length = max( max_length_array )
3466-
#buffer_per_max_pulse = self.closest_power_of_two( self.max_pulse_length )
3467-
buffer_per_max_pulse = self.round_to_closest( self.max_pulse_length , 32 )
3477+
max_pulse_length = max( max_length_array )
3478+
#buffer_per_max_pulse = self.closest_power_of_two( max_pulse_length )
3479+
buffer_per_max_pulse = self.round_to_closest( max_pulse_length , 32 )
34683480
if buffer_per_max_pulse < 32:
34693481
buffer_per_max_pulse = 32
34703482
general.message('Buffer size was rounded to the minimal available value (32 samples)')
@@ -3503,9 +3515,9 @@ def preparing_buffer_single(self):
35033515
for index, element in enumerate(pulses):
35043516
max_length_array.append( max( element[:,4] ))
35053517

3506-
self.max_pulse_length = max( max_length_array )
3507-
#buffer_per_max_pulse = self.closest_power_of_two( self.max_pulse_length )
3508-
buffer_per_max_pulse = self.round_to_closest( self.max_pulse_length , 32 )
3518+
max_pulse_length = max( max_length_array )
3519+
#buffer_per_max_pulse = self.closest_power_of_two( max_pulse_length )
3520+
buffer_per_max_pulse = self.round_to_closest( max_pulse_length , 32 )
35093521
if buffer_per_max_pulse < 32:
35103522
buffer_per_max_pulse = 32
35113523
general.message('Buffer size was rounded to the minimal available value (32 samples)')

0 commit comments

Comments
 (0)