From 49e848b1de1de2732da16f580867da2caf1703c1 Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Tue, 3 Sep 2024 14:19:10 +0100 Subject: [PATCH 1/4] make qt helper functions into module --- atlaselectrophysiology/alignment_with_easyqc.py | 2 +- atlaselectrophysiology/ephys_atlas_gui.py | 2 +- atlasview/atlasview.py | 2 +- data_exploration_gui/data_explore_gui.py | 2 +- data_exploration_gui/gui_main.py | 2 +- histology/atlas_mpl.py | 4 ++-- needles2/run_needles2.py | 2 +- needles2/spike_features.py | 2 +- qt_helpers/__init__.py | 0 qt.py => qt_helpers/qt.py | 0 qt_matplotlib.py => qt_helpers/qt_matplotlib.py | 0 viewspikes/load_ma_data.py | 2 +- 12 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 qt_helpers/__init__.py rename qt.py => qt_helpers/qt.py (100%) rename qt_matplotlib.py => qt_helpers/qt_matplotlib.py (100%) diff --git a/atlaselectrophysiology/alignment_with_easyqc.py b/atlaselectrophysiology/alignment_with_easyqc.py index 924b890..452bd98 100644 --- a/atlaselectrophysiology/alignment_with_easyqc.py +++ b/atlaselectrophysiology/alignment_with_easyqc.py @@ -7,7 +7,7 @@ from PyQt5 import QtCore, QtGui import numpy as np import pyqtgraph as pg -import qt +from qt_helpers import qt from one.api import ONE from iblutil.util import Bunch diff --git a/atlaselectrophysiology/ephys_atlas_gui.py b/atlaselectrophysiology/ephys_atlas_gui.py index cb1dcbc..6f18512 100644 --- a/atlaselectrophysiology/ephys_atlas_gui.py +++ b/atlaselectrophysiology/ephys_atlas_gui.py @@ -20,7 +20,7 @@ from ephysfeatures.features_across_region import RegionFeatureWindow from atlaselectrophysiology.create_overview_plots import make_overview_plot from pathlib import Path -import qt +from qt_helpers import qt import matplotlib.pyplot as mpl # noqa # This is needed to make qt show properly :/ diff --git a/atlasview/atlasview.py b/atlasview/atlasview.py index 79d402f..6f372c1 100644 --- a/atlasview/atlasview.py +++ b/atlasview/atlasview.py @@ -21,7 +21,7 @@ import matplotlib from iblatlas.atlas import AllenAtlas -import qt +from qt_helpers import qt class TopView(QtWidgets.QMainWindow): diff --git a/data_exploration_gui/data_explore_gui.py b/data_exploration_gui/data_explore_gui.py index e0d21f3..fc69546 100644 --- a/data_exploration_gui/data_explore_gui.py +++ b/data_exploration_gui/data_explore_gui.py @@ -15,7 +15,7 @@ import data_exploration_gui.data_model as dat from data_exploration_gui import utils -import qt +from qt_helpers import qt import matplotlib.pyplot as mpl # noqa # This is needed to make qt show properly :/ from one.api import ONE diff --git a/data_exploration_gui/gui_main.py b/data_exploration_gui/gui_main.py index 9490c21..ecad16b 100644 --- a/data_exploration_gui/gui_main.py +++ b/data_exploration_gui/gui_main.py @@ -12,7 +12,7 @@ from pathlib import Path import numpy as np -import qt +from qt_helpers import qt import matplotlib.pyplot as mpl # noqa # This is needed to make qt show properly :/ diff --git a/histology/atlas_mpl.py b/histology/atlas_mpl.py index 086f2bd..7c9f632 100644 --- a/histology/atlas_mpl.py +++ b/histology/atlas_mpl.py @@ -3,8 +3,8 @@ import numpy as np from PyQt5 import QtCore, QtWidgets, uic -from iblapps import qt -from iblapps.qt_matplotlib import BaseMplCanvas +from qt_helpers import qt +from qt_helpers.qt_matplotlib import BaseMplCanvas import iblatlas.atlas as atlas # Make sure that we are using QT5 diff --git a/needles2/run_needles2.py b/needles2/run_needles2.py index 2f4337f..a149224 100644 --- a/needles2/run_needles2.py +++ b/needles2/run_needles2.py @@ -11,7 +11,7 @@ from iblatlas.atlas import AllenAtlas, Insertion -import qt +from qt_helpers import qt from one.api import ONE from needles2.probe_model import ProbeModel diff --git a/needles2/spike_features.py b/needles2/spike_features.py index a769168..3da141c 100644 --- a/needles2/spike_features.py +++ b/needles2/spike_features.py @@ -1,7 +1,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore import pyqtgraph as pg import pyqtgraph.exporters -import qt +from qt_helpers import qt import atlaselectrophysiology.ColorBar as cb from dataclasses import dataclass, field diff --git a/qt_helpers/__init__.py b/qt_helpers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/qt.py b/qt_helpers/qt.py similarity index 100% rename from qt.py rename to qt_helpers/qt.py diff --git a/qt_matplotlib.py b/qt_helpers/qt_matplotlib.py similarity index 100% rename from qt_matplotlib.py rename to qt_helpers/qt_matplotlib.py diff --git a/viewspikes/load_ma_data.py b/viewspikes/load_ma_data.py index 7ad6a27..48d90bc 100644 --- a/viewspikes/load_ma_data.py +++ b/viewspikes/load_ma_data.py @@ -1,7 +1,7 @@ from one.api import ONE import one.alf.io as alfio from iblutil.util import Bunch -import qt +from qt_helpers import qt import numpy as np import pyqtgraph as pg From f9fde74edd1158e7f317e15b22029bfa32cb5e7a Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Tue, 3 Sep 2024 14:22:56 +0100 Subject: [PATCH 2/4] neurodsp -> ibldsp --- atlaselectrophysiology/alignment_with_easyqc.py | 2 +- atlaselectrophysiology/extract_files.py | 2 +- atlaselectrophysiology/plot_data.py | 2 +- dlc/DLC_labeled_video.py | 2 +- needles2/probe_model.py | 2 +- viewspikes/gui.py | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atlaselectrophysiology/alignment_with_easyqc.py b/atlaselectrophysiology/alignment_with_easyqc.py index 452bd98..8d372af 100644 --- a/atlaselectrophysiology/alignment_with_easyqc.py +++ b/atlaselectrophysiology/alignment_with_easyqc.py @@ -1,5 +1,5 @@ from easyqc.gui import viewseis -from neurodsp import voltage +from ibldsp import voltage import neuropixel from viewspikes.data import stream from viewspikes.plots import overlay_spikes diff --git a/atlaselectrophysiology/extract_files.py b/atlaselectrophysiology/extract_files.py index 8acaf42..9092044 100644 --- a/atlaselectrophysiology/extract_files.py +++ b/atlaselectrophysiology/extract_files.py @@ -4,7 +4,7 @@ from tqdm import tqdm import spikeglx import numpy as np -from neurodsp import fourier, utils +from ibldsp import fourier, utils from scipy import signal import one.alf.io as alfio import ibllib.ephys.ephysqc as ephysqc diff --git a/atlaselectrophysiology/plot_data.py b/atlaselectrophysiology/plot_data.py index b0214e6..d024873 100644 --- a/atlaselectrophysiology/plot_data.py +++ b/atlaselectrophysiology/plot_data.py @@ -4,7 +4,7 @@ from brainbox.io.spikeglx import Streamer from brainbox.population.decode import xcorr from brainbox.task import passive -from neurodsp import voltage +from ibldsp import voltage import neuropixel import scipy from PyQt5 import QtGui diff --git a/dlc/DLC_labeled_video.py b/dlc/DLC_labeled_video.py index 884ebd5..624bef2 100644 --- a/dlc/DLC_labeled_video.py +++ b/dlc/DLC_labeled_video.py @@ -7,7 +7,7 @@ import pandas as pd # conda install -c conda-forge pyarrow import os -from neurodsp.smooth import smooth_interpolate_savgol +from ibldsp.smooth import smooth_interpolate_savgol from brainbox.io.one import SessionLoader from copy import deepcopy diff --git a/needles2/probe_model.py b/needles2/probe_model.py index 78c042b..b486c77 100644 --- a/needles2/probe_model.py +++ b/needles2/probe_model.py @@ -12,7 +12,7 @@ from iblatlas import atlas from neuropixel import TIP_SIZE_UM, trace_header from ibllib.pipes.ephys_alignment import EphysAlignment -from neurodsp.utils import fcn_cosine +from ibldsp.utils import fcn_cosine PROV_2_VAL = { 'Resolved': 90, diff --git a/viewspikes/gui.py b/viewspikes/gui.py index 32313bf..4219b9a 100644 --- a/viewspikes/gui.py +++ b/viewspikes/gui.py @@ -7,7 +7,7 @@ from iblutil.numerical import bincount2D from viewephys.gui import viewephys -import neurodsp +import ibldsp from brainbox.io.one import EphysSessionLoader, SpikeSortingLoader from iblatlas.atlas import BrainRegions @@ -134,7 +134,7 @@ def show_ephys(self, t0, tlen=1): sos = scipy.signal.butter(**butter_kwargs, output='sos') butt = scipy.signal.sosfiltfilt(sos, raw) - destripe = neurodsp.voltage.destripe(raw, fs=self.sr.fs) + destripe = ibldsp.voltage.destripe(raw, fs=self.sr.fs) self.eqc_raw = viewephys(butt, self.sr.fs, channels=self.channels, br=regions, title='butt', t0=t0, t_scalar=1) self.eqc_des = viewephys(destripe, self.sr.fs, channels=self.channels, br=regions, title='destripe', t0=t0, t_scalar=1) From 302c8c0ea3d2baa842d96e1fd0ea1ed7706284de Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Tue, 3 Sep 2024 14:32:57 +0100 Subject: [PATCH 3/4] link to __main__ --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1eca54a..69eb959 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ entry_points={ 'console_scripts': [ 'atlas=atlasview.atlasview:main', - 'align=atlaselectrophysiology.ephys_atlas_gui:main', + 'align=atlaselectrophysiology.ephys_atlas_gui:__main__', ] }, ) From 9fbad0477c17c18c8b7788975614be44526cc18c Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Tue, 3 Sep 2024 14:37:44 +0100 Subject: [PATCH 4/4] launch offline function --- atlaselectrophysiology/ephys_atlas_gui.py | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/atlaselectrophysiology/ephys_atlas_gui.py b/atlaselectrophysiology/ephys_atlas_gui.py index 6f18512..e306568 100644 --- a/atlaselectrophysiology/ephys_atlas_gui.py +++ b/atlaselectrophysiology/ephys_atlas_gui.py @@ -2149,6 +2149,14 @@ def viewer(probe_id, one=None, histology=False, spike_collection=None, title=Non return av +def launch_offline(): + + app_off = QtWidgets.QApplication([]) + mainapp_off = MainWindow(offline=True) + mainapp_off.show() + app_off.exec_() + + if __name__ == '__main__': import argparse diff --git a/setup.py b/setup.py index 69eb959..f1ee83e 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ entry_points={ 'console_scripts': [ 'atlas=atlasview.atlasview:main', - 'align=atlaselectrophysiology.ephys_atlas_gui:__main__', + 'ephys-align=atlaselectrophysiology.ephys_atlas_gui:launch_offline', ] }, )