viewephys 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {viewephys-1.2.0 → viewephys-1.3.0}/PKG-INFO +50 -2
  2. {viewephys-1.2.0 → viewephys-1.3.0}/README.md +45 -1
  3. {viewephys-1.2.0 → viewephys-1.3.0}/pyproject.toml +6 -1
  4. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/command_line.py +16 -3
  5. viewephys-1.3.0/src/viewephys/data_model.py +589 -0
  6. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/gui.py +343 -93
  7. viewephys-1.3.0/src/viewephys/nav_file.ui +373 -0
  8. viewephys-1.3.0/src/viewephys/tests/mock_data/meta_file.meta +58 -0
  9. viewephys-1.3.0/src/viewephys/tests/test_data_model.py +450 -0
  10. viewephys-1.3.0/src/viewephys/tests/test_spikeinterface.py +64 -0
  11. viewephys-1.3.0/src/viewephys/tests/test_viewer_gui.py +571 -0
  12. viewephys-1.3.0/src/viewephys/tests/test_viewer_helpers.py +58 -0
  13. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewer/gui.py +125 -25
  14. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewer/pgtools.py +2 -2
  15. viewephys-1.3.0/src/viewephys/viewer/view.py +250 -0
  16. viewephys-1.2.0/src/viewephys/nav_file.ui +0 -236
  17. viewephys-1.2.0/src/viewephys/tests/test_viewer_gui.py +0 -283
  18. viewephys-1.2.0/src/viewephys/tests/test_viewer_helpers.py +0 -23
  19. viewephys-1.2.0/src/viewephys/viewer/view.py +0 -208
  20. {viewephys-1.2.0 → viewephys-1.3.0}/LICENSE +0 -0
  21. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/__init__.py +0 -0
  22. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/raster.py +0 -0
  23. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/raster.ui +0 -0
  24. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/tests/__init__.py +0 -0
  25. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/tests/test_model.py +0 -0
  26. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/tests/test_pick.py +0 -0
  27. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/tests/test_viewer_model.py +0 -0
  28. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/tests/test_viewer_pgtools.py +0 -0
  29. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewephys.svg +0 -0
  30. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewer/__init__.py +0 -0
  31. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewer/qt.py +0 -0
  32. {viewephys-1.2.0 → viewephys-1.3.0}/src/viewephys/viewer/spectrogram.ui +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: viewephys
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Neuropixel raw data viewer
5
5
  Author: Olivier Winter
6
6
  License: MIT
@@ -18,6 +18,10 @@ Requires-Dist: pandas
18
18
  Requires-Dist: pyqtgraph>=0.13.1
19
19
  Requires-Dist: qtpy
20
20
  Requires-Dist: scipy
21
+ Requires-Dist: spikeinterface
22
+ Provides-Extra: lfpack
23
+ Requires-Dist: lfpack; extra == "lfpack"
24
+ Requires-Dist: iblatlas; extra == "lfpack"
21
25
  Provides-Extra: dev
22
26
  Requires-Dist: pytest; extra == "dev"
23
27
  Requires-Dist: pytest-qt; extra == "dev"
@@ -77,7 +81,7 @@ When the picking mode is enabled (menu pick)
77
81
 
78
82
  ## Examples
79
83
 
80
- ### Visualize raw binary file
84
+ ### Visualize raw binary file through the command line
81
85
  Activate your environment and type `viewephys`, you can then load a neuropixel binary file using the file menu.
82
86
 
83
87
  ![alt text](./docs/raw_bin_viewer_destripe.png "Ephys viewer ")
@@ -88,6 +92,11 @@ viewphys -f /path/to/raw.bin
88
92
  ```
89
93
 
90
94
  ### Load in a numpy array or slice
95
+
96
+ `viewephys` can be used through the Python console or iPython, allowing you to create
97
+ multiple instances of the viewer at once.
98
+
99
+
91
100
  ```python
92
101
  # if running ipython, you may have to use the `%gui qt` magic command
93
102
  import numpy as np
@@ -95,10 +104,49 @@ from viewephys.gui import viewephys
95
104
  nc, ns, fs = (384, 50000, 30000) # this mimics one second of neuropixel data
96
105
  data = np.random.randn(nc, ns) / 1e6 # volts by default
97
106
  ve = viewephys(data, fs=fs)
107
+
108
+ # We can open multiple windows at once, but they must have different titles
109
+ data2 = data * 50
110
+ ve2 = viewephys(data, fs=fs, title="plot 2")
111
+
98
112
  ```
99
113
  ![alt text](./docs/view_rand_array.png "Ephys viewer")
100
114
 
101
115
 
116
+ Note if you are running through a script, you need to instantiate
117
+ the Qt application yourself:
118
+
119
+ #### Opening a binary file through a script
120
+
121
+ ```python
122
+ from viewephys.gui import EphysBinViewer, create_app
123
+
124
+ app = create_app()
125
+
126
+ viewer = EphysBinViewer(r"C:\Users\Joe\Desktop\1119617_LSE1_shank12_g0_imec0\1119617_LSE1_shank12_g0_t0.imec0.ap.bin")
127
+
128
+ app.exec()
129
+ ```
130
+
131
+ #### Load in a numpy array or slice through a script
132
+
133
+ ```python
134
+
135
+ import numpy as np
136
+ from viewephys.gui import viewephys, create_app
137
+
138
+ app = create_app()
139
+
140
+ nc, ns, fs = (384, 50000, 30000) # this mimics one second of neuropixel data
141
+ data = np.random.randn(nc, ns) / 1e6 # volts by default
142
+
143
+ ve = viewephys(data, fs=fs)
144
+ ve2 = viewephys(data * 50, fs=fs, title="plot 2")
145
+
146
+ app.exec()
147
+
148
+ ```
149
+
102
150
  ## Contribution
103
151
  Fork and PR.
104
152
 
@@ -36,7 +36,7 @@ When the picking mode is enabled (menu pick)
36
36
 
37
37
  ## Examples
38
38
 
39
- ### Visualize raw binary file
39
+ ### Visualize raw binary file through the command line
40
40
  Activate your environment and type `viewephys`, you can then load a neuropixel binary file using the file menu.
41
41
 
42
42
  ![alt text](./docs/raw_bin_viewer_destripe.png "Ephys viewer ")
@@ -47,6 +47,11 @@ viewphys -f /path/to/raw.bin
47
47
  ```
