sortingview 0.15.0__py3-none-any.whl

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 (119) hide show
  1. examples/example_autocorrelograms.py +33 -0
  2. examples/example_average_waveforms.py +82 -0
  3. examples/example_box_layout.py +70 -0
  4. examples/example_confusion_matrix.py +97 -0
  5. examples/example_cross_correlograms.py +36 -0
  6. examples/example_image.py +19 -0
  7. examples/example_markdown.py +41 -0
  8. examples/example_mountain_layout.py +54 -0
  9. examples/example_plotly.py +21 -0
  10. examples/example_position_plot.py +29 -0
  11. examples/example_raster_plot.py +34 -0
  12. examples/example_sorting_curation.py +33 -0
  13. examples/example_spike_amplitudes.py +47 -0
  14. examples/example_spike_locations.py +77 -0
  15. examples/example_splitter_layout.py +64 -0
  16. examples/example_tab_layout.py +44 -0
  17. examples/example_tiled_image.py +70 -0
  18. examples/example_timeseries_graph.py +49 -0
  19. examples/example_track_position_animation.py +76 -0
  20. examples/example_unit_locations.py +53 -0
  21. examples/example_unit_metrics_graph.py +44 -0
  22. examples/example_unit_similarity_matrix.py +35 -0
  23. examples/example_units_table.py +49 -0
  24. examples/helpers/compute_correlogram_data.py +66 -0
  25. examples/helpers/create_units_table.py +12 -0
  26. sortingview/SpikeSortingView/Figure.py +46 -0
  27. sortingview/SpikeSortingView/MultiTimeseries.py +29 -0
  28. sortingview/SpikeSortingView/SpikeSortingView.py +172 -0
  29. sortingview/SpikeSortingView/__init__.py +10 -0
  30. sortingview/SpikeSortingView/_autocorrelograms_view.py +22 -0
  31. sortingview/SpikeSortingView/_average_waveforms_view.py +32 -0
  32. sortingview/SpikeSortingView/_create_autocorrelograms.py +23 -0
  33. sortingview/SpikeSortingView/_create_average_waveforms.py +40 -0
  34. sortingview/SpikeSortingView/_create_electrode_geometry.py +19 -0
  35. sortingview/SpikeSortingView/_create_live_cross_correlograms.py +15 -0
  36. sortingview/SpikeSortingView/_create_mountain_layout.py +26 -0
  37. sortingview/SpikeSortingView/_create_raster_plot.py +32 -0
  38. sortingview/SpikeSortingView/_create_spike_amplitudes.py +35 -0
  39. sortingview/SpikeSortingView/_create_summary.py +34 -0
  40. sortingview/SpikeSortingView/_create_units_table.py +46 -0
  41. sortingview/SpikeSortingView/_cross_correlograms_view.py +24 -0
  42. sortingview/SpikeSortingView/_electrode_geometry_view.py +14 -0
  43. sortingview/SpikeSortingView/_raster_plot_view.py +31 -0
  44. sortingview/SpikeSortingView/_sorting_summary_view.py +32 -0
  45. sortingview/SpikeSortingView/_spike_amplitudes_view.py +31 -0
  46. sortingview/SpikeSortingView/_units_table_view.py +45 -0
  47. sortingview/SpikeSortingView/create_console_view.py +8 -0
  48. sortingview/SpikeSortingView/create_epochs.py +8 -0
  49. sortingview/SpikeSortingView/create_position_pdf_plot.py +54 -0
  50. sortingview/SpikeSortingView/create_position_plot.py +38 -0
  51. sortingview/SpikeSortingView/create_raw_traces_plot.py +8 -0
  52. sortingview/SpikeSortingView/create_spike_raster_plot.py +15 -0
  53. sortingview/SpikeSortingView/helpers/__init__.py +0 -0
  54. sortingview/SpikeSortingView/helpers/compute_correlogram_data.py +63 -0
  55. sortingview/SpikeSortingView/prepare_spikesortingview_data.py +258 -0
  56. sortingview/__init__.py +1 -0
  57. sortingview/figpack_backend.py +730 -0
  58. sortingview/sortingview_view_url.py +3 -0
  59. sortingview/version.py +2 -0
  60. sortingview/views/Autocorrelograms.py +34 -0
  61. sortingview/views/AverageWaveforms.py +77 -0
  62. sortingview/views/Box.py +32 -0
  63. sortingview/views/ConfusionMatrix.py +55 -0
  64. sortingview/views/CrossCorrelograms.py +36 -0
  65. sortingview/views/ElectrodeGeometry.py +19 -0
  66. sortingview/views/EphysTraces.py +23 -0
  67. sortingview/views/Image.py +39 -0
  68. sortingview/views/LayoutItem.py +39 -0
  69. sortingview/views/Markdown.py +19 -0
  70. sortingview/views/MountainLayout.py +37 -0
  71. sortingview/views/PlotlyFigure.py +20 -0
  72. sortingview/views/PositionPlot.py +58 -0
  73. sortingview/views/RasterPlot.py +36 -0
  74. sortingview/views/SortingCuration.py +18 -0
  75. sortingview/views/SortingCuration2.py +24 -0
  76. sortingview/views/SortingSelection.py +21 -0
  77. sortingview/views/SortingSummary.py +52 -0
  78. sortingview/views/SpikeAmplitudes.py +44 -0
  79. sortingview/views/SpikeLocations.py +59 -0
  80. sortingview/views/Splitter.py +26 -0
  81. sortingview/views/TabLayout.py +32 -0
  82. sortingview/views/TiledImage.py +116 -0
  83. sortingview/views/TimeseriesGraph.py +158 -0
  84. sortingview/views/UnitImages.py +41 -0
  85. sortingview/views/UnitLocations.py +36 -0
  86. sortingview/views/UnitMetricsGraph.py +47 -0
  87. sortingview/views/UnitSimilarityMatrix.py +34 -0
  88. sortingview/views/UnitsTable.py +51 -0
  89. sortingview/views/View.py +176 -0
  90. sortingview/views/__init__.py +31 -0
  91. sortingview/views/franklab/DecodedLinearPositionV1.py +43 -0
  92. sortingview/views/franklab/TrackPositionAnimationV1.py +187 -0
  93. sortingview/views/franklab/__init__.py +2 -0
  94. sortingview-0.15.0.dist-info/METADATA +25 -0
  95. sortingview-0.15.0.dist-info/RECORD +119 -0
  96. sortingview-0.15.0.dist-info/WHEEL +5 -0
  97. sortingview-0.15.0.dist-info/licenses/LICENSE +201 -0
  98. sortingview-0.15.0.dist-info/top_level.txt +3 -0
  99. tests/helpers/compute_correlogram_data.py +66 -0
  100. tests/test_autocorrelograms.py +32 -0
  101. tests/test_average_waveforms.py +71 -0
  102. tests/test_confusion_matrix.py +95 -0
  103. tests/test_cross_correlograms.py +35 -0
  104. tests/test_large_timeseries_graph.py +46 -0
  105. tests/test_layout.py +65 -0
  106. tests/test_markdown.py +38 -0
  107. tests/test_position_plot.py +27 -0
  108. tests/test_raster_plot.py +32 -0
  109. tests/test_sorting_curation_2.py +37 -0
  110. tests/test_sorting_selection.py +68 -0
  111. tests/test_spike_amplitudes.py +37 -0
  112. tests/test_spike_locations.py +74 -0
  113. tests/test_tab_layout.py +45 -0
  114. tests/test_tiled_image.py +68 -0
  115. tests/test_track_position_animation.py +73 -0
  116. tests/test_unit_locations.py +59 -0
  117. tests/test_unit_metrics_graph.py +41 -0
  118. tests/test_unit_similarity_matrix.py +33 -0
  119. tests/test_units_table.py +40 -0
