[plotting calibration] fixing power spectrum
This commit is contained in:
parent
c33e4cc32f
commit
031b5098d5
@ -44,6 +44,7 @@ class PyRelacs(QMainWindow):
|
||||
self.power_plot.addLegend()
|
||||
self.beat_plot.setBackground("w")
|
||||
self.power_plot.setBackground("w")
|
||||
self.power_plot.setLogMode(x=False, y=True)
|
||||
|
||||
self.threadpool = QThreadPool()
|
||||
self.repros = Repro()
|
||||
@ -80,17 +81,23 @@ class PyRelacs(QMainWindow):
|
||||
self._rlx_aboutaction.setEnabled(True)
|
||||
self._rlx_aboutaction.triggered.connect(self.on_about)
|
||||
|
||||
self._daq_connectaction = QAction(QIcon(":icons/connect.png"), "Connect DAQ", self)
|
||||
self._daq_connectaction = QAction(
|
||||
QIcon(":icons/connect.png"), "Connect DAQ", self
|
||||
)
|
||||
self._daq_connectaction.setStatusTip("Connect to daq device")
|
||||
# self._daq_connectaction.setShortcut(QKeySequence("Alt+d"))
|
||||
self._daq_connectaction.triggered.connect(self.connect_dac)
|
||||
|
||||
self._daq_disconnectaction = QAction(QIcon(":/icons/disconnect.png"), "Disconnect DAQ", self)
|
||||
self._daq_disconnectaction = QAction(
|
||||
QIcon(":/icons/disconnect.png"), "Disconnect DAQ", self
|
||||
)
|
||||
self._daq_disconnectaction.setStatusTip("Disconnect the DAQ device")
|
||||
# self._daq_connectaction.setShortcut(QKeySequence("Alt+d"))
|
||||
self._daq_disconnectaction.triggered.connect(self.disconnect_dac)
|
||||
|
||||
self._daq_calibaction = QAction(QIcon(":/icons/calibration.png"), "Plot calibration", self)
|
||||
self._daq_calibaction = QAction(
|
||||
QIcon(":/icons/calibration.png"), "Plot calibration", self
|
||||
)
|
||||
self._daq_calibaction.setStatusTip("Calibrate the attenuator device")
|
||||
# self._daq_calibaction.setShortcut(QKeySequence("Alt+d"))
|
||||
self._daq_calibaction.triggered.connect(self.plot_calibration)
|
||||
@ -205,21 +212,24 @@ class PyRelacs(QMainWindow):
|
||||
beat = stim[:] + fish[:]
|
||||
beat_squared = beat**2
|
||||
|
||||
f, powerspec = welch(beat, fs=40_000.0)
|
||||
powerspec = decibel(powerspec)
|
||||
f, powerspec = welch(
|
||||
beat_squared,
|
||||
window="flattop",
|
||||
fs=40_000.0,
|
||||
nperseg=100_000,
|
||||
)
|
||||
|
||||
f_sq, powerspec_sq = welch(beat_squared, fs=40_000.0)
|
||||
powerspec_sq = decibel(powerspec_sq)
|
||||
peaks = find_peaks(powerspec_sq, prominence=10)[0]
|
||||
peaks = find_peaks(powerspec, prominence=0.001)[0]
|
||||
pen = pg.mkPen(colors[i])
|
||||
|
||||
self.beat_plot.plot(
|
||||
np.arange(0, len(beat)) / 40_000.0,
|
||||
beat_squared,
|
||||
beat,
|
||||
pen=pen,
|
||||
name=stim.name,
|
||||
)
|
||||
self.power_plot.plot(f_sq, powerspec_sq, pen=pen, name=stim.name)
|
||||
self.power_plot.plot(f[peaks], powerspec_sq[peaks], pen=None, symbol="x")
|
||||
self.power_plot.plot(f, powerspec, pen=pen, name=stim.name)
|
||||
self.power_plot.plot(f[peaks], powerspec[peaks], pen=None, symbol="x")
|
||||
|
||||
def connect_dac(self):
|
||||
devices = uldaq.get_daq_device_inventory(uldaq.InterfaceType.USB)
|
||||
|
Loading…
Reference in New Issue
Block a user