sortingview 0.12.0__tar.gz → 0.13.1__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.
- {sortingview-0.12.0/sortingview.egg-info → sortingview-0.13.1}/PKG-INFO +9 -1
- {sortingview-0.12.0 → sortingview-0.13.1}/setup.cfg +1 -1
- {sortingview-0.12.0 → sortingview-0.13.1}/setup.py +1 -1
- sortingview-0.13.1/sortingview/sortingview_view_url.py +4 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/version.py +1 -1
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/View.py +8 -8
- {sortingview-0.12.0 → sortingview-0.13.1/sortingview.egg-info}/PKG-INFO +9 -1
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview.egg-info/SOURCES.txt +0 -22
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview.egg-info/requires.txt +1 -1
- sortingview-0.12.0/examples/example_autocorrelograms.py +0 -33
- sortingview-0.12.0/examples/example_average_waveforms.py +0 -76
- sortingview-0.12.0/examples/example_box_layout.py +0 -70
- sortingview-0.12.0/examples/example_confusion_matrix.py +0 -96
- sortingview-0.12.0/examples/example_cross_correlograms.py +0 -36
- sortingview-0.12.0/examples/example_image.py +0 -19
- sortingview-0.12.0/examples/example_markdown.py +0 -41
- sortingview-0.12.0/examples/example_mountain_layout.py +0 -54
- sortingview-0.12.0/examples/example_position_plot.py +0 -29
- sortingview-0.12.0/examples/example_raster_plot.py +0 -34
- sortingview-0.12.0/examples/example_sorting_curation.py +0 -33
- sortingview-0.12.0/examples/example_spike_amplitudes.py +0 -47
- sortingview-0.12.0/examples/example_spike_locations.py +0 -77
- sortingview-0.12.0/examples/example_splitter_layout.py +0 -64
- sortingview-0.12.0/examples/example_tab_layout.py +0 -44
- sortingview-0.12.0/examples/example_tiled_image.py +0 -70
- sortingview-0.12.0/examples/example_timeseries_graph.py +0 -49
- sortingview-0.12.0/examples/example_track_position_animation.py +0 -76
- sortingview-0.12.0/examples/example_unit_locations.py +0 -53
- sortingview-0.12.0/examples/example_unit_metrics_graph.py +0 -44
- sortingview-0.12.0/examples/example_unit_similarity_matrix.py +0 -35
- sortingview-0.12.0/examples/example_units_table.py +0 -49
- sortingview-0.12.0/sortingview/sortingview_view_url.py +0 -4
- {sortingview-0.12.0 → sortingview-0.13.1}/LICENSE +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/README.md +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/Figure.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/MultiTimeseries.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/SpikeSortingView.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/__init__.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_autocorrelograms_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_average_waveforms_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_autocorrelograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_average_waveforms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_electrode_geometry.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_live_cross_correlograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_mountain_layout.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_raster_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_spike_amplitudes.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_summary.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_create_units_table.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_cross_correlograms_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_electrode_geometry_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_raster_plot_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_sorting_summary_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_spike_amplitudes_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/_units_table_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_console_view.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_epochs.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_position_pdf_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_position_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_raw_traces_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/create_spike_raster_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/helpers/__init__.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/helpers/compute_correlogram_data.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/SpikeSortingView/prepare_spikesortingview_data.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/__init__.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/Autocorrelograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/AverageWaveforms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/Box.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/ConfusionMatrix.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/CrossCorrelograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/ElectrodeGeometry.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/EphysTraces.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/Image.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/LayoutItem.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/Markdown.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/MountainLayout.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/PositionPlot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/RasterPlot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SortingCuration.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SortingCuration2.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SortingSelection.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SortingSummary.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SpikeAmplitudes.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/SpikeLocations.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/Splitter.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/TabLayout.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/TiledImage.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/TimeseriesGraph.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/UnitImages.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/UnitLocations.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/UnitMetricsGraph.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/UnitSimilarityMatrix.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/UnitsTable.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/__init__.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/franklab/DecodedLinearPositionV1.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/franklab/TrackPositionAnimationV1.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview/views/franklab/__init__.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview.egg-info/dependency_links.txt +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/sortingview.egg-info/top_level.txt +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_autocorrelograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_average_waveforms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_confusion_matrix.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_cross_correlograms.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_large_timeseries_graph.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_layout.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_markdown.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_position_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_raster_plot.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_sorting_curation_2.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_sorting_selection.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_spike_amplitudes.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_spike_locations.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_tab_layout.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_tiled_image.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_track_position_animation.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_unit_locations.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_unit_metrics_graph.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_unit_similarity_matrix.py +0 -0
- {sortingview-0.12.0 → sortingview-0.13.1}/tests/test_units_table.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sortingview
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Web app for viewing results of ephys spike sorting
|
|
5
5
|
Home-page: https://github.com/magland/sortingview
|
|
6
6
|
Author: Jeremy Magland and Jeff Soules
|
|
@@ -10,3 +10,11 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Requires-Dist: spikeinterface>=0.97.0
|
|
14
|
+
Requires-Dist: kachery-cloud>=0.4.0
|
|
15
|
+
Requires-Dist: figurl>=0.2.22
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: click
|
|
18
|
+
Requires-Dist: pynwb
|
|
19
|
+
Requires-Dist: pyyaml
|
|
20
|
+
Requires-Dist: h5py
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# This file was automatically generated by jinjaroot. Do not edit directly.
|
|
2
|
-
__version__ = '0.
|
|
2
|
+
__version__ = '0.13.1'
|
|
@@ -66,7 +66,7 @@ class View:
|
|
|
66
66
|
ret.append(v)
|
|
67
67
|
return ret
|
|
68
68
|
|
|
69
|
-
def url_dict(self, *, label: str, state: Union[dict, None] = None):
|
|
69
|
+
def url_dict(self, *, label: str, state: Union[dict, None] = None, allow_float64: bool=False):
|
|
70
70
|
from .Box import Box
|
|
71
71
|
from .LayoutItem import LayoutItem
|
|
72
72
|
|
|
@@ -78,10 +78,10 @@ class View:
|
|
|
78
78
|
data = {
|
|
79
79
|
"type": "MainLayout",
|
|
80
80
|
"layout": self.to_dict(),
|
|
81
|
-
"views": [{"type": view.type, "viewId": view.id, "dataUri": _upload_data_and_return_uri(view.to_dict())} for view in all_views if not view.is_layout],
|
|
81
|
+
"views": [{"type": view.type, "viewId": view.id, "dataUri": _upload_data_and_return_uri(view.to_dict(), allow_float64=allow_float64)} for view in all_views if not view.is_layout],
|
|
82
82
|
}
|
|
83
83
|
view_url = sortingview_view_url
|
|
84
|
-
F = fig.Figure(view_url=view_url, data=data)
|
|
84
|
+
F = fig.Figure(view_url=view_url, data=data, allow_float64=allow_float64)
|
|
85
85
|
# if time_range is not None:
|
|
86
86
|
# if state is None:
|
|
87
87
|
# state = {}
|
|
@@ -91,10 +91,10 @@ class View:
|
|
|
91
91
|
# Need to wrap it in a layout
|
|
92
92
|
V = Box(direction="horizontal", items=[LayoutItem(self)])
|
|
93
93
|
assert V.is_layout # avoid infinite recursion
|
|
94
|
-
return V.url_dict(label=label, state=state)
|
|
94
|
+
return V.url_dict(label=label, state=state, allow_float64=allow_float64)
|
|
95
95
|
|
|
96
|
-
def url(self, *, label: str, state: Union[dict, None] = None):
|
|
97
|
-
return fig.url_from_url_dict(self.url_dict(label=label, state=state))
|
|
96
|
+
def url(self, *, label: str, state: Union[dict, None] = None, allow_float64: bool=False):
|
|
97
|
+
return fig.url_from_url_dict(self.url_dict(label=label, state=state, allow_float64=allow_float64))
|
|
98
98
|
|
|
99
99
|
def jupyter(self, *, height: Union[int, None] = None):
|
|
100
100
|
raise Exception("Jupyter mode no longer supported")
|
|
@@ -145,8 +145,8 @@ class View:
|
|
|
145
145
|
self._sorting_curation = message.get("sortingCuration", {})
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
def _upload_data_and_return_uri(data, *, local: bool = False):
|
|
149
|
-
return kcl.store_json(fig.serialize_data(data), local=local)
|
|
148
|
+
def _upload_data_and_return_uri(data, *, local: bool = False, allow_float64: bool=False):
|
|
149
|
+
return kcl.store_json(fig.serialize_data(data, allow_float64=allow_float64), local=local)
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
def _random_id():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sortingview
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.1
|
|
4
4
|
Summary: Web app for viewing results of ephys spike sorting
|
|
5
5
|
Home-page: https://github.com/magland/sortingview
|
|
6
6
|
Author: Jeremy Magland and Jeff Soules
|
|
@@ -10,3 +10,11 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
License-File: LICENSE
|
|
13
|
+
Requires-Dist: spikeinterface>=0.97.0
|
|
14
|
+
Requires-Dist: kachery-cloud>=0.4.0
|
|
15
|
+
Requires-Dist: figurl>=0.2.22
|
|
16
|
+
Requires-Dist: matplotlib
|
|
17
|
+
Requires-Dist: click
|
|
18
|
+
Requires-Dist: pynwb
|
|
19
|
+
Requires-Dist: pyyaml
|
|
20
|
+
Requires-Dist: h5py
|
|
@@ -2,28 +2,6 @@ LICENSE
|
|
|
2
2
|
README.md
|
|
3
3
|
setup.cfg
|
|
4
4
|
setup.py
|
|
5
|
-
examples/example_autocorrelograms.py
|
|
6
|
-
examples/example_average_waveforms.py
|
|
7
|
-
examples/example_box_layout.py
|
|
8
|
-
examples/example_confusion_matrix.py
|
|
9
|
-
examples/example_cross_correlograms.py
|
|
10
|
-
examples/example_image.py
|
|
11
|
-
examples/example_markdown.py
|
|
12
|
-
examples/example_mountain_layout.py
|
|
13
|
-
examples/example_position_plot.py
|
|
14
|
-
examples/example_raster_plot.py
|
|
15
|
-
examples/example_sorting_curation.py
|
|
16
|
-
examples/example_spike_amplitudes.py
|
|
17
|
-
examples/example_spike_locations.py
|
|
18
|
-
examples/example_splitter_layout.py
|
|
19
|
-
examples/example_tab_layout.py
|
|
20
|
-
examples/example_tiled_image.py
|
|
21
|
-
examples/example_timeseries_graph.py
|
|
22
|
-
examples/example_track_position_animation.py
|
|
23
|
-
examples/example_unit_locations.py
|
|
24
|
-
examples/example_unit_metrics_graph.py
|
|
25
|
-
examples/example_unit_similarity_matrix.py
|
|
26
|
-
examples/example_units_table.py
|
|
27
5
|
sortingview/__init__.py
|
|
28
6
|
sortingview/sortingview_view_url.py
|
|
29
7
|
sortingview/version.py
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://5cb75552ad2f7316bf1a06af8cd6564c0fd9d497&label=Autocorrelograms%20example
|
|
3
|
-
|
|
4
|
-
from typing import List
|
|
5
|
-
import sortingview.views as vv
|
|
6
|
-
import spikeinterface as si
|
|
7
|
-
import spikeinterface.extractors as se
|
|
8
|
-
import kachery_cloud as kcl
|
|
9
|
-
from helpers.compute_correlogram_data import compute_correlogram_data
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def main():
|
|
13
|
-
kcl.use_sandbox()
|
|
14
|
-
_, sorting = se.toy_example(num_units=12, duration=300, seed=0, num_segments=1)
|
|
15
|
-
|
|
16
|
-
view = example_autocorrelograms(sorting=sorting)
|
|
17
|
-
url = view.url(label="Autocorrelograms example")
|
|
18
|
-
print(url)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def example_autocorrelograms(*, sorting: si.BaseSorting, height=400):
|
|
22
|
-
autocorrelogram_items: List[vv.AutocorrelogramItem] = []
|
|
23
|
-
for unit_id in sorting.get_unit_ids():
|
|
24
|
-
a = compute_correlogram_data(sorting=sorting, unit_id1=unit_id, unit_id2=None, window_size_msec=50, bin_size_msec=1)
|
|
25
|
-
bin_edges_sec = a["bin_edges_sec"]
|
|
26
|
-
bin_counts = a["bin_counts"]
|
|
27
|
-
autocorrelogram_items.append(vv.AutocorrelogramItem(unit_id=unit_id, bin_edges_sec=bin_edges_sec, bin_counts=bin_counts))
|
|
28
|
-
view = vv.Autocorrelograms(autocorrelograms=autocorrelogram_items, height=height)
|
|
29
|
-
return view
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if __name__ == "__main__":
|
|
33
|
-
main()
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# 11/8/23
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-11dev&d=sha1://675d1a91d833f4ba26019be5c48aa91f1f35c903&label=Average%20waveforms%20example
|
|
3
|
-
|
|
4
|
-
# 8/31/22
|
|
5
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://ad6178659260bf36733a8038acbc82d2020fa4ae&label=Average%20waveforms%20example
|
|
6
|
-
|
|
7
|
-
from typing import List, Tuple
|
|
8
|
-
import numpy as np
|
|
9
|
-
import sortingview.views as vv
|
|
10
|
-
import spikeinterface as si
|
|
11
|
-
import spikeinterface.extractors as se
|
|
12
|
-
import kachery_cloud as kcl
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def main():
|
|
16
|
-
kcl.use_sandbox()
|
|
17
|
-
recording, sorting = se.toy_example(num_units=12, duration=300, seed=0, num_segments=1, average_peak_amplitude=-20)
|
|
18
|
-
assert isinstance(recording, si.BaseRecording)
|
|
19
|
-
|
|
20
|
-
view = example_average_waveforms(recording=recording, sorting=sorting)
|
|
21
|
-
|
|
22
|
-
url = view.url(label="Average waveforms example")
|
|
23
|
-
print(url)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def example_average_waveforms(*, recording: si.BaseRecording, sorting: si.BaseSorting, height=500):
|
|
27
|
-
# noise_level = estimate_noise_level(recording)
|
|
28
|
-
average_waveform_items: List[vv.AverageWaveformItem] = []
|
|
29
|
-
for unit_id in sorting.get_unit_ids():
|
|
30
|
-
a = compute_average_waveform(recording=recording, sorting=sorting, unit_id=unit_id)
|
|
31
|
-
channel_ids = a["channel_ids"]
|
|
32
|
-
waveform = a["waveform"]
|
|
33
|
-
average_waveform_items.append(
|
|
34
|
-
vv.AverageWaveformItem(
|
|
35
|
-
unit_id=unit_id,
|
|
36
|
-
waveform=waveform,
|
|
37
|
-
channel_ids=channel_ids,
|
|
38
|
-
# waveform_std_dev=a['waveform_std_dev'],
|
|
39
|
-
waveform_percentiles=a["waveform_percentiles"],
|
|
40
|
-
)
|
|
41
|
-
)
|
|
42
|
-
channel_locations = {}
|
|
43
|
-
for ii, channel_id in enumerate(recording.channel_ids):
|
|
44
|
-
channel_locations[str(channel_id)] = recording.get_channel_locations()[ii, :].astype(np.float32)
|
|
45
|
-
view = vv.AverageWaveforms(average_waveforms=average_waveform_items, channel_locations=channel_locations, show_reference_probe=True, height=height)
|
|
46
|
-
return view
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def extract_snippets(*, traces: np.ndarray, times: np.ndarray, snippet_len: Tuple[int, int]):
|
|
50
|
-
N = traces.shape[0]
|
|
51
|
-
M = traces.shape[1]
|
|
52
|
-
T = snippet_len[0] + snippet_len[1]
|
|
53
|
-
ret = np.zeros((len(times), T, M), dtype=traces.dtype)
|
|
54
|
-
if len(times) == 0:
|
|
55
|
-
return ret
|
|
56
|
-
for t in range(T):
|
|
57
|
-
times2 = times + t - snippet_len[0]
|
|
58
|
-
valid = np.where((0 <= times2) & (times2 < N))
|
|
59
|
-
if len(valid) > 0:
|
|
60
|
-
ret[valid, t, :] = traces[times2[valid], :]
|
|
61
|
-
return ret
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def compute_average_waveform(*, recording: si.BaseRecording, sorting: si.BaseSorting, unit_id: int):
|
|
65
|
-
traces = recording.get_traces(segment_index=0)
|
|
66
|
-
times = sorting.get_unit_spike_train(segment_index=0, unit_id=unit_id)
|
|
67
|
-
snippets = extract_snippets(traces=traces, times=times, snippet_len=(20, 20))
|
|
68
|
-
waveform = np.mean(snippets, axis=0).T.astype(np.float32)
|
|
69
|
-
stdev = np.std(snippets, axis=0).T.astype(np.float32)
|
|
70
|
-
waveform_percentiles = np.percentile(snippets, [5, 25, 75, 95], axis=0) # type: ignore
|
|
71
|
-
waveform_percentiles = [waveform_percentiles[i].T.astype(np.float32) for i in range(4)]
|
|
72
|
-
return {"channel_ids": recording.get_channel_ids().astype(np.int32), "waveform": waveform, "waveform_std_dev": stdev, "waveform_percentiles": waveform_percentiles}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if __name__ == "__main__":
|
|
76
|
-
main()
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# 3/8/23
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://2e01e18ff73f7510f4b294e917a1ee1efee80acf&label=Box%20layout%20example
|
|
3
|
-
|
|
4
|
-
import sortingview.views as vv
|
|
5
|
-
import spikeinterface.extractors as se
|
|
6
|
-
import kachery_cloud as kcl
|
|
7
|
-
import spikeinterface as si
|
|
8
|
-
from example_autocorrelograms import example_autocorrelograms
|
|
9
|
-
from example_cross_correlograms import example_cross_correlograms
|
|
10
|
-
from example_raster_plot import example_raster_plot
|
|
11
|
-
from example_average_waveforms import example_average_waveforms
|
|
12
|
-
from example_units_table import example_units_table
|
|
13
|
-
from example_unit_similarity_matrix import example_unit_unit_similarity_matrix
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def main():
|
|
17
|
-
kcl.use_sandbox()
|
|
18
|
-
R, S = se.toy_example(num_units=12, duration=300, seed=1, num_segments=1)
|
|
19
|
-
assert isinstance(R, si.BaseRecording)
|
|
20
|
-
|
|
21
|
-
view = example_box_layout(recording=R, sorting=S)
|
|
22
|
-
|
|
23
|
-
url = view.url(label="Box layout example")
|
|
24
|
-
print(url)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def example_box_layout(recording: si.BaseRecording, sorting: si.BaseSorting, height=800):
|
|
28
|
-
R = recording
|
|
29
|
-
S = sorting
|
|
30
|
-
v_units_table = example_units_table(recording=R, sorting=S)
|
|
31
|
-
v_raster_plot = example_raster_plot(recording=R, sorting=S)
|
|
32
|
-
v_autocorrelograms = example_autocorrelograms(sorting=S)
|
|
33
|
-
v_average_waveforms = example_average_waveforms(recording=R, sorting=S)
|
|
34
|
-
v_cross_correlograms = example_cross_correlograms(sorting=S, hide_unit_selector=True)
|
|
35
|
-
v_unit_similarity_matrix = example_unit_unit_similarity_matrix(recording=R, sorting=S)
|
|
36
|
-
|
|
37
|
-
view = vv.Box(
|
|
38
|
-
height=height,
|
|
39
|
-
direction="vertical",
|
|
40
|
-
show_titles=True,
|
|
41
|
-
items=[
|
|
42
|
-
vv.LayoutItem(
|
|
43
|
-
vv.Box(
|
|
44
|
-
direction="horizontal",
|
|
45
|
-
show_titles=True,
|
|
46
|
-
items=[
|
|
47
|
-
vv.LayoutItem(v_units_table, stretch=1, title="Units"),
|
|
48
|
-
vv.LayoutItem(v_raster_plot, stretch=2, title="Raster"),
|
|
49
|
-
vv.LayoutItem(v_unit_similarity_matrix, min_size=100, max_size=200, title="Similarity"),
|
|
50
|
-
],
|
|
51
|
-
),
|
|
52
|
-
title="top",
|
|
53
|
-
collapsible=True,
|
|
54
|
-
),
|
|
55
|
-
vv.LayoutItem(
|
|
56
|
-
vv.Box(
|
|
57
|
-
direction="horizontal",
|
|
58
|
-
items=[vv.LayoutItem(v_autocorrelograms, min_size=300, max_size=350), vv.LayoutItem(v_average_waveforms), vv.LayoutItem(v_cross_correlograms)],
|
|
59
|
-
),
|
|
60
|
-
title="bottom",
|
|
61
|
-
collapsible=True,
|
|
62
|
-
),
|
|
63
|
-
],
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
return view
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if __name__ == "__main__":
|
|
70
|
-
main()
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://70a5430935ca06ee23246a37c247cc759d449bde&label=test_confusion_matrix
|
|
3
|
-
|
|
4
|
-
from typing import List
|
|
5
|
-
import spikeinterface as si
|
|
6
|
-
import spikeinterface.sorters as ss
|
|
7
|
-
import spikeinterface.comparison as sc
|
|
8
|
-
import spikeinterface.extractors as se
|
|
9
|
-
import kachery_cloud as kcl
|
|
10
|
-
import sortingview.views as vv
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def main():
|
|
14
|
-
kcl.use_sandbox()
|
|
15
|
-
recording, _ = se.toy_example(num_units=12, num_channels=4, duration=200, seed=0, num_segments=1)
|
|
16
|
-
with kcl.TemporaryDirectory() as tmpdir:
|
|
17
|
-
sorter_params1 = {
|
|
18
|
-
"detect_sign": -1,
|
|
19
|
-
"adjacency_radius": -1,
|
|
20
|
-
"freq_min": 300,
|
|
21
|
-
"freq_max": 6000,
|
|
22
|
-
"filter": True,
|
|
23
|
-
"whiten": True,
|
|
24
|
-
"num_workers": 4,
|
|
25
|
-
"clip_size": 50,
|
|
26
|
-
"detect_threshold": 3,
|
|
27
|
-
"detect_interval": 10,
|
|
28
|
-
}
|
|
29
|
-
sorter_params2 = {**sorter_params1}
|
|
30
|
-
sorter_params2["whiten"] = False
|
|
31
|
-
R: si.BaseRecording = recording.save_to_folder(folder=tmpdir + "/recording")
|
|
32
|
-
sortings = [
|
|
33
|
-
ss.run_mountainsort4(
|
|
34
|
-
recording=R,
|
|
35
|
-
output_folder=f"{tmpdir}/output{i + 1}",
|
|
36
|
-
remove_existing_folder=False,
|
|
37
|
-
delete_output_folder=False,
|
|
38
|
-
verbose=True,
|
|
39
|
-
raise_error=True,
|
|
40
|
-
docker_image=False,
|
|
41
|
-
singularity_image=False,
|
|
42
|
-
with_output=True,
|
|
43
|
-
**sorter_params,
|
|
44
|
-
)
|
|
45
|
-
for i, sorter_params in enumerate([sorter_params1, sorter_params2])
|
|
46
|
-
]
|
|
47
|
-
sorting1: si.BaseSorting = sortings[0] # type: ignore
|
|
48
|
-
sorting2: si.BaseSorting = sortings[1] # type: ignore
|
|
49
|
-
view = example_confusion_matrix(sorting1=sorting1, sorting2=sorting2)
|
|
50
|
-
|
|
51
|
-
view_units_table = _create_units_table(sorting1=sorting1, sorting2=sorting2)
|
|
52
|
-
|
|
53
|
-
view_composite = vv.Box(direction="horizontal", items=[vv.LayoutItem(view_units_table, max_size=200), vv.LayoutItem(view)])
|
|
54
|
-
|
|
55
|
-
url = view_composite.url(label="Confusion matrix")
|
|
56
|
-
print(url)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def _create_units_table(*, sorting1: si.BaseSorting, sorting2: si.BaseSorting):
|
|
60
|
-
columns: List[vv.UnitsTableColumn] = []
|
|
61
|
-
rows: List[vv.UnitsTableRow] = []
|
|
62
|
-
for unit_id in sorting1.get_unit_ids():
|
|
63
|
-
rows.append(vv.UnitsTableRow(unit_id=f"A{unit_id}", values={}))
|
|
64
|
-
for unit_id in sorting2.get_unit_ids():
|
|
65
|
-
rows.append(vv.UnitsTableRow(unit_id=f"B{unit_id}", values={}))
|
|
66
|
-
return vv.UnitsTable(columns=columns, rows=rows)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def example_confusion_matrix(*, sorting1: si.BaseSorting, sorting2: si.BaseSorting, height=400):
|
|
70
|
-
SC: sc.SymmetricSortingComparison = sc.compare_two_sorters(sorting1=sorting1, sorting2=sorting2)
|
|
71
|
-
|
|
72
|
-
unit_event_counts: List[vv.UnitEventCount] = []
|
|
73
|
-
for unit_id in sorting1.unit_ids:
|
|
74
|
-
unit_event_counts.append(vv.UnitEventCount(unit_id=f"A{unit_id}", count=len(sorting1.get_unit_spike_train(unit_id))))
|
|
75
|
-
for unit_id in sorting2.unit_ids:
|
|
76
|
-
unit_event_counts.append(vv.UnitEventCount(unit_id=f"B{unit_id}", count=len(sorting2.get_unit_spike_train(unit_id))))
|
|
77
|
-
|
|
78
|
-
matching_unit_event_counts: List[vv.MatchingUnitEventCount] = []
|
|
79
|
-
for id1 in sorting1.unit_ids:
|
|
80
|
-
ids2 = SC.get_matching_unit_list1(id1)
|
|
81
|
-
for id2 in ids2:
|
|
82
|
-
count = SC.get_matching_event_count(id1, id2)
|
|
83
|
-
matching_unit_event_counts.append(vv.MatchingUnitEventCount(unit_id1=f"A{id1}", unit_id2=f"B{id2}", count=count))
|
|
84
|
-
|
|
85
|
-
view = vv.ConfusionMatrix(
|
|
86
|
-
sorting1_unit_ids=[f"A{id}" for id in sorting1.unit_ids],
|
|
87
|
-
sorting2_unit_ids=[f"B{id}" for id in sorting2.unit_ids],
|
|
88
|
-
unit_event_counts=unit_event_counts,
|
|
89
|
-
matching_unit_event_counts=matching_unit_event_counts,
|
|
90
|
-
height=height,
|
|
91
|
-
)
|
|
92
|
-
return view
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if __name__ == "__main__":
|
|
96
|
-
main()
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://a72e243cf44f94ecfd2fd9d828157e9ad05adce1&label=Cross%20correlograms%20example
|
|
3
|
-
|
|
4
|
-
from typing import List
|
|
5
|
-
import sortingview.views as vv
|
|
6
|
-
import spikeinterface as si
|
|
7
|
-
import spikeinterface.extractors as se
|
|
8
|
-
import kachery_cloud as kcl
|
|
9
|
-
from helpers.compute_correlogram_data import compute_correlogram_data
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def main():
|
|
13
|
-
kcl.use_sandbox()
|
|
14
|
-
_, sorting = se.toy_example(num_units=12, duration=300, seed=0, num_segments=1)
|
|
15
|
-
|
|
16
|
-
view = example_cross_correlograms(sorting=sorting)
|
|
17
|
-
url = view.url(label="Cross correlograms example")
|
|
18
|
-
print(url)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def example_cross_correlograms(*, sorting: si.BaseSorting, hide_unit_selector: bool = False, height=500):
|
|
22
|
-
cross_correlogram_items: List[vv.CrossCorrelogramItem] = []
|
|
23
|
-
for unit_id1 in sorting.get_unit_ids():
|
|
24
|
-
for unit_id2 in sorting.get_unit_ids():
|
|
25
|
-
if unit_id1 != unit_id2 + 1:
|
|
26
|
-
a = compute_correlogram_data(sorting=sorting, unit_id1=unit_id1, unit_id2=unit_id2, window_size_msec=50, bin_size_msec=1)
|
|
27
|
-
bin_edges_sec = a["bin_edges_sec"]
|
|
28
|
-
bin_counts = a["bin_counts"]
|
|
29
|
-
cross_correlogram_items.append(vv.CrossCorrelogramItem(unit_id1=unit_id1, unit_id2=unit_id2, bin_edges_sec=bin_edges_sec, bin_counts=bin_counts))
|
|
30
|
-
|
|
31
|
-
view = vv.CrossCorrelograms(cross_correlograms=cross_correlogram_items, hide_unit_selector=hide_unit_selector, height=height)
|
|
32
|
-
return view
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if __name__ == "__main__":
|
|
36
|
-
main()
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import sortingview.views as vv
|
|
2
|
-
import kachery_cloud as kcl
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def main():
|
|
6
|
-
kcl.use_sandbox()
|
|
7
|
-
view = example_image()
|
|
8
|
-
|
|
9
|
-
url = view.url(label="Image example")
|
|
10
|
-
print(url)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def example_image():
|
|
14
|
-
view = vv.Image(image_path="./figurl192.png")
|
|
15
|
-
return view
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if __name__ == "__main__":
|
|
19
|
-
main()
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://1c894158e5518d6ff05fa36373ba8a543f1ee28f&label=Markdown%20example
|
|
3
|
-
|
|
4
|
-
import sortingview.views as vv
|
|
5
|
-
import kachery_cloud as kcl
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main():
|
|
9
|
-
kcl.use_sandbox()
|
|
10
|
-
view = example_markdown()
|
|
11
|
-
|
|
12
|
-
url = view.url(label="Markdown example")
|
|
13
|
-
print(url)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def example_markdown(*, height: int = 500):
|
|
17
|
-
view = vv.Markdown(
|
|
18
|
-
"""
|
|
19
|
-
# Test markdown
|
|
20
|
-
|
|
21
|
-
Example markdown source
|
|
22
|
-
|
|
23
|
-
* list item 1
|
|
24
|
-
* list item 2
|
|
25
|
-
* list item 3
|
|
26
|
-
|
|
27
|
-
Code snippet:
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
import spikeinterface as si
|
|
31
|
-
|
|
32
|
-
print(si.__version__)
|
|
33
|
-
```
|
|
34
|
-
""",
|
|
35
|
-
height=height,
|
|
36
|
-
)
|
|
37
|
-
return view
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if __name__ == "__main__":
|
|
41
|
-
main()
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://428301bc920d206a927143a924165a0a91dc8a63&label=Mountain%20layout%20example
|
|
3
|
-
|
|
4
|
-
import sortingview.views as vv
|
|
5
|
-
import spikeinterface.extractors as se
|
|
6
|
-
import spikeinterface as si
|
|
7
|
-
import kachery_cloud as kcl
|
|
8
|
-
from example_autocorrelograms import example_autocorrelograms
|
|
9
|
-
from example_cross_correlograms import example_cross_correlograms
|
|
10
|
-
from example_raster_plot import example_raster_plot
|
|
11
|
-
from example_average_waveforms import example_average_waveforms
|
|
12
|
-
from example_units_table import example_units_table
|
|
13
|
-
from example_unit_similarity_matrix import example_unit_unit_similarity_matrix
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def main():
|
|
17
|
-
kcl.use_sandbox()
|
|
18
|
-
R, S = se.toy_example(num_units=12, duration=300, seed=0, num_segments=1)
|
|
19
|
-
assert isinstance(R, si.BaseRecording)
|
|
20
|
-
|
|
21
|
-
view = example_mountain_layout(recording=R, sorting=S)
|
|
22
|
-
|
|
23
|
-
url = view.url(label="Mountain layout example")
|
|
24
|
-
print(url)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def example_mountain_layout(recording: si.BaseRecording, sorting: si.BaseSorting, height=800):
|
|
28
|
-
R = recording
|
|
29
|
-
S = sorting
|
|
30
|
-
|
|
31
|
-
v_units_table = example_units_table(recording=R, sorting=S)
|
|
32
|
-
v_raster_plot = example_raster_plot(recording=R, sorting=S)
|
|
33
|
-
v_autocorrelograms = example_autocorrelograms(sorting=S)
|
|
34
|
-
v_average_waveforms = example_average_waveforms(recording=R, sorting=S)
|
|
35
|
-
v_cross_correlograms = example_cross_correlograms(sorting=S, hide_unit_selector=True)
|
|
36
|
-
v_unit_similarity_matrix = example_unit_unit_similarity_matrix(recording=R, sorting=S)
|
|
37
|
-
|
|
38
|
-
view = vv.MountainLayout(
|
|
39
|
-
height=height,
|
|
40
|
-
items=[
|
|
41
|
-
vv.MountainLayoutItem(label="Units", view=v_units_table),
|
|
42
|
-
vv.MountainLayoutItem(label="Raster plot", view=v_raster_plot),
|
|
43
|
-
vv.MountainLayoutItem(label="Autocorrelograms", view=v_autocorrelograms),
|
|
44
|
-
vv.MountainLayoutItem(label="Avg. waveforms", view=v_average_waveforms),
|
|
45
|
-
vv.MountainLayoutItem(label="Cross correlograms", view=v_cross_correlograms),
|
|
46
|
-
vv.MountainLayoutItem(label="Unit similarity matrix", view=v_unit_similarity_matrix, is_control=True, control_height=300),
|
|
47
|
-
],
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return view
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if __name__ == "__main__":
|
|
54
|
-
main()
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://056c59aae3f29f48426be38516a6e84496985edf&label=Position%20plot%20example
|
|
3
|
-
|
|
4
|
-
import numpy as np
|
|
5
|
-
import sortingview.views as vv
|
|
6
|
-
import kachery_cloud as kcl
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main():
|
|
10
|
-
kcl.use_sandbox()
|
|
11
|
-
view = example_position_plot()
|
|
12
|
-
|
|
13
|
-
url = view.url(label="Position plot example")
|
|
14
|
-
print(url)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def example_position_plot(*, height=600):
|
|
18
|
-
timestamps = np.arange(1000, 2000, dtype=np.float64)
|
|
19
|
-
n = len(timestamps)
|
|
20
|
-
positions = np.zeros((n, 2))
|
|
21
|
-
for i in range(n):
|
|
22
|
-
positions[i, 0] = i + 3
|
|
23
|
-
positions[i, 1] = timestamps[i] * np.cos(timestamps[i] * 2 * np.pi / 30)
|
|
24
|
-
view = vv.PositionPlot(timestamps=timestamps, positions=positions.astype(np.float32), dimension_labels=["x", "y"], height=height)
|
|
25
|
-
return view
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if __name__ == "__main__":
|
|
29
|
-
main()
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# 8/31/22
|
|
2
|
-
# https://figurl.org/f?v=gs://figurl/spikesortingview-8&d=sha1://f2d35eb108e7c1a5f6ae0ba196d61bb9b7a889df&label=Raster%20plot%20example
|
|
3
|
-
|
|
4
|
-
from typing import List
|
|
5
|
-
import numpy as np
|
|
6
|
-
import sortingview.views as vv
|
|
7
|
-
import spikeinterface as si
|
|
8
|
-
import spikeinterface.extractors as se
|
|
9
|
-
import kachery_cloud as kcl
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def main():
|
|
13
|
-
kcl.use_sandbox()
|
|
14
|
-
recording, sorting = se.toy_example(num_units=12, duration=300, seed=0, num_segments=1)
|
|
15
|
-
assert isinstance(recording, si.BaseRecording)
|
|
16
|
-
|
|
17
|
-
view = example_raster_plot(recording=recording, sorting=sorting)
|
|
18
|
-
|
|
19
|
-
url = view.url(label="Raster plot example")
|
|
20
|
-
print(url)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def example_raster_plot(*, recording: si.BaseRecording, sorting: si.BaseSorting, height=500):
|
|
24
|
-
plot_items: List[vv.RasterPlotItem] = []
|
|
25
|
-
for unit_id in sorting.get_unit_ids():
|
|
26
|
-
spike_times_sec = np.array(sorting.get_unit_spike_train(segment_index=0, unit_id=unit_id)) / sorting.get_sampling_frequency()
|
|
27
|
-
plot_items.append(vv.RasterPlotItem(unit_id=unit_id, spike_times_sec=spike_times_sec.astype(np.float32)))
|
|
28
|
-
|
|
29
|
-
view = vv.RasterPlot(start_time_sec=0, end_time_sec=recording.get_num_frames(segment_index=0) / recording.get_sampling_frequency(), plots=plot_items, height=height)
|
|
30
|
-
return view
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if __name__ == "__main__":
|
|
34
|
-
main()
|