放弃numba加速

This commit is contained in:
andrew 2023-09-23 15:20:32 +08:00
parent 9fc85615d6
commit bdd71ac6e2
2 changed files with 26 additions and 16 deletions

View File

@ -19,7 +19,7 @@ from PySide6.QtGui import QPixmap, QImage
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QWidget, QPushButton
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from numba import njit
# from numba import njit
from scipy import signal
from ui.Mian import Ui_mainWindow as Ui_respCoarseAlign
@ -509,7 +509,7 @@ class Data:
return canvas.buffer_rgba(), width, height
@njit("int64[:](int64[:],int64[:])", nogil=True, parallel=True)
# @njit("int64[:](int64[:],int64[:])", nogil=True, parallel=True)
def get_Correlate(a, v):
result = np.empty(len(a) - len(v) * 1 - 1, dtype=np.int64)
for i in range(len(a) - len(v) - 1):
@ -579,10 +579,10 @@ class MainWindow(QMainWindow):
sampNo = self.ui.comboBox_SelectFile.currentText()
if Path("./RespCoarseAlignInfo.csv").exists():
df = pd.read_csv("./RespCoarseAlignInfo.csv")
print(df)
# print(df)
df["sampNo"] = df["sampNo"].astype(str)
df = df[df["sampNo"] == sampNo]
print(df)
# print(df)
if len(df) == 0:
QMessageBox.warning(self, "警告", f"记录中无编号{sampNo},请计算对齐")
return
@ -762,12 +762,13 @@ class MainWindow(QMainWindow):
v = self.data.processed_XX[
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
"PostCut"]].copy()
a *= 100
v *= 100
a = a.astype(np.int64)
v = v.astype(np.int64)
a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
tho_relate = get_Correlate(a, v) / 10000
# a *= 100
# v *= 100
# a = a.astype(np.int64)
# v = v.astype(np.int64)
# a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
# tho_relate = get_Correlate(a, v) / 10000
tho_relate = np.correlate(a, v, mode='full')
tho_relate2 = - tho_relate
self.ui.progressBar.setValue(40)
@ -779,12 +780,13 @@ class MainWindow(QMainWindow):
v = self.data.processed_XX[
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
"PostCut"]].copy()
a *= 100
v *= 100
a = a.astype(np.int64)
v = v.astype(np.int64)
a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
abd_relate = get_Correlate(a, v) / 10000
# a *= 100
# v *= 100
# a = a.astype(np.int64)
# v = v.astype(np.int64)
# a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
# abd_relate = get_Correlate(a, v) / 10000
abd_relate = np.correlate(a, v, mode='full')
abd_relate2 = - abd_relate
self.ui.progressBar.setValue(80)

8
requirements.txt Normal file
View File

@ -0,0 +1,8 @@
numpy
pandas
scipy
pyedflib
matplotlib
pySide6
pyyaml
# numba