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

Added Keysight AWG mock rendering at 10 GSa/s using digital filter setting.

parent 8a8c54df
No related branches found
No related tags found
No related merge requests found
......@@ -88,9 +88,9 @@ class Context:
cfg = self._configuration
backend = cfg['backend']
if backend in ['Keysight', 'KeysightQS']:
for awg in awgs:
# anti-ringing filter
awg.set_digital_filter_mode(3)
# for awg in awgs:
# # anti-ringing filter
# awg.set_digital_filter_mode(3)
for dig in digs:
# Set mode AVERAGE
dig.set_acquisition_mode(1)
......@@ -261,7 +261,9 @@ class Context:
else:
print(f'no implementation for {runner}')
def plot_awgs(self, sequence, index=None, print_acquisitions=False, **kwargs):
def plot_awgs(self, sequence, index=None, print_acquisitions=False,
analogue_out=False,
**kwargs):
job = sequence.upload(index)
sequence.play(index)
pulse = self.pulse
......@@ -269,13 +271,16 @@ class Context:
for awg in list(pulse.awg_devices.values()) + list(pulse.digitizers.values()):
if hasattr(awg, 'plot'):
pt.figure()
awg.plot()
render_kwargs = {}
if analogue_out:
render_kwargs['analogue'] = True
awg.plot(**render_kwargs)
# awg.plot(discrete=True)
pt.legend()
pt.grid()
pt.ylabel('amplitude [V]')
pt.xlabel('time [ns]')
pt.title(f'AWG upload {awg.name}')
pt.title(f'output {awg.name}')
for (method, arguments) in kwargs.items():
getattr(pt, method)(*arguments)
self._savefig()
......
File added
File added
File added
import os
import logging
from dataclasses import dataclass
from typing import List, Tuple
import numpy as np
import xarray as xr
import scipy.signal as signal
import matplotlib.pyplot as pt
......@@ -144,7 +145,21 @@ class MockM3202A(Instrument):
else:
return 200e6/prescaler
def plot(self, bias_T_rc_time=0, discrete=False):
def _upconvert_filtered(self, t, wave):
t = np.linspace(t[0], t[-1]+1e-9, len(t)*10, endpoint=False)
d = np.zeros(len(wave)*10)
d[::10] = wave
fname = os.path.dirname(__file__) + f'/keysight_data/keysight_pulse_response_{self.digital_filter_mode}.hdf5'
pulse_response = xr.open_dataset(fname)
t_response = pulse_response.coords['t'].data
response = pulse_response['y'].data / 0.77
d = np.convolve(d, response)
n_before = round(-t_response[0]*10)
n_after = round(t_response[-1]*10)
return t, d[n_before: -n_after]
def plot(self, bias_T_rc_time=0, discrete=False, analogue=False):
for channel in range(1,5):
data, prescaler = self.get_data_prescaler(channel)
#print(f'{self.name}.{channel} data: {[(len(s),p) for s,p in zip(data,prescaler)]}')
......@@ -159,7 +174,15 @@ class MockM3202A(Instrument):
zi = [0]
for d,p in zip(data, prescaler):
sr = MockM3202A.convert_prescaler_to_sample_rate(p)
if p == 0 and not discrete:
if analogue:
n = round(1e9/sr)
ts = np.arange(len(d)*n)/1e9 + t0
t0 = ts[-1] + 1/sr
if n == 1:
wd = d
else:
wd = np.repeat(d,n)
elif p == 0 and not discrete:
ts = np.arange(len(d))/sr + t0
t0 = ts[-1] + 1/sr
wd = d
......@@ -184,6 +207,9 @@ class MockM3202A(Instrument):
t = np.concatenate(t)*1e9
pt.plot(t, wave, label=f'{self.name}-{channel}')
if analogue:
ta,da = self._upconvert_filtered(t, wave)
pt.plot(ta, da, label=f'{self.name}-{channel} Out')
if bias_T_rc_time:
biased = np.concatenate(biased_data)
pt.plot(t, biased, ':', label=f'{self.name}-{channel} bias-T')
......@@ -222,6 +248,6 @@ class MockM3202A_fpga(MockM3202A):
pt.plot(t, values, ':', label=f'{self.name}-T')
def plot(self, bias_T_rc_time=0, discrete=False):
super().plot(bias_T_rc_time=bias_T_rc_time, discrete=discrete)
def plot(self, bias_T_rc_time=0, discrete=False, analogue=False):
super().plot(bias_T_rc_time=bias_T_rc_time, discrete=discrete, analogue=analogue)
self.plot_marker()
......@@ -15,5 +15,8 @@ setup(name="pulse_lib",
'numpy>=1.20.0',
],
license='MIT',
package_data={
"pulse_lib.tests.keysight_data": ["*.hdf5"],
},
)
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