Compare commits
2 Commits
a871310cda
...
cca9bb710d
Author | SHA1 | Date |
---|---|---|
Sebastien Bourdeauducq | cca9bb710d | |
Sebastien Bourdeauducq | ba62a6cd7d |
10
flake.nix
10
flake.nix
|
@ -5,14 +5,20 @@
|
|||
pkgs = artiq.inputs.nixpkgs.legacyPackages.x86_64-linux;
|
||||
aqmain = artiq.packages.x86_64-linux;
|
||||
in {
|
||||
defaultPackage.x86_64-linux = pkgs.buildEnv {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
name = "aq6140-env";
|
||||
paths = [
|
||||
buildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [
|
||||
aqmain.artiq
|
||||
ps.pyvisa ps.pyvisa-py ps.numpy
|
||||
ps.pyqtgraph
|
||||
]))
|
||||
];
|
||||
shellHook=
|
||||
''
|
||||
export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix}
|
||||
export QML2_IMPORT_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtQmlPrefix}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import PyQt5
|
||||
import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtGui, QtCore
|
||||
import numpy as np
|
||||
from scipy.signal import hilbert
|
||||
from scipy.fft import fft, fftfreq
|
||||
from scipy.signal.windows import hamming
|
||||
|
||||
a = 250000
|
||||
b = 450000
|
||||
ch1 = np.load("siglent_ch1.npy")[a:b]
|
||||
ch2 = np.load("siglent_ch2.npy")[a:b]
|
||||
|
||||
ch1 = ch1 - np.mean(ch1)
|
||||
ch2 = ch2 - np.mean(ch2)
|
||||
|
||||
out_samples = []
|
||||
prev_ref = ch1[0]
|
||||
for sample, ref in zip(ch1, ch2):
|
||||
if prev_ref*ref < 0:
|
||||
out_samples.append(sample)
|
||||
prev_ref = ref
|
||||
|
||||
|
||||
app = QtGui.QApplication([])
|
||||
mainwindow = QtGui.QMainWindow()
|
||||
|
||||
widget = pg.PlotWidget()
|
||||
mainwindow.setCentralWidget(widget)
|
||||
|
||||
mainwindow.show()
|
||||
|
||||
out_samples = out_samples*hamming(len(out_samples))
|
||||
|
||||
widget.clear()
|
||||
widget.plot(2*473.6*fftfreq(len(out_samples))[:len(out_samples)//2], np.abs(fft(out_samples))[:len(out_samples)//2])
|
||||
|
||||
app.exec_()
|
||||
|
Loading…
Reference in New Issue