48
48
 
49
49
  ### Load in a numpy array or slice
50
+
51
+ `viewephys` can be used through the Python console or iPython, allowing you to create
52
+ multiple instances of the viewer at once.
53
+
54
+
50
55
  ```python
51
56
  # if running ipython, you may have to use the `%gui qt` magic command
52
57
  import numpy as np
@@ -54,10 +59,49 @@ from viewephys.gui import viewephys
54
59
  nc, ns, fs = (384, 50000, 30000) # this mimics one second of neuropixel data
55
60
  data = np.random.randn(nc, ns) / 1e6 # volts by default
56
61
  ve = viewephys(data, fs=fs)
62
+
63
+ # We can open multiple windows at once, but they must have different titles
64
+ data2 = data * 50
65
+ ve2 = viewephys(data, fs=fs, title="plot 2")
66
+
57
67
  ```
58
68
  ![alt text](./docs/view_rand_array.png "Ephys viewer")
59
69
 
60
70
 
71
+ Note if you are running through a script, you need to instantiate
72
+ the Qt application yourself:
73
+
74
+ #### Opening a binary file through a script
75
+
76
+ ```python
77
+ from viewephys.gui import EphysBinViewer, create_app
78
+
79
+ app = create_app()
80
+
81
+ viewer = EphysBinViewer(r"C:\Users\Joe\Desktop\1119617_LSE1_shank12_g0_imec0\1119617_LSE1_shank12_g0_t0.imec0.ap.bin")
82
+
83
+ app.exec()
84
+ ```
85
+
86
+ #### Load in a numpy array or slice through a script
87
+
88
+ ```python
89
+
90
+ import numpy as np
91
+ from viewephys.gui import viewephys, create_app
92
+
93
+ app = create_app()
94
+
95
+ nc, ns, fs = (384, 50000, 30000) # this mimics one second of neuropixel data
96
+ data = np.random.randn(nc, ns) / 1e6 # volts by default
97
+
98
+ ve = viewephys(data, fs=fs)
99
+ ve2 = viewephys(data * 50, fs=fs, title="plot 2")
100
+
101
+ app.exec()
102
+
103
+ ```
104
+
61
105
  ## Contribution
62
106
  Fork and PR.
63
107
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "viewephys"
3
- version = "1.2.0"
3
+ version = "1.3.0"
4
4
  description = "Neuropixel raw data viewer"
5
5
  authors = [
6
6
  { name = "Olivier Winter" },
@@ -20,6 +20,7 @@ dependencies = [
20
20
  "pyqtgraph>=0.13.1",
21
21
  "qtpy",
22
22
  "scipy",
23
+ "spikeinterface",
23
24
  ]
24
25
 
25
26
  [project.readme]
@@ -30,6 +31,10 @@ content-type = "text/markdown"
30
31
  text = "MIT"
31
32
 
32
33
  [project.optional-dependencies]
34
+ lfpack = [
35
+ "lfpack",
36
+ "iblatlas",
37
+ ]
33
38
  dev = [
34
39
  "pytest",
35
40
  "pytest-qt",
@@ -24,16 +24,29 @@ def viewephys():
24
24
  "-f",
25
25
  "--file",
26
26
  default=None,
27
- help="path to the binary file to load",
27
+ help="path to the binary or lfpack .h5 file to load",
28
28
  required=False,
29
29
  )
30
+ parser.add_argument(
31
+ "--lfpack",
32
+ action="store_true",
33
+ help="open the lfpack HDF5 viewer (auto-selected for .h5/.hdf5 files)",
34
+ )
30
35
  args = parser.parse_args() # returns data from the options specified (echo)
31
36
  print(args.file)
32
- from viewephys.gui import EphysBinViewer
37
+ from pathlib import Path
38
+
39
+ from viewephys.gui import EphysBinViewer, LFPackBinViewer
33
40
  from viewephys.viewer.qt import create_app
34
41
 
35
42
  app = create_app()
36
- self = EphysBinViewer(args.file) # noqa
43
+ # lfpack HDF5 archives need the LFPack-aware viewer; binaries use the base one.
44
+ is_h5 = args.file is not None and Path(args.file).suffix.lower() in (
45
+ ".h5",
46
+ ".hdf5",
47
+ )
48
+ ViewerClass = LFPackBinViewer if (args.lfpack or is_h5) else EphysBinViewer
49
+ self = ViewerClass(args.file) # noqa
37
50
  sys.exit(app.exec())
38
51
 
39
52