In [1]:
from Initialization import *
In [2]:
station.components
Out[2]:
In [3]:
station.AWG
Out[3]:
In [5]:
AWG.ch1_status()
Out[5]:
In [6]:
AWG.ch1_amp(1.0)
AWG.ch2_amp(1.0)
In [7]:
RFLO.on()
In [71]:
SPEC.power(-10)
SPEC.IQ_state('ON')
SPEC.frequency(6.592e9-0.05e9)
SPEC.on()
In [69]:
RFLO.power(19.0)
RFLO.frequency(6.1565e9)
In [81]:
ATS.config(clock_source='INTERNAL_CLOCK',
sample_rate=1e9,
clock_edge='CLOCK_EDGE_RISING',
decimation=0,
coupling=['DC','DC'],
channel_range=[0.1,0.1],
impedance=[50,50],
bwlimit=['DISABLED','DISABLED'],
trigger_operation='TRIG_ENGINE_OP_J',
trigger_engine1='TRIG_ENGINE_J',
trigger_source1='EXTERNAL',
trigger_slope1='TRIG_SLOPE_POSITIVE',
trigger_level1=128,
trigger_engine2='TRIG_ENGINE_K',
trigger_source2='DISABLE',
trigger_slope2='TRIG_SLOPE_POSITIVE',
trigger_level2=128,
external_trigger_coupling='AC',
external_trigger_range='ETR_5V',
trigger_delay=0,
timeout_ticks=0
)
In [138]:
# configure the ATS controller
ATS_controller.update_acquisitionkwargs(#mode='NPT',
samples_per_record=4096,
records_per_buffer=8000,#70, segmments
buffers_per_acquisition=1,
channel_selection='AB',
transfer_offset=0,
external_startcapture='ENABLED',
enable_record_headers='DISABLED',
alloc_buffers='DISABLED',
fifo_only_streaming='DISABLED',
interleave_samples='DISABLED',
get_processed_data='DISABLED',
allocated_buffers=1,
buffer_timeout=500,
)
In [13]:
AWG.set_sequence("blub_FILE.seq")
In [21]:
AWG.start()
In [41]:
def ATS_homodyne_acquisition(integration_start, integration_time):
integration_end = integration_start + integration_time
ATS.external_trigger_coupling._set_updated()
ATS.external_trigger_range._set_updated()
ATS_controller.pre_acquire()
blub = ATS_controller.do_acquisition()
ATS_controller.post_acquire()
buffer = ATS_controller.buffer
reshaped_buffer = buffer.reshape(2, ATS.records_per_buffer(), ATS.samples_per_record())-128.
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[-50:]])
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[:50]])
average_record_I = np.average(reshaped_buffer[0,:,:], axis = 0)
average_record_Q = np.average(reshaped_buffer[1,:,:], axis = 0)
offset_I = np.average(average_record_I[3000:4000])
offset_Q = np.average(average_record_Q[3000:4000])
# range_I = np.max(average_record_I[integration_start:integration_end]) \
# -np.min(average_record_I[integration_start:integration_end])
# range_Q = np.max(average_record_Q[integration_start:integration_end]) \
# -np.min(average_record_Q[integration_start:integration_end])
integrated_output_I = np.average(average_record_I[integration_start:integration_end]-offset_I)#/range_I
integrated_output_Q = np.average(average_record_Q[integration_start:integration_end]-offset_Q)#/range_Q
return [integrated_output_I, integrated_output_Q]
In [90]:
ATS_homodyne_acquisition(500,2000)
Out[90]:
In [52]:
%matplotlib inline
In [24]:
AWG.set_sequence('pulsed_spec_sequence_FILE.seq')
In [154]:
integration_start=674
integration_end=integration_start+1000
RFLO.frequency(6.157e9)
SPEC.frequency(6.157e9-0.05e9)
SPEC.power(-10)
SPEC.on()
ATS.external_trigger_coupling._set_updated()
ATS.external_trigger_range._set_updated()
ATS_controller.pre_acquire()
blub = ATS_controller.do_acquisition()
ATS_controller.post_acquire()
buffer = ATS_controller.buffer
reshaped_buffer = buffer.reshape(2, ATS.records_per_buffer(), ATS.samples_per_record())
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[-50:]])
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[:50]])
average_record_I = np.average(reshaped_buffer[0,:,:], axis = 0)
average_record_Q = np.average(reshaped_buffer[1,:,:], axis = 0)
integrated_output_power = np.average((average_record_I[integration_start:integration_end]
+average_record_Q[integration_start:integration_end])**2)
# integrated_output_power = np.average(((average_record_I[integration_start:integration_end])**2
# +(average_record_Q[integration_start:integration_end])**2))**0.5
plt.figure(figsize=(10,10))
plt.plot(average_record_I)
plt.plot(average_record_Q)
plt.xlim(0, 800)
Out[154]:
In [121]:
ATS_homodyne_acquisition(675,800)
Out[121]:
In [580]:
SPEC.off()
frequencies = np.linspace(6.157e9-0.01e9, 6.157e9+0.01e9, 101)
integrated_output = []
for i, frequency in enumerate(frequencies):
RFLO.frequency.set(frequency)
integrated_output.append(ATS_homodyne_acquisition(670,1100))
# print(frequency)
integrated_output = np.array(integrated_output)
plt.figure()
plt.plot(frequencies, integrated_output[:,0])
plt.plot(frequencies, integrated_output[:,1])
plt.figure()
plt.plot(frequencies, np.sqrt(integrated_output[:,0]**2+integrated_output[:,1]**2))
Out[580]:
In [489]:
%matplotlib inline
integrated_output = np.array(v integrated_output)
In [490]:
integrated_output.shape
Out[490]:
In [491]:
plt.plot(frequencies, integrated_output[:,0])
plt.plot(frequencies, integrated_output[:,1])
Out[491]:
In [492]:
plt.plot(frequencies, np.sqrt(integrated_output[:,0]**2+integrated_output[:,1]**2))
Out[492]:
In [155]:
spec_frequencies = np.linspace(6.585e9, 6.595e9, 101)
integrated_output = []
SPEC.power.set(-35)
SPEC.IQ_state.set('ON')
SPEC.on()
RFLO.frequency.set(6.1565e9)
for i, frequency in enumerate(spec_frequencies):
SPEC.frequency.set(frequency-0.05e9)
integrated_output.append(ATS_homodyne_acquisition(770,1000))
# print(frequency)
integrated_output = np.array(integrated_output)
plt.figure()
plt.plot(spec_frequencies, integrated_output[:,0])
plt.plot(spec_frequencies, integrated_output[:,1])
plt.figure()
plt.plot(spec_frequencies, np.sqrt(integrated_output[:,0]**2+integrated_output[:,1]**2))
Out[155]:
In [ ]:
plt.figure()
plt.plot(spec_frequencies, np.sqrt(integrated_output[:,0]**2+integrated_output[:,1]**2))
plt.title('Pulse spectroscopy')
plt.xlabel('Frequency GHz')
plt.ylabel('Homodyne voltage (a.u.)')
plt.xticks(np.arange(6.58e9, 6.60e9, 5e+7))
plt.savefig('foo.png', dpi=300, bbox_inches='tight')
In [ ]:
from lmfit import Model
def lorentzian(x, x0, amp,gamma,offset):
return amp*(0.5*gamma/((x-x0)**2+0.25*gamma**2)/np.pi)+offset
f=spec_frequencies
y=np.sqrt(integrated_output[:,0]**2+integrated_output[:,1]**2)
gmodel = Model(lorentzian)
result = gmodel.fit(y,x=f,amp=0.05,gamma=1e+6, x0=6.591e+9,offset=7.0)
print(result.fit_report())
plt.figure()
# plt.xlabel('time (s)')
# plt.ylabel('2 state population')
plt.plot(f, y, 'bo')
plt.plot(f, result.init_fit, 'k--')
plt.plot(f, result.best_fit, 'r-')
# plt.ylim(0.0, 0.9)
plt.xlim(6.59e+9,6.5925e+9)
plt.show()
In [265]:
ATS.records_per_buffer()*ATS.samples_per_record()*ATS.buffers_per_acquisition()
Out[265]:
In [523]:
integration_start=674
integration_end=integration_start+1000
RFLO.frequency(6.5e9)
SPEC.frequency(6.5e9-0.05e9)
ATS.external_trigger_coupling._set_updated()
ATS.external_trigger_range._set_updated()
ATS_controller.pre_acquire()
blub = ATS_controller.do_acquisition()
ATS_controller.post_acquire()
buffer = ATS_controller.buffer
reshaped_buffer = buffer.reshape(2, ATS.records_per_buffer(), ATS.samples_per_record())
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[-50:]])
# print(reshaped_buffer.flatten()[np.argsort(reshaped_buffer.flatten())[:50]])
average_record_I = np.average(reshaped_buffer[0,:,:], axis = 0)
average_record_Q = np.average(reshaped_buffer[1,:,:], axis = 0)
integrated_output_power = np.average((average_record_I[integration_start:integration_end]
+average_record_Q[integration_start:integration_end])**2)
# integrated_output_power = np.average(((average_record_I[integration_start:integration_end])**2
# +(average_record_Q[integration_start:integration_end])**2))**0.5
plt.figure(figsize=(10,10))
plt.plot(average_record_I)
plt.plot(average_record_Q)
Out[523]:
In [20]:
AWG.set_sequence("blub_FILE.seq")
In [ ]: