numba加速
This commit is contained in:
parent
bdd71ac6e2
commit
9829f4b771
@ -19,7 +19,7 @@ from PySide6.QtGui import QPixmap, QImage
|
|||||||
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QWidget, QPushButton
|
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QWidget, QPushButton
|
||||||
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
|
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
# from numba import njit
|
from numba import njit
|
||||||
from scipy import signal
|
from scipy import signal
|
||||||
|
|
||||||
from ui.Mian import Ui_mainWindow as Ui_respCoarseAlign
|
from ui.Mian import Ui_mainWindow as Ui_respCoarseAlign
|
||||||
@ -509,7 +509,7 @@ class Data:
|
|||||||
return canvas.buffer_rgba(), width, height
|
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):
|
def get_Correlate(a, v):
|
||||||
result = np.empty(len(a) - len(v) * 1 - 1, dtype=np.int64)
|
result = np.empty(len(a) - len(v) * 1 - 1, dtype=np.int64)
|
||||||
for i in range(len(a) - len(v) - 1):
|
for i in range(len(a) - len(v) - 1):
|
||||||
@ -762,13 +762,12 @@ class MainWindow(QMainWindow):
|
|||||||
v = self.data.processed_XX[
|
v = self.data.processed_XX[
|
||||||
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
|
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
|
||||||
"PostCut"]].copy()
|
"PostCut"]].copy()
|
||||||
# a *= 100
|
a *= 100
|
||||||
# v *= 100
|
v *= 100
|
||||||
# a = a.astype(np.int64)
|
a = a.astype(np.int64)
|
||||||
# v = v.astype(np.int64)
|
v = v.astype(np.int64)
|
||||||
# a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
|
a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
|
||||||
# tho_relate = get_Correlate(a, v) / 10000
|
tho_relate = get_Correlate(a, v) / 10000
|
||||||
tho_relate = np.correlate(a, v, mode='full')
|
|
||||||
tho_relate2 = - tho_relate
|
tho_relate2 = - tho_relate
|
||||||
|
|
||||||
self.ui.progressBar.setValue(40)
|
self.ui.progressBar.setValue(40)
|
||||||
@ -780,13 +779,12 @@ class MainWindow(QMainWindow):
|
|||||||
v = self.data.processed_XX[
|
v = self.data.processed_XX[
|
||||||
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
|
self.data.Config["XXConfig"]["PreCut"]:len(self.data.processed_XX) - self.data.Config["XXConfig"][
|
||||||
"PostCut"]].copy()
|
"PostCut"]].copy()
|
||||||
# a *= 100
|
a *= 100
|
||||||
# v *= 100
|
v *= 100
|
||||||
# a = a.astype(np.int64)
|
a = a.astype(np.int64)
|
||||||
# v = v.astype(np.int64)
|
v = v.astype(np.int64)
|
||||||
# a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
|
a = np.pad(a, (len(v) - 1, len(v) - 1), mode='constant')
|
||||||
# abd_relate = get_Correlate(a, v) / 10000
|
abd_relate = get_Correlate(a, v) / 10000
|
||||||
abd_relate = np.correlate(a, v, mode='full')
|
|
||||||
abd_relate2 = - abd_relate
|
abd_relate2 = - abd_relate
|
||||||
|
|
||||||
self.ui.progressBar.setValue(80)
|
self.ui.progressBar.setValue(80)
|
||||||
|
@ -5,4 +5,4 @@ pyedflib
|
|||||||
matplotlib
|
matplotlib
|
||||||
pySide6
|
pySide6
|
||||||
pyyaml
|
pyyaml
|
||||||
# numba
|
numba
|
Loading…
Reference in New Issue
Block a user