From 4639b75d61cf2e5b6dffef73bc71a1970d8e8e4e Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:51:02 -0400 Subject: [PATCH 1/5] allow return of indices of ordering for z score heatmap --- src/spikeanalysis/spike_plotter.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/spikeanalysis/spike_plotter.py b/src/spikeanalysis/spike_plotter.py index beadec0..7c6b4df 100644 --- a/src/spikeanalysis/spike_plotter.py +++ b/src/spikeanalysis/spike_plotter.py @@ -66,7 +66,7 @@ def set_analysis(self, analysis: SpikeAnalysis): The SpikeAnalysis object for plotting """ - assert isinstance(analysis, SpikeAnalysis), "analysis must be a SpikeAnaysis dataset" + assert isinstance(analysis, SpikeAnalysis), "analysis must be a SpikeAnalysis dataset" self.data = analysis def plot_zscores( @@ -74,7 +74,8 @@ def plot_zscores( figsize: Optional[tuple] = (24, 10), sorting_index: Optional[int] = None, z_bar: Optional[list[int]] = None, - ): + indices: bool = False, + ) -> Optional[np.array]: """ Function to plot heatmaps of z scored firing rate. All trial groups are plotted on the same axes. So it is best to have a figsize that wide to fit all different trial groups. In this plot each @@ -89,7 +90,14 @@ def plot_zscores( The trial group to sort all values on. The default is None (which uses the largest trial group). z_bar: list[int] If given a list with min z score for the cbar at index 0 and the max at index 1. Overrides cbar generation + indices: bool, default False + If true will return the cluster ids sorted in the order they appear in the graph + Returns + ------- + ordered_cluster_ids: np.array + if indices is True, the function will return the cluster ids as displayed in the z bar graph + """ try: @@ -214,6 +222,9 @@ def plot_zscores( if RESET_INDEX: sorting_index = None + if indices: + return self.cluster_ids[z_score_sorting_index] + def plot_raster(self, window: Union[list, list[list]]): """ Function to plot rasters From d2d0ab3dc76d32a4abb2e7742e0af6e08924e0b4 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:53:00 -0400 Subject: [PATCH 2/5] fix typo --- src/spikeanalysis/spike_plotter.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/spikeanalysis/spike_plotter.py b/src/spikeanalysis/spike_plotter.py index 7c6b4df..5e15241 100644 --- a/src/spikeanalysis/spike_plotter.py +++ b/src/spikeanalysis/spike_plotter.py @@ -223,7 +223,7 @@ def plot_zscores( sorting_index = None if indices: - return self.cluster_ids[z_score_sorting_index] + return self.data.cluster_ids[z_score_sorting_index] def plot_raster(self, window: Union[list, list[list]]): """ @@ -234,8 +234,6 @@ def plot_raster(self, window: Union[list, list[list]]): window : Union[list, list[list]] The window [start, stop] to plot the raster over. Either one global list or nested list of [start, stop] format - - """ from .analysis_utils import histogram_functions as hf From c97dacba54f75602104c17aff6ca0b08aa4f7bb3 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:54:17 -0400 Subject: [PATCH 3/5] up super minor version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b36d863..b5b3110 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "spikeanalysis" -version = '0.0.8' +version = '0.0.9' authors = [{name="Zach McKenzie", email="mineurs-torrent0x@icloud.com"}] description = "Analysis of Spike Trains" requires-python = ">=3.9" From 9f6e6d459a0eff4ee7da742f5108c6165c0ecc93 Mon Sep 17 00:00:00 2001 From: Zach McKenzie <92116279+zm711@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:54:43 -0400 Subject: [PATCH 4/5] bump version in docs too --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5fd6a08..8fc1cae 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ author = "Zach McKenzie" # The full version, including alpha/beta/rc tags -release = "0.0.8" +release = "0.0.9" # -- General configuration --------------------------------------------------- From bc05c34aab658d57a8c381b9e7aeaac4a1a7baf0 Mon Sep 17 00:00:00 2001 From: zm711 <92116279+zm711@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:58:56 -0400 Subject: [PATCH 5/5] linting --- src/spikeanalysis/spike_plotter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spikeanalysis/spike_plotter.py b/src/spikeanalysis/spike_plotter.py index 5e15241..1022b92 100644 --- a/src/spikeanalysis/spike_plotter.py +++ b/src/spikeanalysis/spike_plotter.py @@ -97,7 +97,7 @@ def plot_zscores( ------- ordered_cluster_ids: np.array if indices is True, the function will return the cluster ids as displayed in the z bar graph - + """ try: