Skip to content

Commit

Permalink
Merge pull request #38 from zm711/z-score-updates
Browse files Browse the repository at this point in the history
allow z score to return indices to know cluster activities
  • Loading branch information
zm711 authored Aug 30, 2023
2 parents 721355f + bc05c34 commit d901e65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "spikeanalysis"
version = '0.0.8'
version = '0.0.9'
authors = [{name="Zach McKenzie", email="[email protected]"}]
description = "Analysis of Spike Trains"
requires-python = ">=3.9"
Expand Down
17 changes: 13 additions & 4 deletions src/spikeanalysis/spike_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ 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(
self,
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
Expand All @@ -89,6 +90,13 @@ 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
"""

Expand Down Expand Up @@ -214,6 +222,9 @@ def plot_zscores(
if RESET_INDEX:
sorting_index = None

if indices:
return self.data.cluster_ids[z_score_sorting_index]

def plot_raster(self, window: Union[list, list[list]]):
"""
Function to plot rasters
Expand All @@ -223,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

Expand Down

0 comments on commit d901e65

Please sign in to comment.