Commit 822b9026 authored by Christian Schneider's avatar Christian Schneider
Browse files

Fixes for DC Setup

parent e8251c23
......@@ -22,6 +22,7 @@ import matplotlib.pyplot as plt
import peakutils
from scipy.signal import welch
import matplotlib.pyplot as plt
import bokeh.plotting as bp
......@@ -234,6 +235,8 @@ class DC_SQUID(object):
y_axis_label='V_SQUID (V)')
p = const_plot_xy(self.daq, self.xxf.get_parameters(), fig,
acq_time)
#fig = plt.figure(dpi=200)
p.start()
def stop(b):
......@@ -515,7 +518,7 @@ class DC_SQUID(object):
def acq_spectrum_SA(self, f_start=1e3, f_stop=1e6, BW=1, units='Volts',
averages=1, filename=None, verbose=True, force=False,
get_Rd=True, to_flux=False, **dm_pars):
get_Rd=True, to_flux=False,points=8001, **dm_pars):
"""Acquire spectrum using spectrum analyzer.
In FLL mode, the squid gain is required to normalize the
......@@ -561,10 +564,10 @@ class DC_SQUID(object):
filename=None,
autoplot=False,
print_info=False,
points=8001)
points=points)
xxf_pars = self.xxf.get_parameters()
if units in ['Volts']:
if units in ['Volts', 'V']:
spec.y = spec.y ** 2 # in V^2/Hz
spec.y /= spec.par['BW'] # normalized to BW
spec.rename_y('PSD (V^2/Hz)')
......@@ -627,7 +630,7 @@ class DC_SQUID(object):
def acq_spectrum_both(self, acq_time=1, BW=1, to_flux=False, filename=None,
welch_factor=5, f_start=1e3, f_stop=1e6,
units='Volts', averages=1, force=False,
verbose=False, amp_BW='full'):
verbose=False, amp_BW='full', points=8001):
"""Acquire DAQ and SA spectrum at the same time
Parameters
......@@ -679,7 +682,7 @@ class DC_SQUID(object):
sa_thread = pool.apply_async(self.acq_spectrum_SA,
(f_start, f_stop, BW, units,
averages, fname_sa, verbose, force,
False, to_flux))
False, to_flux, points))
daq = daq_thread.get()
sa = sa_thread.get()
......@@ -1376,9 +1379,9 @@ class const_plot_xy(Process):
x, y = dm.average_duplicates(x, y)
self.fig = fig
self.v_p = self.fig.line(x * self.gen1['PeakPeak'],
y / self.gain,
line_width=2)
v_p = self.fig.line(x * self.gen1['PeakPeak'],
y / self.gain,
line_width=2)
self.handle = bp.show(self.fig, notebook_handle=True)
def run(self):
......@@ -1406,3 +1409,57 @@ class const_plot_xy(Process):
if self.v_p:
del self.v_p
self.exit.set()
class const_plot_xy_pyplot(Process):
"""Continuously plotting xy from DAQ"""
def __init__(self, daq, xxf_pars, fig, acq_time=0.1):
Process.__init__(self)
self.exit = Event()
# Init plot
self.acq_time = acq_time
# Save XXF parameters
self.gen1 = xxf_pars['Gen1']
self.gain = xxf_pars['Amp_Gain']
self.Phib = xxf_pars['Phib']
self.Ib = xxf_pars['Ib']
# Set DAQ
daq.set_channels([3, 7]) # 3 Monitor, 7 signal
x, y = daq.read(acq_time)
x = np.array(x)
y = np.array(y)
self.daq = daq
# Shift by 0.5 if generator is not set to bipolar
if not self.gen1['Bipolar']:
x += 0.5
x, y = dm.average_duplicates(x, y)
self.fig = plt.figure(dpi=200)
def run(self):
print('Updating...')
while not self.exit.is_set():
try:
x, y = self.daq.read(self.acq_time)
x = np.array(x)
y = np.array(y)
if not self.gen1['Bipolar']:
x += 0.5
x, y = dm.average_duplicates(x, y)
plt.plot(x,y)
except:
time.sleep(1)
print('Error')
pass
def shutdown(self):
if self.v_p:
del self.v_p
self.exit.set()
\ No newline at end of file
......@@ -36,12 +36,12 @@ IPList = {'SCOPE': '192.168.0.99',
'YOKO3': '192.168.0.143',
'YOKO4': '192.168.0.144',
'LJ1': "192.168.0.129",
'SA1': '192.168.0.115',
'SA1': '192.168.1.4',
'SA2': '192.168.0.140',
'SMU4': '192.168.0.147',
'SMU5': '192.168.0.148',
'XXF1': '138.232.183.115', # Running on Windows machine
'NI6020': '138.232.183.115', # Running on Windows machine
'XXF1': '192.168.1.2', # Running on Windows machine
'NI6020': '192.168.1.2', # Running on Windows machine
'DA1': '192.168.0.131',
'DA2': '192.168.0.119::23',
'Valon1': '192.168.0.155::23',
......
......@@ -16,11 +16,11 @@ from IPLIST import IPList
try:
from Monitor.functions import update_db, check_db
except:
def update_db():
def update_db(*args):
return
def check_db():
def check_db(*args):
return
......
......@@ -14,11 +14,11 @@ from IPLIST import IPList
try:
from Monitor.functions import update_db, check_db
except:
def update_db():
def update_db(*args):
return
def check_db():
def check_db(*args):
return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment