From 0bcdb2ab4b04dd75571583c4a5bbace088e658a4 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 12:02:42 -0500 Subject: [PATCH 1/7] [WIP] Quality metrics notebook --- notebooks/quality_metrics.ipynb | 160 ++++++++++++++------------------ 1 file changed, 72 insertions(+), 88 deletions(-) diff --git a/notebooks/quality_metrics.ipynb b/notebooks/quality_metrics.ipynb index 479b331..0ac80fc 100644 --- a/notebooks/quality_metrics.ipynb +++ b/notebooks/quality_metrics.ipynb @@ -1,22 +1,17 @@ { "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Quality Metrics\n" - ] - }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ - "This notebook is used to visualize the spike sorting quality metrics using the metrics.csv generated from kilosort. \n", + "## Quality Metrics\n", + "\n", + "Visualize the spike sorting quality metrics that are generated from Kilosort (`metrics.csv`) and stored in the DataJoint pipeline (`element-array-ephys`).\n", "\n", - "If you are new to using DataJoint for array electrophysiology - please see our [tutorial](./tutorial.ipynb) notebook for an in-depth explanation for setting up and running the DataJoint Workflow for NeuroPixels electrophysiology.\n", + "If you are new to using this DataJoint pipeline for analyzing electrophysiology recordings from Neuropixels probes, please see the [tutorial](./tutorial.ipynb) notebook for an in-depth explanation to set up and run the workflow.\n", "\n", - "The Element also offers Quality Metric visualizations. These are generated using `metrics.csv` generated from kilosort." + "This notebook can run in a [GitHub Codespace](https://github.com/datajoint/workflow-array-ephys#interactive-tutorial), and requires the example data to be populated into the database using the [demo_prepare](./demo_prepare.ipynb) notebook." ] }, { @@ -38,7 +33,6 @@ "import datajoint as dj\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import seaborn as sns\n", "from workflow_array_ephys.pipeline import ephys, probe, ephys_report" ] }, @@ -47,7 +41,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "First, ensure your `QualityMetrics` table is populated with this data:" + "### Populate the `QualityMetrics` table" ] }, { @@ -64,43 +58,31 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Unit quality metrics" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "#### Histograms of following cluster metrics will be plotted. \n", + "### Unit quality metrics\n", "\n", - "- `Firing rates (Hz)` : Total number of spikes / time in seconds \n", + "| Metric | Description |\n", + "| --- | --- |\n", + "| Firing rates (Hz) | Total number of spikes per time. |\n", + "| Signal-to-noise ratio | Ratio of the maximum amplitude of the mean spike waveform to the standard deviation of the background noise on a given channel. |\n", + "| Presence ratio | Proportion of time during a session that a unit is spiking, ranging from 0 to 0.99. |\n", + "| ISI (Interspike interval) violation | Rate of ISI violation as a fraction of overall rate. |\n", + "| Number violation | Total number of ISI violations. |\n", + "| Amplitude cut-off | False negative rate of a unit measured by the degree to which its distribution of spike amplitudes is truncated, indicating the fraction of missing spikes. An amplitude cutoff of 0.1 indicates approximately 10% missing spikes. |\n", + "| Isolation distance | A metric that uses the principal components (PCs) of a unit's waveforms, which are projected into a lower-dimensional PC space after spike sorting. This quantifies how well-isolated the unit is from other potential clusters. |\n", + "| L-ratio | A metric to quantify the distribution of spike distances from a cluster. A low L-ratio indicates that there is a relatively low number of non-member spikes around the target cluster. |\n", + "| D-prime | A metric calculated from waveform principal components using linear discriminant analysis. This measures the separability of one unit's PC cluster from all the others, with a higher d-prime value indicating better isolation of the unit. |\n", + "| Nearest-neighbors hit rate | The proportion of its nearest neighbors that belong to the same given cluster based on its first principal components. |\n", + "| Nearest-neighbors miss rate | The proportion of its nearest neighbors that do not belong to the same given cluster based on its first principal components. |\n", + "| Silhouette score | The ratio between cohesiveness of a cluster (distance between member spikes) and its separation from other clusters (distance to non-member spikes). |\n", + "| Max drift | The maximum shift in spike location, calculated as the center of mass of the energy of the first principal component score. |\n", + "| Contamination rate | |\n", "\n", - "- `Presence ratio` : The proportion of time during a session that a unit is spiking, ranging from 0 to 0.99.\n", + "For further details of the quality metrics, please see:\n", + "- [Allen Institute Documentation](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_quality_metrics.html)\n", "\n", - "- `Amplitude cut-off`: The false negative rate of a unit measured by the degree to which its distribution of spike amplitudes is truncated, indicating the fraction of missing spikes. An amplitude cutoff of 0.1 indicates approximately 10% missing spikes.\n", + "- [Buccino et al., eLife 2020](https://elifesciences.org/articles/61834)\n", "\n", - "- `L-ratio` : A metric to quantify the distribution of spike distances from a cluster. A low L-ratio indicates that there is a relatively low number of non-member spikes around the target cluster. \n", - "\n", - "- `Signal-to-noise ratio`: The ratio of the maximum amplitude of the mean spike waveform to the standard deviation of the background noise on a given channel.\n", - "\n", - "- `Isolation distance`: A metric that uses the principal components (PCs) of a unit's waveforms, which are projected into a lower-dimensional PC space after spike sorting. This quantifies how well-isolated the unit is from other potential clusters.\n", - "\n", - "- `D-prime`: A metric calculated from waveform principal components using linear discriminant analysis. This measures the separability of one unit's PC cluster from all the others, with a higher d-prime value indicating better isolation of the unit.\n", - "\n", - "- `Nearest-neighbors hit rate`: This measures the fraction of nearest neighbors for one unit's waveform principal components that fall within the same cluster.\n", - "\n", - "#### For more detailed explanation, please visit the following references:\n", - "- https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_quality_metrics.html\n", - "\n", - "- https://elifesciences.org/articles/61834" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We'll grab an example key for demonstration.\n" + "We'll grab an example key for demonstration." ] }, { @@ -490,19 +472,25 @@ "query" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Plot histograms of the cluster metrics." + ] + }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ - "# Plotting function\n", - "def plot_metric(ax, data, bins, x_axis_label=None, title=None, color='k', max_value=-1, smoothing=True, density=False):\n", + "def plot_metric(ax, data, bins, x_axis_label=None, title=None, color='k', smoothing=True, density=False):\n", " \"\"\"A function modified from https://allensdk.readthedocs.io/en/latest/_static/examples/nb/ecephys_quality_metrics.html\n", " \"\"\"\n", " from scipy.ndimage import gaussian_filter1d\n", - " if any(data) and np.nansum(data) :\n", - " # Plot data\n", + " if any(data) and np.nansum(data):\n", " h, b = np.histogram(data, bins=bins, density=density)\n", " x = b[:-1]\n", "\n", @@ -512,7 +500,7 @@ " ax.set_xlabel(x_axis_label)\n", " ax.set_ylim([0, None])\n", " ax.set_title(title)\n", - " sns.despine()" + " ax.spines[['right', 'top']].set_visible(False)" ] }, { @@ -532,7 +520,6 @@ } ], "source": [ - "# Plot the results\n", "fig, axes = plt.subplots(4, 4, figsize=(12, 9))\n", "axes = axes.flatten()\n", "plt.suptitle(f\"Cluster Quality Metrics for {key}\", y=.99, fontsize=12)\n", @@ -546,7 +533,7 @@ "# Signal-to-Noise Ratio\n", "data = query.fetch(\"snr\")\n", "bins = np.linspace(0, 10, 100)\n", - "plot_metric(axes[1], data, bins, title=\"SNR\")\n", + "plot_metric(axes[1], data, bins, title=\"Signal-to-Noise Ratio\")\n", "\n", "# Presence Ratio\n", "data = query.fetch(\"presence_ratio\")\n", @@ -561,20 +548,20 @@ "# Number Violation\n", "data = query.fetch(\"number_violation\")\n", "bins = np.linspace(0, 1, 100)\n", - "plot_metric(axes[4], data, bins, title=\"Number violation\")\n", + "plot_metric(axes[4], data, bins, title=\"Number Violation\")\n", "axes[4].set_ylabel(\"Count\")\n", "\n", "# Amplitude Cutoff\n", "data = query.fetch(\"amplitude_cutoff\")\n", "bins = np.linspace(0, 0.5, 100)\n", - "plot_metric(axes[5], data, bins, title=\"Amplitude cutoff\")\n", + "plot_metric(axes[5], data, bins, title=\"Amplitude Cutoff\")\n", "\n", "# Isolation Distance\n", "data = query.fetch(\"isolation_distance\")\n", "bins = np.linspace(0, 170, 50)\n", "plot_metric(axes[6], data, bins, title=\"Isolation Distance\")\n", "\n", - "# Amplitude Cutoff\n", + "# L-Ratio\n", "data = query.fetch(\"l_ratio\")\n", "bins = np.linspace(0, 1, 100)\n", "plot_metric(axes[7], data, bins, title=\"L-Ratio\")\n", @@ -585,15 +572,15 @@ "plot_metric(axes[8], data, bins, title=\"d-Prime\")\n", "axes[8].set_ylabel(\"Count\")\n", "\n", - "# Nearest-Neighbor Hit Rate\n", + "# Nearest-Neighbors Hit Rate\n", "data = query.fetch(\"nn_hit_rate\")\n", "bins = np.linspace(0, 1, 100)\n", - "plot_metric(axes[9], data, bins, title=\"Nearest Neighbor Hit Rate\")\n", + "plot_metric(axes[9], data, bins, title=\"Nearest-Neighbors Hit Rate\")\n", "\n", - "# Nearest-Neighbor Miss Rate\n", + "# Nearest-Neighbors Miss Rate\n", "data = query.fetch(\"nn_miss_rate\")\n", "bins = np.linspace(0, 1, 100)\n", - "plot_metric(axes[10], data, bins, title=\"Nearest Neighbor Miss Rate\")\n", + "plot_metric(axes[10], data, bins, title=\"Nearest-Neighbors Miss Rate\")\n", "\n", "# Silhouette Score\n", "data = query.fetch(\"silhouette_score\")\n", @@ -603,13 +590,14 @@ "# Max Drift\n", "data = query.fetch(\"max_drift\")\n", "bins = np.linspace(0, 100, 100)\n", - "plot_metric(axes[12], data, bins, title=\"max_drift\")\n", + "plot_metric(axes[12], data, bins, title=\"Max Drift\")\n", "axes[12].set_ylabel(\"Count\")\n", "\n", "# Contamination Rate\n", "data = query.fetch(\"contamination_rate\")\n", "bins = np.linspace(0, 100, 100)\n", "plot_metric(axes[13], data, bins, title=\"Contamination Rate\")\n", + "\n", "axes[14].remove()\n", "axes[15].remove()\n", "plt.tight_layout()" @@ -620,31 +608,19 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Waveform quality metrics" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "- `Amplitude (μV)` : The absolute difference between the waveform peak and trough.\n", + "### Waveform quality metrics\n", "\n", - "- `Duration (ms)` : The time interval between the waveform peak and trough.\n", - "\n", - "- `Half Width (ms)`: The spike width at half of the maximum amplitude.\n", - "\n", - "- `PT (peak-to-trough) Ratio` : The absolute amplitude of the peak divided by the absolute amplitude of the trough relative to 0.\n", - "\n", - "- `Repolarization Slope`: The slope of the fitted regression line to the first 30μs from trough to peak.\n", - "\n", - "- `Recovery Slope`: The slope of the fitted regression line to the first 30μs from peak to tail.\n", - "\n", - "- `Spread (μm)`: The spatial extent of channels where the waveform amplitude exceeds 12% of the maximum amplitude.\n", - "\n", - "- `Velocity Above (s/m)`: The inverse velocity of waveform propagation from the soma toward the top of the probe.\n", - "\n", - "- `Velocity Below (s/m)`: The inverse velocity of waveform propagation from the soma toward the bottom of the probe." + "| Metric | Description |\n", + "| -- | -- |\n", + "| `Amplitude (μV)` | Absolute difference between the waveform peak and trough. |\n", + "| `Duration (ms)` | Time interval between the waveform peak and trough. |\n", + "| `Half Width (ms)` | Spike width at half of the maximum amplitude. |\n", + "| `Peak-to-Trough (PT) Ratio` | Absolute amplitude of the peak divided by the absolute amplitude of the trough relative to 0. |\n", + "| `Repolarization Slope` | Slope of the fitted regression line to the first 30μs from trough to peak. |\n", + "| `Recovery Slope` | Slope of the fitted regression line to the first 30μs from peak to tail. |\n", + "| `Spread (μm)` | Spatial extent of channels where the waveform amplitude exceeds 12% of the peak amplitude. |\n", + "| `Velocity Above (s/m)` | Inverse velocity of waveform propagation from the soma toward the top of the probe. |\n", + "| `Velocity Below (s/m)` | Inverse velocity of waveform propagation from the soma toward the bottom of the probe. |" ] }, { @@ -942,6 +918,14 @@ "query" ] }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Plot histograms of the waveform metrics." + ] + }, { "cell_type": "code", "execution_count": 16, @@ -974,15 +958,15 @@ "bins = np.linspace(0, 3, 100)\n", "plot_metric(axes[1], data, bins, title=\"Duration (ms)\")\n", "\n", - "# Half-Width\n", + "# Half Width\n", "data = query.fetch(\"halfwidth\")\n", "bins = np.linspace(0, 5, 100)\n", "plot_metric(axes[2], data, bins, title=\"Half Width (ms)\")\n", "\n", - "# PT Ratio\n", + "# Peak-to-Trough Ratio\n", "data = query.fetch(\"pt_ratio\")\n", "bins = np.linspace(0, 1, 100)\n", - "plot_metric(axes[3], data, bins, title=\"PT Ratio\")\n", + "plot_metric(axes[3], data, bins, title=\"Peak-to-Trough Ratio\")\n", "\n", "# Repolarization Slope\n", "data = query.fetch(\"repolarization_slope\")\n", @@ -998,7 +982,7 @@ "# Spread\n", "data = np.log10(query.fetch(\"spread\"))\n", "bins = np.linspace(0, 3, 100)\n", - "plot_metric(axes[6], data, bins, title=\"Spread (μm)\")\n", + "plot_metric(axes[6], data, bins, title=\"Spread (μm) (log$_{10}$)\")\n", "\n", "# Velocity Above\n", "data = query.fetch(\"velocity_above\")\n", From 1001dc96cc38023bcd74c7e56fb2bb01d28fc25f Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 12:11:07 -0500 Subject: [PATCH 2/7] Update readme --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6ee63cf..a90dd6b 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,18 @@ The easiest way to learn about DataJoint Elements is to use the tutorial noteboo Here are some options that provide a great experience: -- **Cloud-based IDE**: (*recommended*) +- Cloud-based Development Environment: (*recommended*) - Launch using [GitHub Codespaces](https://github.com/features/codespaces) using the `+` option which will `Create codespace on main` in the codebase repository on your fork with default options. For more control, see the `...` where you may create `New with options...`. - Build time for a codespace is **~7m**. This is done infrequently and cached for convenience. - Start time for a codespace is **~30s**. This will pull the built codespace from cache when you need it. - *Tip*: Each month, GitHub renews a [free-tier](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#monthly-included-storage-and-core-hours-for-personal-accounts) quota of compute and storage. Typically we run into the storage limits before anything else since Codespaces consume storage while stopped. It is best to delete Codespaces when not actively in use and recreate when needed. We'll soon be creating prebuilds to avoid larger build times. Once any portion of your quota is reached, you will need to wait for it to be reset at the end of your cycle or add billing info to your GitHub account to handle overages. - *Tip*: GitHub auto names the codespace but you can rename the codespace so that it is easier to identify later. -- **Local IDE**: - - Ensure you have [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - - Ensure you have [Docker](https://docs.docker.com/get-docker/) - - Ensure you have [VSCode](https://code.visualstudio.com/) - - Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) +- Local Development Environment: + - Note: On Windows, running the tutorial notebook with the example data in a Dev Container is not currently possible due to an s3fs mounting issue. Please use GitHub Codespaces in the browser. + - Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) + - Install [Docker](https://docs.docker.com/get-docker/) + - Install [VSCode](https://code.visualstudio.com/) + - Install the VSCode [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) - `git clone` the codebase repository and open it in VSCode - Use the `Dev Containers extension` to `Reopen in Container` (More info in the `Getting started` included with the extension) From b16b43109a2936e54d057ba4e490999641504720 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 12:18:26 -0500 Subject: [PATCH 3/7] Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a90dd6b..9c1c72a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Here are some options that provide a great experience: - *Tip*: Each month, GitHub renews a [free-tier](https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-github-codespaces#monthly-included-storage-and-core-hours-for-personal-accounts) quota of compute and storage. Typically we run into the storage limits before anything else since Codespaces consume storage while stopped. It is best to delete Codespaces when not actively in use and recreate when needed. We'll soon be creating prebuilds to avoid larger build times. Once any portion of your quota is reached, you will need to wait for it to be reset at the end of your cycle or add billing info to your GitHub account to handle overages. - *Tip*: GitHub auto names the codespace but you can rename the codespace so that it is easier to identify later. - Local Development Environment: - - Note: On Windows, running the tutorial notebook with the example data in a Dev Container is not currently possible due to an s3fs mounting issue. Please use GitHub Codespaces in the browser. + - Note: On Windows, running the tutorial notebook with the example data in a Dev Container is not currently possible due to a s3fs mounting issue. Please use the `Cloud-based Development Environment` option above. - Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - Install [Docker](https://docs.docker.com/get-docker/) - Install [VSCode](https://code.visualstudio.com/) From 027325fbf4aa37ddc479dd434289ba988ab4d75f Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 13:26:36 -0500 Subject: [PATCH 4/7] Update directory path --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0d95ea5..a1bea99 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -336,8 +336,8 @@ def ingest_data(setup, pipeline, test_data): def testdata_paths(): """Paths for test data 'subjectX/sessionY/probeZ/etc'""" return { - "npx3A-p1-ks": "subject5/session1/probe_1/ks2.1_01", - "npx3A-p2-ks": "subject5/session1/probe_2/ks2.1_01", + "npx3A-p1-ks": "subject5/session1/probe_1/kilosort2-5_1", + "npx3A-p2-ks": "subject5/session1/probe_2/kilosort2-5_1", "oe_npx3B-ks": "subject4/experiment1/recording1/continuous/" + "Neuropix-PXI-100.0/ks", "sglx_npx3A-p1": "subject5/session1/probe_1", From cca8f3a1493f8e7063a759299c701e5a245ed619 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 13:55:22 -0500 Subject: [PATCH 5/7] Update notebook --- notebooks/quality_metrics.ipynb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/notebooks/quality_metrics.ipynb b/notebooks/quality_metrics.ipynb index 9752bf0..ceebbc9 100644 --- a/notebooks/quality_metrics.ipynb +++ b/notebooks/quality_metrics.ipynb @@ -6,7 +6,7 @@ "source": [ "## Quality Metrics\n", "\n", - "Visualize the spike sorting quality metrics that are generated from Kilosort (`metrics.csv`) and stored in the DataJoint pipeline (`element-array-ephys`).\n", + "Visualize the spike sorting quality metrics that are generated from the [Kilosort](https://github.com/MouseLand/Kilosort) results with [ecephys_spike_sorting](https://github.com/AllenInstitute/ecephys_spike_sorting) (i.e. `metrics.csv`) and stored in the DataJoint pipeline (i.e. `element-array-ephys`).\n", "\n", "If you are new to using this DataJoint pipeline for analyzing electrophysiology recordings from Neuropixels probes, please see the [tutorial](./tutorial.ipynb) notebook for an in-depth explanation to set up and run the workflow.\n", "\n", @@ -621,14 +621,14 @@ "\n", "| Metric | Description |\n", "| -- | -- |\n", - "| `Amplitude (μV)` | Absolute difference between the waveform peak and trough. |\n", - "| `Duration (ms)` | Time interval between the waveform peak and trough. |\n", - "| `Peak-to-Trough (PT) Ratio` | Absolute amplitude of the peak divided by the absolute amplitude of the trough relative to 0. |\n", - "| `Repolarization Slope` | Slope of the fitted regression line to the first 30μs from trough to peak. |\n", - "| `Recovery Slope` | Slope of the fitted regression line to the first 30μs from peak to tail. |\n", - "| `Spread (μm)` | Spatial extent of channels where the waveform amplitude exceeds 12% of the peak amplitude. |\n", - "| `Velocity Above (s/m)` | Inverse velocity of waveform propagation from the soma toward the top of the probe. |\n", - "| `Velocity Below (s/m)` | Inverse velocity of waveform propagation from the soma toward the bottom of the probe. |" + "| Amplitude (μV) | Absolute difference between the waveform peak and trough. |\n", + "| Duration (ms) | Time interval between the waveform peak and trough. |\n", + "| Peak-to-Trough (PT) Ratio | Absolute amplitude of the peak divided by the absolute amplitude of the trough relative to 0. |\n", + "| Repolarization Slope | Slope of the fitted regression line to the first 30μs from trough to peak. |\n", + "| Recovery Slope | Slope of the fitted regression line to the first 30μs from peak to tail. |\n", + "| Spread (μm) | Spatial extent of channels where the waveform amplitude exceeds 12% of the peak amplitude. |\n", + "| Velocity Above (s/m) | Inverse velocity of waveform propagation from the soma toward the top of the probe. |\n", + "| Velocity Below (s/m) | Inverse velocity of waveform propagation from the soma toward the bottom of the probe. |" ] }, { From d9e9a3c7c70ff0f247dab5de91174c813b5bda54 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 14:58:45 -0500 Subject: [PATCH 6/7] Update notebook --- notebooks/quality_metrics.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebooks/quality_metrics.ipynb b/notebooks/quality_metrics.ipynb index ceebbc9..a1ee914 100644 --- a/notebooks/quality_metrics.ipynb +++ b/notebooks/quality_metrics.ipynb @@ -6,7 +6,7 @@ "source": [ "## Quality Metrics\n", "\n", - "Visualize the spike sorting quality metrics that are generated from the [Kilosort](https://github.com/MouseLand/Kilosort) results with [ecephys_spike_sorting](https://github.com/AllenInstitute/ecephys_spike_sorting) (i.e. `metrics.csv`) and stored in the DataJoint pipeline (i.e. `element-array-ephys`).\n", + "Visualize the spike sorting quality metrics that are generated from the [Kilosort](https://github.com/MouseLand/Kilosort) results with the [ecephys_spike_sorting](https://github.com/AllenInstitute/ecephys_spike_sorting) package (i.e. `metrics.csv`) and stored in the DataJoint pipeline (i.e. `element-array-ephys`).\n", "\n", "If you are new to using this DataJoint pipeline for analyzing electrophysiology recordings from Neuropixels probes, please see the [tutorial](./tutorial.ipynb) notebook for an in-depth explanation to set up and run the workflow.\n", "\n", @@ -59,10 +59,10 @@ "\n", "| Metric | Description |\n", "| --- | --- |\n", - "| Firing rates (Hz) | Total number of spikes per time in seconds. |\n", + "| Firing rate (Hz) | Total number of spikes per second. |\n", "| Signal-to-noise ratio | Ratio of the maximum amplitude of the mean spike waveform to the standard deviation of the background noise on a given channel. |\n", "| Presence ratio | Proportion of time during a session that a unit is spiking, ranging from 0 to 0.99. |\n", - "| ISI (Interspike interval) violation | Rate of ISI violation as a fraction of overall rate. |\n", + "| Interspike interval (ISI) violation | Rate of ISI violation as a fraction of overall rate. |\n", "| Number violation | Total number of ISI violations. |\n", "| Amplitude cut-off | False negative rate of a unit measured by the degree to which its distribution of spike amplitudes is truncated, indicating the fraction of missing spikes. An amplitude cutoff of 0.1 indicates approximately 10% missing spikes. |\n", "| Isolation distance | A metric that uses the principal components (PCs) of a unit's waveforms, which are projected into a lower-dimensional PC space after spike sorting. This quantifies how well-isolated the unit is from other potential clusters. |\n", From 622419bfc5f84cccc3976944bd30b25760402dac Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Fri, 21 Apr 2023 15:12:13 -0500 Subject: [PATCH 7/7] Fix link --- notebooks/quality_metrics.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/quality_metrics.ipynb b/notebooks/quality_metrics.ipynb index a1ee914..7d2d860 100644 --- a/notebooks/quality_metrics.ipynb +++ b/notebooks/quality_metrics.ipynb @@ -6,7 +6,7 @@ "source": [ "## Quality Metrics\n", "\n", - "Visualize the spike sorting quality metrics that are generated from the [Kilosort](https://github.com/MouseLand/Kilosort) results with the [ecephys_spike_sorting](https://github.com/AllenInstitute/ecephys_spike_sorting) package (i.e. `metrics.csv`) and stored in the DataJoint pipeline (i.e. `element-array-ephys`).\n", + "Visualize the spike sorting quality metrics that are generated from the [Kilosort](https://github.com/MouseLand/Kilosort) results with the [ecephys_spike_sorting](https://github.com/datajoint/ecephys_spike_sorting) package (i.e. `metrics.csv`) and stored in the DataJoint pipeline (i.e. `element-array-ephys`).\n", "\n", "If you are new to using this DataJoint pipeline for analyzing electrophysiology recordings from Neuropixels probes, please see the [tutorial](./tutorial.ipynb) notebook for an in-depth explanation to set up and run the workflow.\n", "\n",