@@ -0,0 +1,176 @@
1
+ from copy import deepcopy
2
+ from abc import abstractmethod
3
+ from typing import List, Union
4
+ import kachery as ka
5
+ import figurl as fig
6
+ import uuid
7
+ from ..sortingview_view_url import sortingview_view_url
8
+
9
+
10
+ class View:
11
+ """
12
+ Base class for all views
13
+ """
14
+
15
+ def __init__(self, view_type: str, *, is_layout: bool = False, height=500) -> None:
16
+ self.type = view_type
17
+ self.id = _random_id()
18
+ self.is_layout = is_layout
19
+ self._height = height
20
+ # self._jupyter_widget = None
21
+ self._selected_unit_ids = []
22
+ self._sorting_curation = {}
23
+
24
+ def set_id(self, id: str):
25
+ self.id = id
26
+
27
+ @abstractmethod
28
+ def to_dict(self) -> dict:
29
+ return {}
30
+
31
+ @abstractmethod
32
+ def child_views(self) -> List["View"]:
33
+ return []
34
+
35
+ @property
36
+ def selected_unit_ids(self):
37
+ return deepcopy(self._selected_unit_ids)
38
+
39
+ def set_selected_unit_ids(self, ids: List[Union[int, str]]):
40
+ raise Exception("Jupyter mode no longer supported")
41
+ # if self._jupyter_widget is None:
42
+ # raise Exception('No jupyter widget')
43
+ # self._jupyter_widget.send_message_to_frontend({
44
+ # 'type': 'setSelectedUnitIds',
45
+ # 'selectedUnitIds': ids
46
+ # })
47
+
48
+ @property
49
+ def sorting_curation(self):
50
+ return deepcopy(self._sorting_curation)
51
+
52
+ def set_sorting_curation(self, sorting_curation):
53
+ raise Exception("Jupyter mode no longer supported")
54
+ # if self._jupyter_widget is None:
55
+ # raise Exception('No jupyter widget')
56
+ # self._jupyter_widget.send_message_to_frontend({
57
+ # 'type': 'setSortingCuration',
58
+ # 'sortingCuration': sorting_curation
59
+ # })
60
+
61
+ def get_descendant_views_including_self(self):
62
+ ret: List[View] = [self]
63
+ for ch in self.child_views():
64
+ a = ch.get_descendant_views_including_self()
65
+ for v in a:
66
+ ret.append(v)
67
+ return ret
68
+
69
+ def url_dict(self, *, label: str, state: Union[dict, None] = None, allow_float64: bool = False):
70
+ from .Box import Box
71
+ from .LayoutItem import LayoutItem
72
+
73
+ if self.is_layout:
74
+ all_views = self.get_descendant_views_including_self()
75
+ # set the view IDs to make the figure deterministic
76
+ for i, vv in enumerate(all_views):
77
+ vv.set_id(f"{i}")
78
+ data = {
79
+ "type": "MainLayout",
80
+ "layout": self.to_dict(),
81
+ "views": [
82
+ {"type": view.type, "viewId": view.id, "dataUri": _upload_data_and_return_uri(view.to_dict(), allow_float64=allow_float64)}
83
+ for view in all_views
84
+ if not view.is_layout
85
+ ],
86
+ }
87
+ view_url = sortingview_view_url
88
+ F = fig.Figure(view_url=view_url, data=data, allow_float64=allow_float64)
89
+ # if time_range is not None:
90
+ # if state is None:
91
+ # state = {}
92
+ # state['timeRange'] = time_range
93
+ return F.url_dict(label=label, state=state)
94
+
95
+ # Need to wrap it in a layout
96
+ V = Box(direction="horizontal", items=[LayoutItem(self)])
97
+ assert V.is_layout # avoid infinite recursion
98
+ return V.url_dict(label=label, state=state, allow_float64=allow_float64)
99
+
100
+ def url(self, *, label: str, state: Union[dict, None] = None, allow_float64: bool = False):
101
+ from .. import figpack_backend
102
+
103
+ if figpack_backend.use_figpack():
104
+ # SORTINGVIEW_BACKEND=figpack: publish to figpack instead of figurl
105
+ figpack_url = figpack_backend.try_figpack_url(self, label=label, state=state)
106
+ if figpack_url is not None:
107
+ return figpack_url
108
+ return fig.url_from_url_dict(self.url_dict(label=label, state=state, allow_float64=allow_float64))
109
+
110
+ def jupyter(self, *, height: Union[int, None] = None):
111
+ raise Exception("Jupyter mode no longer supported")
112
+ # if height is None:
113
+ # height = self._height
114
+ # import figurl_jupyter as fj
115
+ # url = self.url(label='jupyter')
116
+ # a = _parse_figurl_url(url)
117
+ # view_uri = a['v']
118
+ # data_uri = a['d']
119
+ # views = self.get_descendant_views_including_self()
120
+ # return fj.FigurlFigure(view_uri=view_uri, data_uri=data_uri, height=height)
121
+
122
+ # Took me a while to figure out that
123
+ # this is the right way to do it in order
124
+ # to support both jupyter lab and notebook
125
+ # I figure it out by looking into the ipywidgets
126
+ # source code.
127
+ # def _repr_mimebundle_(self, **kwargs):
128
+ # ipywidget = self.jupyter(height=self._height)
129
+ # data = ipywidget._repr_mimebundle_(**kwargs)
130
+ # self._set_jupyter_widget(ipywidget)
131
+ # return data
132
+ # # This works in jupyter lab but not nb
133
+ # def _ipython_display_(self):
134
+ # from IPython.display import display
135
+ # ipywidget = self.jupyter(height=self._height)
136
+ # self._set_jupyter_widget(ipywidget)
137
+ # display(ipywidget)
138
+ # def run(self, *, label: str, port: int):
139
+ # if port == 0:
140
+ # # get an open port
141
+ # sock = socket.socket()
142
+ # sock.bind(("", 0))
143
+ # port = sock.getsockname()[1]
144
+ # sock.close()
145
+ # views = self.get_descendant_views_including_self()
146
+ # self.electron(label=label, listen_port=port)
147
+
148
+ # def _set_jupyter_widget(self, W):
149
+ # self._jupyter_widget = W
150
+ # W.on_message_from_frontend(lambda message: self._on_message(message))
151
+ def _on_message(self, message):
152
+ type0 = message.get("type", "")
153
+ if type0 == "setSelectedUnitIds":
154
+ self._selected_unit_ids = message.get("selectedUnitIds", [])
155
+ elif type0 == "setSortingCuration":
156
+ self._sorting_curation = message.get("sortingCuration", {})
157
+
158
+
159
+ def _upload_data_and_return_uri(data, *, local: bool = False, allow_float64: bool = False):
160
+ return ka.store_json(fig.serialize_data(data, allow_float64=allow_float64), local=local)
161
+
162
+
163
+ def _random_id():
164
+ return str(uuid.uuid4())[-12:]
165
+
166
+
167
+ def _parse_figurl_url(uri: str):
168
+ ind = uri.index("?")
169
+ q = uri[ind + 1 :]
170
+ a = q.split("&")
171
+ ret = {}
172
+ for b in a:
173
+ x = b.split("=")
174
+ if len(x) == 2:
175
+ ret[x[0]] = x[1]
176
+ return ret
@@ -0,0 +1,31 @@
1
+ from .Autocorrelograms import AutocorrelogramItem, Autocorrelograms
2
+ from .AverageWaveforms import AverageWaveformItem, AverageWaveforms
3
+ from .CrossCorrelograms import CrossCorrelogramItem, CrossCorrelograms
4
+ from .RasterPlot import RasterPlotItem, RasterPlot
5
+ from .UnitsTable import UnitsTableColumn, UnitsTableRow, UnitsTable
6
+ from .UnitSimilarityMatrix import UnitSimilarityScore, UnitSimilarityMatrix
7
+ from .Box import Box
8
+ from .LayoutItem import LayoutItem
9
+ from .Splitter import Splitter
10
+ from .View import View
11
+ from .MountainLayout import MountainLayout, MountainLayoutItem
12
+ from .SortingCuration import SortingCuration
13
+ from .SortingSummary import SortingSummary
14
+ from .ElectrodeGeometry import ElectrodeGeometry
15
+ from .SpikeAmplitudes import SpikeAmplitudes, SpikeAmplitudesItem
16
+ from .UnitLocations import UnitLocations, UnitLocationsItem
17
+ from .Markdown import Markdown
18
+ from .TabLayout import TabLayoutItem, TabLayout
19
+ from .UnitMetricsGraph import UnitMetricsGraphMetric, UnitMetricsGraphUnit, UnitMetricsGraph
20
+ from .TiledImage import TiledImage, TiledImageLayer
21
+ from .SortingCuration2 import SortingCuration2
22
+ from .SortingSelection import SortingSelection
23
+ from .SpikeLocations import SpikeLocations, SpikeLocationsItem
24
+ from .PositionPlot import PositionPlot
25
+ from .ConfusionMatrix import ConfusionMatrix, UnitEventCount, MatchingUnitEventCount
26
+ from .TimeseriesGraph import TimeseriesGraph, TGDataset, TGSeries
27
+ from .Image import Image
28
+ from .UnitImages import UnitImages, UnitImagesItem
29
+ from .PlotlyFigure import PlotlyFigure
30
+
31
+ from .EphysTraces import EphysTraces
@@ -0,0 +1,43 @@
1
+ from typing import List, Optional
2
+ import numpy as np
3
+ from ..View import View
4
+
5
+
6
+ class DecodedLinearPositionData(View):
7
+ def __init__(
8
+ self,
9
+ *,
10
+ values: np.ndarray,
11
+ positions: np.ndarray,
12
+ frame_bounds: np.ndarray,
13
+ positions_key: np.ndarray,
14
+ observed_positions: Optional[np.ndarray],
15
+ start_time_sec: Optional[float],
16
+ sampling_frequency: Optional[float],
17
+ **kwargs
18
+ ) -> None:
19
+ super().__init__("DecodedLinearPositionData", **kwargs)
20
+ self.values = values
21
+ self.positions = positions
22
+ self.frame_bounds = frame_bounds
23
+ self.positions_key = positions_key
24
+ self.observed_positions = observed_positions.astype("float32") if observed_positions is not None else None
25
+ self.start_time_sec = 0 if start_time_sec == None else start_time_sec
26
+ self.sampling_frequency = sampling_frequency
27
+
28
+ def to_dict(self) -> dict:
29
+ ret = {
30
+ "type": "DecodedLinearPositionData",
31
+ "values": self.values,
32
+ "positions": self.positions,
33
+ "frameBounds": self.frame_bounds,
34
+ "positionsKey": self.positions_key,
35
+ "startTimeSec": self.start_time_sec,
36
+ "samplingFrequencyHz": self.sampling_frequency,
37
+ }
38
+ if self.observed_positions is not None:
39
+ ret["observedPositions"] = self.observed_positions
40
+ return ret
41
+
42
+ def child_views(self) -> List[View]:
43
+ return []
@@ -0,0 +1,187 @@
1
+ from typing import List, Union
2
+ import numpy as np
3
+ from ..View import View
4
+
5
+
6
+ # /**
7
+ # * @member xmin The minimum x-coordinate of the used bin centers, native units.
8
+ # * @member binWidth Width of each bin, native units.
9
+ # * @member xcount Number of bins accross to achieve the full extent
10
+ # * @member ymin The minimum y-coordinate of the used bin centers, native units.
11
+ # * @member binHeight Height of each bin, native units.
12
+ # * @member ycount Number of bins down to achieve the full extent
13
+ # * @member uniqueLocations Optional, To save browser-side computation, a list of all unique values in the locations array
14
+ # * @member values Decoded scaled probability values 0-255 (corresponding to locations)
15
+ # * @member locations Linearized integer positions of the sparse data. p0 = x0 + xcount * y0 --> center: [xmin + x0 * binWidth, ymin + y0 * binHeight]
16
+ # * @member frameBounds: Array of entry counts, one for each time frame. Serves as an index for values/locations.
17
+ # * The observations corresponding to timestamps[t] are values[sum(frameBounds[:t]):sum(frameBounds[:t]) + frameBounds[t]]
18
+ # */
19
+ # export type DecodedPositionData = {
20
+ # type______: 'DecodedPositionData'
21
+ # xmin: number
22
+ # binWidth: number
23
+ # xcount: number
24
+ # ymin: number
25
+ # binHeight: number
26
+ # ycount: number
27
+ # uniqueLocations?: number[]
28
+ # values: number[]
29
+ # locations: number[]
30
+ # frameBounds: number[]
31
+ # }
32
+ class DecodedPositionData:
33
+ def __init__(
34
+ self,
35
+ *,
36
+ x_min: float,
37
+ bin_width: float,
38
+ x_count: int,
39
+ y_min: float,
40
+ bin_height: float,
41
+ y_count: int,
42
+ values: np.ndarray,
43
+ locations: np.ndarray,
44
+ frame_bounds: np.ndarray,
45
+ unique_locations: Union[None, np.ndarray] = None
46
+ ) -> None:
47
+ self.x_min = x_min
48
+ self.bin_width = bin_width
49
+ self.x_count = x_count
50
+ self.y_min = y_min
51
+ self.bin_height = bin_height
52
+ self.y_count = y_count
53
+ self.values = values
54
+ self.locations = locations
55
+ self.frame_bounds = frame_bounds
56
+ self.unique_locations = unique_locations
57
+
58
+ def to_dict(self) -> dict:
59
+ ret = {
60
+ "type": "DecodedPositionData",
61
+ "xmin": self.x_min,
62
+ "binWidth": self.bin_width,
63
+ "xcount": self.x_count,
64
+ "ymin": self.y_min,
65
+ "binHeight": self.bin_height,
66
+ "ycount": self.y_count,
67
+ "values": self.values,
68
+ "locations": self.locations,
69
+ "frameBounds": self.frame_bounds,
70
+ }
71
+ if self.unique_locations is not None:
72
+ ret["uniqueLocations"] = self.unique_locations
73
+ return ret
74
+
75
+
76
+ # /**
77
+ # * Data comprising a complete (non-streamed) track animation. The track itself is
78
+ # * represented as a set of rectangles (a sparse subset of the full grid), and there are separate lists of timestamps
79
+ # * and corresponding positions, as well as the track extrema and the
80
+ # * optional sampling rate (number of frames per second in the recording - controls the base replay rate).
81
+ # *
82
+ # * @member trackBinWidth The width of a single tile in the track, in native units. NOT
83
+ # * the width of the overall track.
84
+ # * @member trackBinHeight The height of a single tile in the track, in native units. NOT
85
+ # * the height of the overall track.
86
+ # * @member trackBinULCorners The upper-left corner of each tile in the constituent track,
87
+ # * represented as an array of x-coordinates and an array of y-coordinates (i.e. number[2][:]).
88
+ # * These are in the native units of the source data.
89
+ # * @member timestampStart If set, this is the offset of the timestamp array, with the timestamps
90
+ # * array representing elapsed time since the start of the recording. (This fixes resolution issues
91
+ # * related to representing timestamps as floats rather than doubles.)
92
+ # * @member timestamps Array of (float) timestamps which should align with the position list.
93
+ # * The animal should be observed at position (positions[0][t], positions[1][t]) at time
94
+ # * timestamps[t].
95
+ # * @member positions Animal position at the aligned timestamp from timestamps, in native units.
96
+ # * Represented as an array of x-coordinates and an array of y-coordinates.
97
+ # * @member xmin Lowest x-value to display, in native units.
98
+ # * @member xmax Highest x-value to display, in native units.
99
+ # * @member ymin Lowest y-value to display, in native units.
100
+ # * @member ymax Highest y-value to display, in native units.
101
+ # * @member headDirection Direction of the animal's head in the xy-plane, in radians.
102
+ # * @member decodedData The compressed sparse representation of decoded position data, as a DecodedPositionData object.
103
+ # * @member samplingFrequencyHz Optional (Default 60), Sampling frequency of the recording - should coincide with 1/Delta_t where Delta_t is the mode of the timestamp deltas
104
+ # */
105
+ # export type TrackAnimationStaticData = {
106
+ # type_______: 'TrackAnimation'
107
+ # trackBinWidth: number
108
+ # trackBinHeight: number
109
+ # trackBinULCorners: [number[], number[]]
110
+ # totalRecordingFrameLength: number
111
+ # timestampStart?: number
112
+ # timestamps: number[]
113
+ # positions: [number[], number[]]
114
+ # xmin: number
115
+ # xmax: number
116
+ # ymin: number
117
+ # ymax: number
118
+ # headDirection?: number[]
119
+ # decodedData?: DecodedPositionData
120
+ # samplingFrequencyHz?: number
121
+ # }
122
+ class TrackPositionAnimationV1(View):
123
+ """
124
+ Track position animation
125
+ """
126
+
127
+ def __init__(
128
+ self,
129
+ *,
130
+ track_bin_width: float,
131
+ track_bin_height: float,
132
+ track_bin_ul_corners: np.ndarray, # 2 x N
133
+ total_recording_frame_length: float,
134
+ timestamp_start: Union[float, None] = None,
135
+ timestamps: np.ndarray, # N
136
+ positions: np.ndarray, # 2 x N
137
+ x_min: float,
138
+ x_max: float,
139
+ y_min: float,
140
+ y_max: float,
141
+ head_direction: Union[None, np.ndarray] = None, # N
142
+ decoded_data: Union[None, DecodedPositionData] = None,
143
+ sampling_frequency_hz: Union[None, float] = None,
144
+ **kwargs
145
+ ) -> None:
146
+ super().__init__("TrackAnimation", **kwargs)
147
+ self.track_bin_width = track_bin_width
148
+ self.track_bin_height = track_bin_height
149
+ self.track_bin_ul_corners = track_bin_ul_corners
150
+ self.total_recording_frame_length = total_recording_frame_length
151
+ self.timestamp_start = timestamp_start
152
+ self.timestamps = timestamps
153
+ self.positions = positions
154
+ self.x_min = x_min
155
+ self.x_max = x_max
156
+ self.y_min = y_min
157
+ self.y_max = y_max
158
+ self.head_direction = head_direction
159
+ self.decoded_data = decoded_data
160
+ self.sampling_frequency_hz = sampling_frequency_hz
161
+
162
+ def to_dict(self) -> dict:
163
+ ret = {
164
+ "type": self.type,
165
+ "trackBinWidth": self.track_bin_width,
166
+ "trackBinHeight": self.track_bin_height,
167
+ "trackBinULCorners": self.track_bin_ul_corners,
168
+ "totalRecordingFrameLength": self.total_recording_frame_length,
169
+ "timestamps": self.timestamps,
170
+ "positions": self.positions,
171
+ "xmin": self.x_min,
172
+ "xmax": self.x_max,
173
+ "ymin": self.y_min,
174
+ "ymax": self.y_max,
175
+ }
176
+ if self.timestamp_start is not None:
177
+ ret["timestampStart"] = self.timestamp_start
178
+ if self.head_direction is not None:
179
+ ret["headDirection"] = self.head_direction
180
+ if self.decoded_data is not None:
181
+ ret["decodedData"] = self.decoded_data.to_dict()
182
+ if self.sampling_frequency_hz is not None:
183
+ ret["samplingFrequencyHz"] = self.sampling_frequency_hz
184
+ return ret
185
+
186
+ def child_views(self) -> List[View]:
187
+ return []
@@ -0,0 +1,2 @@
1
+ from .TrackPositionAnimationV1 import TrackPositionAnimationV1, DecodedPositionData
2
+ from .DecodedLinearPositionV1 import DecodedLinearPositionData
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: sortingview
3
+ Version: 0.15.0
4
+ Summary: Web app for viewing results of ephys spike sorting
5
+ Home-page: https://github.com/magland/sortingview
6
+ Author: Jeff Soules
7
+ Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
8
+ Project-URL: Homepage, https://github.com/magland/sortingview
9
+ Project-URL: Issues, https://github.com/magland/sortingview/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ License-File: LICENSE
14
+ Requires-Dist: spikeinterface>=0.97.0
15
+ Requires-Dist: kachery<3,>=2.0.2
16
+ Requires-Dist: figurl>=0.3.1
17
+ Requires-Dist: matplotlib
18
+ Requires-Dist: click
19
+ Requires-Dist: pynwb
20
+ Requires-Dist: pyyaml
21
+ Requires-Dist: h5py
22
+ Provides-Extra: figpack
23
+ Requires-Dist: figpack<0.5,>=0.4.6; extra == "figpack"
24
+ Requires-Dist: figpack_spike_sorting>=0.1.18; extra == "figpack"
25
+ Dynamic: license-file
@@ -0,0 +1,119 @@
1
+ examples/example_autocorrelograms.py,sha256=XHy1UtVXX2cyknDIZEQeYvOHE0N3pW5ZLh0npG0xqpE,1257
2
+ examples/example_average_waveforms.py,sha256=bBUwObyX-5KA04rMhDJ4IcmSPhQmj-T4qePDL0-Jicc,3624
3
+ examples/example_box_layout.py,sha256=F6fl5EzLdQIxSN_RxX-gk889egW3OYpP_EHGMuNnaYM,2589
4
+ examples/example_confusion_matrix.py,sha256=bgYA7_Z_F6l8gkb88rtwMRmkMor_1iNV2UouSp80t60,3891
5
+ examples/example_cross_correlograms.py,sha256=RDCH2NJyXXzTtIzEgDeiDv_zm16yRXsZHgmO4nG2LNc,1500
6
+ examples/example_image.py,sha256=zItinBFylpHuuyDba_naTf8t91EqYum-U85Es0_1PC4,301
7
+ examples/example_markdown.py,sha256=61ThMF6GO2GprhC1sw3pjIkAlHEmFj6-WhtyVY-cnVI,657
8
+ examples/example_mountain_layout.py,sha256=pFkgv3Km3sSDmn4SBdAH27BXACD3icUYGV0OOXZD3wU,2193
9
+ examples/example_plotly.py,sha256=hxH-kiU9d6yYq7WP-muFkT5RCz45rgrzu6gds3nRLVU,415
10
+ examples/example_position_plot.py,sha256=zVfJCHSPt2gpbd88wzxipbbOza3xwExeloAUGFG24D8,840
11
+ examples/example_raster_plot.py,sha256=clmQo2onbmxzVnduAL9O1CTAK8_TlMOc318FNhxf8x8,1279
12
+ examples/example_sorting_curation.py,sha256=YtH-slcg8JXxb4xwRVH1PPd0tnLwM-jP84KiYevR8E4,1021
13
+ examples/example_spike_amplitudes.py,sha256=vjc9TIlxnB_LKx4mvWMsZTDEt5-j5OUobgssXmsmUFY,1668
14
+ examples/example_spike_locations.py,sha256=0lhy5_ZwQbA85OCw_Pu1xRYnOLDiiF34YorHX1tu9Wk,2779
15
+ examples/example_splitter_layout.py,sha256=TKSdWd8slLIysFN09ATTvklWW1ojNZr1YhpFXDvQfqU,2458
16
+ examples/example_tab_layout.py,sha256=LQrwmt6jCvhdNdoIlTMRaeseJxI8TcLpxKmPk0YoDpc,1859
17
+ examples/example_tiled_image.py,sha256=JOueu5gsYbE5FOPR1wadvl533FqQ-y4C6WYldYcxQaA,2480
18
+ examples/example_timeseries_graph.py,sha256=W2gsk-hG8SAm0o9dnkrWSLDHrtfA2Ar4yw_tkmc2VTk,1506
19
+ examples/example_track_position_animation.py,sha256=UkYOmFKTGCTEWkUBw4xkJ8TdNS94G35Yq2w-xMho_fA,2471
20
+ examples/example_unit_locations.py,sha256=90NX5btdtCEVU3EpLJDQXAC8PMHOAq2A0Cv9DHWeub4,2059
21
+ examples/example_unit_metrics_graph.py,sha256=1jY2Va2N6m8P0EEH2Q4t44q_X7nEhZISQSJVL09EcU8,1758
22
+ examples/example_unit_similarity_matrix.py,sha256=xXsn4g5b9tAAjO7lxsPz9RsAQis2OimIkNpUDW4JFzg,1320
23
+ examples/example_units_table.py,sha256=HHzjdhkBCJZdW4ZwAnrr2-jrpDz7YxWJGFdmJOpu7AY,1958
24
+ examples/helpers/compute_correlogram_data.py,sha256=07tl1W5D2oaSVjmRHp03cLrU2Ij69DYtU9BHOzxuSbA,3546
25
+ examples/helpers/create_units_table.py,sha256=Z4O8N1oVJu1-cu2VdDemFpnzloNqIUj6-AY2dSIvgfA,414
26
+ sortingview/__init__.py,sha256=AhKSvRLP6ebhka2N98a_DZwxHjwwhJWOuN8cFSF2mL0,41
27
+ sortingview/figpack_backend.py,sha256=3b6HfSQ5pMM8iBV4eNsoQDiA0DrogAhH_S7S5iFr9ZI,29019
28
+ sortingview/sortingview_view_url.py,sha256=wJniPjI8lAttc3WEkXIUgi_UK5dMAV-43-ncDA1YClA,112
29
+ sortingview/version.py,sha256=yKMdfN7GcACimHfJO4mp8VdZZiEV18Pe2KqE9QKQMiw,99
30
+ sortingview/SpikeSortingView/Figure.py,sha256=5aqj3VBbxR5e9ngJn9CDUbY1XBJuOYkV_BaqU3DRmM0,1561
31
+ sortingview/SpikeSortingView/MultiTimeseries.py,sha256=7-HpwnV5hBq22z-OkQ8FtTkZa72U3Sfu-RiLbA3W90k,1001
32
+ sortingview/SpikeSortingView/SpikeSortingView.py,sha256=YNmZLvOhgwkatzlmicM0eeDLADHlKiBci7Mt4IQeu7Y,6716
33
+ sortingview/SpikeSortingView/__init__.py,sha256=zdNc7sMW20QgMu5wv_yjIK2rjvxvKzBk5yFS1omLMR0,588
34
+ sortingview/SpikeSortingView/_autocorrelograms_view.py,sha256=wQzeZfA74Jj3Ly-1n11qRIR3KlWdxzZBcEIRllNdB-4,926
35
+ sortingview/SpikeSortingView/_average_waveforms_view.py,sha256=owuh352Ijxv33CZP3BOUCOnUehTSdt_PQTdE2LbGQoM,1452
36
+ sortingview/SpikeSortingView/_create_autocorrelograms.py,sha256=8RQdTp9X2n_N1mKTCN-r6yFQNnnHsurOZitS7Qr4XHM,948
37
+ sortingview/SpikeSortingView/_create_average_waveforms.py,sha256=PJ2YTCYsWfMfdIScKV69tSNNM8YEqlO6RLbxdOyAff8,1647
38
+ sortingview/SpikeSortingView/_create_electrode_geometry.py,sha256=jiDroolYg5uZJWC_k6VK9Dfw8yfoTMDvsMJavb9IWdE,686
39
+ sortingview/SpikeSortingView/_create_live_cross_correlograms.py,sha256=cb2j6HydS9hj6pO_sdb7Lsg7a_jLSe3JrKpBi5dq3jg,506
40
+ sortingview/SpikeSortingView/_create_mountain_layout.py,sha256=Y1PWrsDX5KsVNC4fL513RS16mwhe8f4aQme6y1sPLjY,847
41
+ sortingview/SpikeSortingView/_create_raster_plot.py,sha256=xMvhH92m68VlwLf5mSpNnauE4N-nNFNobDX1tAhJvGk,1237
42
+ sortingview/SpikeSortingView/_create_spike_amplitudes.py,sha256=e0YAmDvZlkfhYfARtD9LL46L4QSqE4bEPEait7vtmOM,1505
43
+ sortingview/SpikeSortingView/_create_summary.py,sha256=SZzEiepprfGK3knCsqN3ET74xuazyTF8Yj_URcEYjCw,1088
44
+ sortingview/SpikeSortingView/_create_units_table.py,sha256=r6opfcShbEn8KvpCuFfnAUKTgVGtqkkfotvwIdtwb7c,2051
45
+ sortingview/SpikeSortingView/_cross_correlograms_view.py,sha256=EMJrojl3RVrZCGyssqGIju8QbRNn2R7tNAfwq2Au-qw,1288
46
+ sortingview/SpikeSortingView/_electrode_geometry_view.py,sha256=fBy-xBriFrS1hANWqZOxOaQJyExM0X_p-cWj3n6XBHU,469
47
+ sortingview/SpikeSortingView/_raster_plot_view.py,sha256=JPOQjKOLuZPgHPybOX3-E2EZRsEpCecuhM1MeG7hFMM,1222
48
+ sortingview/SpikeSortingView/_sorting_summary_view.py,sha256=etrindDYPQ7MK9ECy_uiD1tajXE-_N_2YNr2hC30BwY,1028
49
+ sortingview/SpikeSortingView/_spike_amplitudes_view.py,sha256=jcVt-Sl_Obm7Gfy_QrZ2QjwjZP38iwnDJFZJO8QOoQM,1481
50
+ sortingview/SpikeSortingView/_units_table_view.py,sha256=nuo4JnRf59ecbUCI0YdbzmyqCTLwFo2_r8gnCqMnDJ4,2046
51
+ sortingview/SpikeSortingView/create_console_view.py,sha256=wrqda1Ptr1p20RoSLkBBsqMk7dgI3iGlyWT1m3Lyvq0,235
52
+ sortingview/SpikeSortingView/create_epochs.py,sha256=TtIJeFf3ul5zmgXoXJ2cYH-L9svhQkufCleK88RXYcw,223
53
+ sortingview/SpikeSortingView/create_position_pdf_plot.py,sha256=eITMbwBXS0JHA2imxJI1Hi556CSwTgxFgAMEsglfi7M,1672
54
+ sortingview/SpikeSortingView/create_position_plot.py,sha256=lZuWWDgeh5u8qNN80uhxHrGh33kgvA3XP7sZXjZzzRk,1449
55
+ sortingview/SpikeSortingView/create_raw_traces_plot.py,sha256=JP3kYuSnEaoQH9PjpKUZnrxLG36crghfhgy1Yqocbuw,362
56
+ sortingview/SpikeSortingView/create_spike_raster_plot.py,sha256=R7uPZMU5Rzh_buLOuPCLZyx2BXnZAnczvwy8jFlw4BI,581
57
+ sortingview/SpikeSortingView/prepare_spikesortingview_data.py,sha256=kM2JjceL38GUgV4Tz84vE_ClycvOT0M00OZ8s-3HNjg,12562
58
+ sortingview/SpikeSortingView/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
+ sortingview/SpikeSortingView/helpers/compute_correlogram_data.py,sha256=Z90QLEcJWIQ9z_0vaMDEdQ_eIVMgHbEFWrI52YZJlTk,3311
60
+ sortingview/views/Autocorrelograms.py,sha256=qadQbQ9pPmHtK1OmASW7pYOgE54EHIBz6AX9sLvSPsI,1032
61
+ sortingview/views/AverageWaveforms.py,sha256=CnyrsjYnIFJYjXF76XYJc6O38ZpOBRFlvaLKLXi9ri0,3182
62
+ sortingview/views/Box.py,sha256=qDQKQL2b6s0ZHjIYWwNESU-mR_xlbPLcXZxgerDKo5A,1152
63
+ sortingview/views/ConfusionMatrix.py,sha256=hB5R8Q_PnWEzCXr3v4wIKjnkdwagodFHJS2YLNe776g,1718
64
+ sortingview/views/CrossCorrelograms.py,sha256=BwtaFyEG18gq9njwVhm1eiTz2DwJQYH6J0lX9w3mjPA,1259
65
+ sortingview/views/ElectrodeGeometry.py,sha256=nzWr3DJGdNeElBXNiTypgEGPvtkd_EnlfBRFKpdLRTE,509
66
+ sortingview/views/EphysTraces.py,sha256=WUFgVwvXIkmK7BUaxfkZlm6eEdobAuMT0Our_wYB72E,678
67
+ sortingview/views/Image.py,sha256=WIoBj3gVPsewv_9fPNIDhosh62yfMEOW85g2cZmN2cA,1167
68
+ sortingview/views/LayoutItem.py,sha256=315oDamlAONbeHPvmcGl_BHoWtcO9xoDhRFVnMXBvmc,1093
69
+ sortingview/views/Markdown.py,sha256=2ay9t76w1h2EtDoeTqOnpxWxm6nolq2mlnlPr54HmFc,402
70
+ sortingview/views/MountainLayout.py,sha256=EE-n8cHWzo4lj5LI-Pj_1HLzr9z3yVcTMYNJ5fx0J1Q,1240
71
+ sortingview/views/PlotlyFigure.py,sha256=BVRP3y0wk2yxnHVX1a01yf6OrltT36YDTXoOyQaQbsI,414
72
+ sortingview/views/PositionPlot.py,sha256=4hcVNRoycmkCYyuF9evYG1SWq7Qpi8vyReTuPbnfu7c,2023
73
+ sortingview/views/RasterPlot.py,sha256=hzmHElnNPn2Ls_qMQZiNUpz1NgtYueAmdCERxR6tl4E,1060
74
+ sortingview/views/SortingCuration.py,sha256=ndbndDuYC03MZiNIu1FuXQBD9PF0UQVlk9amBbMHLcI,370
75
+ sortingview/views/SortingCuration2.py,sha256=l1XG2wcfNFDJ1smZFQm_5M4ljmK-ECzQ3OfHRBQJrG0,745
76
+ sortingview/views/SortingSelection.py,sha256=ZZiR8Qflw7RxaHUxgALZ1-B0cYy26ybpNV9o9A-GcZg,523
77
+ sortingview/views/SortingSummary.py,sha256=XMeVIRFOd8yPT0crpxjOxJHhQbeQZCEc1J-EysHMCPQ,1585
78
+ sortingview/views/SpikeAmplitudes.py,sha256=-lShQohLHD9JIv81whCEhtpbjWVCLx0ObYi222-_6m8,1399
79
+ sortingview/views/SpikeLocations.py,sha256=JG5kjD80pA8RWD-CCn9lOaCr_ZGNDabn7GAHPCLTIO8,1857
80
+ sortingview/views/Splitter.py,sha256=wqjYioanD28d6BSrjY0S-YX4MRKDrtk_NextzPri9dk,924
81
+ sortingview/views/TabLayout.py,sha256=FnAfqZNWCkYJHMTpZ8sDdYCj_UlB09v3uEGUK618A4I,1042
82
+ sortingview/views/TiledImage.py,sha256=X7Eou24qyvXWuUpiPwOExr4LSUq3WS7Q5zS38qqK1bM,4163
83
+ sortingview/views/TimeseriesGraph.py,sha256=Y24RJHfc3w_zHeU6-SU7i9F6-vBT3_pNq-U4AnK2Srs,6450
84
+ sortingview/views/UnitImages.py,sha256=IDi6T20iLwQTAw3SvXVRIbnngCwyATXRJTv7jQ2nCzc,1176
85
+ sortingview/views/UnitLocations.py,sha256=JsZJtKYGNosgHGb4PUlAlS1jeBp3aDUp9HJQoK92BMs,1077
86
+ sortingview/views/UnitMetricsGraph.py,sha256=2wYwFZ7myQoXxQaGTU4LSBuoddYzyvHRxNqdrSSjgq8,1217
87
+ sortingview/views/UnitSimilarityMatrix.py,sha256=X_tuDgnK_O7o_9bH7ePUsPPhbBnEkIJPvw9GZdJuEl0,1052
88
+ sortingview/views/UnitsTable.py,sha256=mz0a5cWSecihL0ZKlUCX-DGHsNyqwmyHtsXIOo27LBo,1512
89
+ sortingview/views/View.py,sha256=cYbGgaQHML5_wJWdod4aJqQTR2yDkpHswCSryw80NTE,6384
90
+ sortingview/views/__init__.py,sha256=lw_oDuG60lyJ-pOvRi1acbEOupjSqbOPN6Ib8zd2bFw,1562
91
+ sortingview/views/franklab/DecodedLinearPositionV1.py,sha256=rlpzXZJTQGC73yJOLH4YzOpF1EbpBCCoLbayz_bT_yw,1491
92
+ sortingview/views/franklab/TrackPositionAnimationV1.py,sha256=7bI5Z-04YxklqxMCae11RJ7VNKZmQ2MbZgbYTMaBlnw,7808
93
+ sortingview/views/franklab/__init__.py,sha256=rHxWXRBDtNjVE9uMzsk6uc33tIcadMlrEuQXJRHYCR0,147
94
+ sortingview-0.15.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
95
+ tests/test_autocorrelograms.py,sha256=rg5h6FT-W9wvFbn6txNvAkf3TNFCet6ohBCjoewI4nA,1216
96
+ tests/test_average_waveforms.py,sha256=xXXC9w3mle9KvQA2xJ80TdeqMOIjoeewdoCpJuQl6ag,3140
97
+ tests/test_confusion_matrix.py,sha256=xntd3y2eEs9rzhtxS9C_WGCLa7ks_fRG1AfX4QKiVMk,3834
98
+ tests/test_cross_correlograms.py,sha256=YTN3y6rjixkgV08BWF6HtecQ-_2Lu-gaK769PhPZUp0,1507
99
+ tests/test_large_timeseries_graph.py,sha256=e6EQedyol8TgA8vbnY7Sxiyy0jxrz_OVMHZtAtq5fwk,1299
100
+ tests/test_layout.py,sha256=4tH7zpn-EyIiMsiGb909-_4hMxBcZnS6_q2JgJsIs4w,2621
101
+ tests/test_markdown.py,sha256=LJj9fullvG-6I6YAGCyt4JsE0yIJz4_GSunianV4Hp4,557
102
+ tests/test_position_plot.py,sha256=9NxNm-aSRqcMzIs6f1p8ra3_Zoxn5C45F2s7J2B4iVE,754
103
+ tests/test_raster_plot.py,sha256=bdlrB-rPLwse5OJV2B1EItzPjaKNGOjlUxNI2mVS3vw,1145
104
+ tests/test_sorting_curation_2.py,sha256=voJbcg59ZjcuebyDcohLPz9a7lK_ixWKrvmFvV2rGbg,1111
105
+ tests/test_sorting_selection.py,sha256=9tAYv108Yp9Agndc2Z-G6OkjH0QYP1L5ohxq_1pllWM,2308
106
+ tests/test_spike_amplitudes.py,sha256=g6erXcd9Nfx7ZR2SmKuiRF1EOyKqgkXo67xT1O2B3Po,1406
107
+ tests/test_spike_locations.py,sha256=ell_p5doE5hh0kKRR-Nyddf7ax_RvhyHT2BrKPMdXew,2663
108
+ tests/test_tab_layout.py,sha256=BpUoCirLBphuiqMYlxs-jtKpsxDAWfV7Szy_depOOKc,1815
109
+ tests/test_tiled_image.py,sha256=32uZMcOhM2nRnIWa2907-fISDjFNXXode0sbZyhP96s,2394
110
+ tests/test_track_position_animation.py,sha256=cdnpgP5ottTNVxBP6JKKmdGkmexGfRthoZ_xqfL4Riw,2379
111
+ tests/test_unit_locations.py,sha256=UXWK1Fj9bWlPYpgIo-PJGuXz0vdRWjJ4nLbpJ7EH04Q,2237
112
+ tests/test_unit_metrics_graph.py,sha256=cx8xXdl60JgifKnOsg-07xb1cesolLMWmSkenIklUmo,1601
113
+ tests/test_unit_similarity_matrix.py,sha256=QtETgug9PIc6giVSMfuHCkjcZCySN6YHPBErutTNHtg,1216
114
+ tests/test_units_table.py,sha256=nI-FZaVxYq3Mx3REhws0u3humnh_vsPeI0Fm24NxOK8,1443
115
+ tests/helpers/compute_correlogram_data.py,sha256=41sdyVPPTf7B4mSF1E28852eT0Z9Mf1HTlTI_dWzEys,3529
116
+ sortingview-0.15.0.dist-info/METADATA,sha256=YTgvcZ9LdvD_rBjiCm6xaLsH0e9ZgwrOJre776fAAW0,933
117
+ sortingview-0.15.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
118
+ sortingview-0.15.0.dist-info/top_level.txt,sha256=S3KsPAY-cEoC5Vjxd6b7DK1d2qdP9kS36PvLpEjRP84,27
119
+ sortingview-0.15.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+