Skip to content
Snippets Groups Projects
Commit ce04bc5f authored by Sander Snoo's avatar Sander Snoo
Browse files

Added read_channels (Currently Qblox only).

parent f340caab
No related branches found
No related tags found
No related merge requests found
def read_channels(pulselib, t_measure, channels=None, sample_rate=None, iq_mode='Complex'):
'''
Reads the input channels without pulsing the AWG channels.
Args:
pulselib: pulselib object.
t_measure (float): measurement time [ns].
channels (Optional[list[name]]): pulselib names of channels to read.
sample_rate (Optional[float]): sample rate for time trace [Hz]
iq_mode (str):
when channel contains IQ data, i.e. iq_input=True or frequency is not None,
then this parameter specifies how the complex I/Q value should be returned:
'Complex': return IQ data as complex value.
'I': return only I value.
'Q': return only Q value.
'amplitude': return amplitude.
'phase:' return phase [radians],
'I+Q', return I and Q using channel name postfixes '_I', '_Q'.
'amplitude+phase'. return amplitude and phase using channel name postfixes '_amp', '_phase'.
Note:
The frequency and phase for IQ modulation is configured on the pulselib digitizer channel.
'''
# set sample rate for Keysight upload.
if t_measure > 200_000:
awg_sample_rate = 1e7
elif t_measure > 20_000:
awg_sample_rate = 1e8
else:
awg_sample_rate = 1e9
if channels is None:
channels = pulselib.digitizer_channels.keys()
seg = pulselib.mk_segment(sample_rate=awg_sample_rate)
for ch in channels:
seg[ch].acquire(0, t_measure, wait=True)
sequence = pulselib.mk_sequence([seg])
# sequence.set_hw_schedule() @@@ configure single shot and video mode schedules at pulselib init!!
sequence.n_rep = None
if sample_rate is not None:
sequence.set_acquisition(sample_rate=sample_rate)
param = sequence.get_measurement_param(upload='auto', iq_mode=iq_mode)
return param
from pulse_lib.tests.configurations.test_configuration import context
from pulse_lib.scan.read_input import read_channels
#%%
def test1():
pulse = context.init_pulselib(n_gates=0, n_sensors=2, rf_sources=False)
dc_param = read_channels(pulse, 1000)
return context.run('read', dc_param)
def test2():
pulse = context.init_pulselib(n_gates=0, n_sensors=2, rf_sources=False)
dc_param = read_channels(pulse, 100000, sample_rate=500e3)
return context.run('read', dc_param)
def test3(iq_mode='I+Q'):
pulse = context.init_pulselib(n_gates=0, n_sensors=2, rf_sources=True)
dc_param = read_channels(pulse, 10000, iq_mode=iq_mode)
return context.run('read_iq_'+iq_mode, dc_param)
#%%
if __name__ == '__main__':
ds1 = test1()
ds2 = test2()
ds3 = test3()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment