Skip to content

Commit 40b5a6d

Browse files
committed
Merge main of datajoint/element-array-ephys
2 parents e0919ae + e487f3a commit 40b5a6d

14 files changed

+1674
-652
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
55

6+
## [0.2.5] - 2023-04-12
7+
8+
+ Add - docstrings for quality metric tables
9+
+ Fix - docstring errors
10+
+ Update - `concepts.md`
11+
+ Update - schema diagrams with quality metrics tables
12+
613
## [0.2.4] - 2023-03-10
714

815
+ Update - Requirements with `ipywidgets` and `scikit-image` for plotting widget
@@ -90,6 +97,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
9097
+ Add - Probe table supporting: Neuropixels probes 1.0 - 3A, 1.0 - 3B, 2.0 - SS,
9198
2.0 - MS
9299

100+
[0.2.5]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.5
93101
[0.2.4]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.4
94102
[0.2.3]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.3
95103
[0.2.2]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.2

docs/mkdocs.yaml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ---------------------- PROJECT SPECIFIC ---------------------------
1+
--- # ---------------------- PROJECT SPECIFIC ---------------------------
22

33
site_name: DataJoint Documentation
44
site_url: http://localhost/docs/elements/element-array-ephys
@@ -7,19 +7,20 @@ repo_name: datajoint/element-array-ephys
77
nav:
88
- Element Array Ephys: index.md
99
- Concepts: concepts.md
10-
- Tutorials:
11-
- Overview: tutorials/index.md
12-
- Data Download: tutorials/00-data-download-optional.ipynb
13-
- Configure: tutorials/01-configure.ipynb
14-
- Workflow Structure: tutorials/02-workflow-structure-optional.ipynb
15-
- Process: tutorials/03-process.ipynb
16-
- Automate: tutorials/04-automate-optional.ipynb
17-
- Explore: tutorials/05-explore.ipynb
18-
- Drop: tutorials/06-drop-optional.ipynb
19-
- Downstream Analysis: tutorials/07-downstream-analysis.ipynb
20-
- Visualizations: tutorials/10-data_visualization.ipynb
21-
- Electrode Localization: tutorials/08-electrode-localization.ipynb
22-
- NWB Export: tutorials/09-NWB-export.ipynb
10+
- Tutorials:
11+
- Overview: tutorials/index.md
12+
- Data Download: tutorials/00-data-download-optional.ipynb
13+
- Configure: tutorials/01-configure.ipynb
14+
- Workflow Structure: tutorials/02-workflow-structure-optional.ipynb
15+
- Process: tutorials/03-process.ipynb
16+
- Automate: tutorials/04-automate-optional.ipynb
17+
- Explore: tutorials/05-explore.ipynb
18+
- Drop: tutorials/06-drop-optional.ipynb
19+
- Downstream Analysis: tutorials/07-downstream-analysis.ipynb
20+
- Visualizations: tutorials/10-data_visualization.ipynb
21+
- Electrode Localization: tutorials/08-electrode-localization.ipynb
22+
- NWB Export: tutorials/09-NWB-export.ipynb
23+
- Quality Metrics: tutorials/quality_metrics.ipynb
2324
- Citation: citation.md
2425
- API: api/ # defer to gen-files + literate-nav
2526
- Changelog: changelog.md
@@ -35,7 +36,7 @@ nav:
3536
# 02. Instead of designating codeblocks with bash, use console. For example..
3637
# ```console
3738
# cd ../my_dir
38-
# ```
39+
# ```
3940
# 03. Links across docs should ...
4041
# A. Not involve line breaks.
4142
# B. Use relative paths to docs in the same repo
@@ -63,7 +64,7 @@ nav:
6364
# URL in ./docs/src/api/make_pages.py#L19 to your fork.
6465
# 04. To deploy this site on your fork,
6566
# A. declare a branch called gh-pages
66-
# B. go to the your fork > settings > pages
67+
# B. go to the your fork > settings > pages
6768
# C. direct pages to render from the gh-pages branch at root
6869
# D. push a tag to your fork with the format test*.*.*
6970
#
@@ -109,7 +110,7 @@ plugins:
109110
line_length: 88
110111
- gen-files:
111112
scripts:
112-
- ./src/api/make_pages.py
113+
- ./src/api/make_pages.py
113114
- literate-nav:
114115
nav_file: navigation.md
115116
- exclude-search:
@@ -178,4 +179,4 @@ extra_css:
178179
- assets/stylesheets/extra.css
179180

180181
extra_javascript:
181-
- https://js-na1.hs-scripts.com/23133402.js # HubSpot chatbot
182+
- https://js-na1.hs-scripts.com/23133402.js # HubSpot chatbot

docs/src/concepts.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ is a table within the Element or a table connected to the Element.
107107

108108
![diagram](https://raw.githubusercontent.com/datajoint/element-array-ephys/main/images/attached_array_ephys_element_precluster.svg)
109109

110+
### `ephys_no_curation` module
111+
112+
![diagram](https://raw.githubusercontent.com/datajoint/element-array-ephys/main/images/attached_array_ephys_element_no_curation.svg)
113+
110114
### `subject` schema ([API docs](https://datajoint.com/docs/elements/element-animal/api/element_animal/subject))
111115

112116
Although not required, most choose to connect the `Session` table to a `Subject` table.
@@ -156,6 +160,9 @@ Tables for storing probe or unit-level visualization results.
156160
| --- | --- |
157161
| ProbeLevelReport | A table to store drift map figures generated from each recording probe. |
158162
| UnitLevelReport | A table to store figures (waveforms, autocorrelogram, peak waveform + neighbors) generated for each unit. |
163+
| QualityMetricCutoffs | A table to store cut-off values for cluster quality metrics. |
164+
| QualityMetricSet | A manual table to match a set of cluster quality metric values with desired cut-offs. |
165+
| QualityMetricReport | A table to store quality metric figures. |
159166

160167
## Element Development
161168

element_array_ephys/ephys_acute.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,7 @@ def make(self, key):
13601360
metrics_df = pd.read_csv(metric_fp)
13611361
metrics_df.set_index("cluster_id", inplace=True)
13621362
metrics_df.replace([np.inf, -np.inf], np.nan, inplace=True)
1363-
metrics_df.columns = map(str.lower, metrics_df.columns)
1364-
1363+
metrics_df.columns = metrics_df.columns.str.lower()
13651364
metrics_list = [
13661365
dict(metrics_df.loc[unit_key["unit"]], **unit_key)
13671366
for unit_key in (CuratedClustering.Unit & key).fetch("KEY")

element_array_ephys/ephys_chronic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,8 +1289,7 @@ def make(self, key):
12891289
metrics_df = pd.read_csv(metric_fp)
12901290
metrics_df.set_index("cluster_id", inplace=True)
12911291
metrics_df.replace([np.inf, -np.inf], np.nan, inplace=True)
1292-
metrics_df.columns = map(str.lower, metrics_df.columns)
1293-
1292+
metrics_df.columns = metrics_df.columns.str.lower()
12941293
metrics_list = [
12951294
dict(metrics_df.loc[unit_key["unit"]], **unit_key)
12961295
for unit_key in (CuratedClustering.Unit & key).fetch("KEY")

element_array_ephys/ephys_no_curation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,9 @@ class Unit(dj.Part):
937937
938938
Attributes:
939939
CuratedClustering (foreign key): CuratedClustering primary key.
940-
unit (foreign key, int): Unique integer identifying a single unit.
941-
probe.ElectrodeConfig.Electrode (dict): probe.ElectrodeConfig.Electrode primary key.
942-
ClusteringQualityLabel (dict): CLusteringQualityLabel primary key.
940+
unit (int): Unique integer identifying a single unit.
941+
probe.ElectrodeConfig.Electrode (foreign key): probe.ElectrodeConfig.Electrode primary key.
942+
ClusteringQualityLabel (foreign key): CLusteringQualityLabel primary key.
943943
spike_count (int): Number of spikes in this recording for this unit.
944944
spike_times (longblob): Spike times of this unit, relative to start time of EphysRecording.
945945
spike_sites (longblob): Array of electrode associated with each spike.
@@ -1300,8 +1300,7 @@ def make(self, key):
13001300
metrics_df = pd.read_csv(metric_fp)
13011301
metrics_df.set_index("cluster_id", inplace=True)
13021302
metrics_df.replace([np.inf, -np.inf], np.nan, inplace=True)
1303-
metrics_df.columns = map(str.lower, metrics_df.columns)
1304-
1303+
metrics_df.columns = metrics_df.columns.str.lower()
13051304
metrics_list = [
13061305
dict(metrics_df.loc[unit_key["unit"]], **unit_key)
13071306
for unit_key in (CuratedClustering.Unit & key).fetch("KEY")

element_array_ephys/ephys_report.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ def make(self, key):
159159

160160
@schema
161161
class QualityMetricCutoffs(dj.Lookup):
162+
"""Cut-off values for unit quality metrics.
163+
164+
Attributes:
165+
cutoffs_id (smallint): Unique ID for the cut-off values.
166+
amplitude_cutoff_maximum (float): Optional. Amplitude cut-off.
167+
presence_ratio_minimum (float): Optional. Presence ratio cut-off.
168+
isi_violations_maximum (float): Optional. ISI violation ratio cut-off.
169+
cutoffs_hash (uuid): uuid for the cut-off values.
170+
"""
171+
162172
definition = """
163173
cutoffs_id : smallint
164174
---
@@ -218,6 +228,13 @@ def insert_new_cutoffs(
218228

219229
@schema
220230
class QualityMetricSet(dj.Manual):
231+
"""Set of quality metric values for clusters and its cut-offs.
232+
233+
Attributes:
234+
ephys.QualityMetrics (foreign key): ephys.QualityMetrics primary key.
235+
QualityMetricCutoffs (foreign key): QualityMetricCutoffs primary key.
236+
"""
237+
221238
definition = """
222239
-> ephys.QualityMetrics
223240
-> QualityMetricCutoffs
@@ -226,6 +243,13 @@ class QualityMetricSet(dj.Manual):
226243

227244
@schema
228245
class QualityMetricReport(dj.Computed):
246+
"""Table for storing quality metric figures.
247+
248+
Attributes:
249+
QualityMetricSet (foreign key): QualityMetricSet primary key.
250+
plot_grid (longblob): Plotly figure object.
251+
"""
252+
229253
definition = """
230254
-> QualityMetricSet
231255
---

element_array_ephys/plotting/qc.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ def __init__(
2828
key (dict, optional): key from ephys.QualityMetric table. Defaults to None.
2929
scale (float, optional): Scale at which to render figure. Defaults to 1.4.
3030
fig_width (int, optional): Figure width in pixels. Defaults to 800.
31-
amplitude_cutoff_maximum (float, optional): Cutoff for unit amplitude in
32-
visualizations. Defaults to None.
33-
presence_ratio_minimum (float, optional): Cutoff for presence ratio in
34-
visualizations. Defaults to None.
35-
isi_violations_maximum (float, optional): Cutoff for isi violations in
36-
visualizations. Defaults to None.
37-
dark_mode (bool, optional): Set background to black, foreground white.
38-
Default False, black on white.
31+
amplitude_cutoff_maximum (float, optional): Cutoff for unit amplitude in visualizations. Defaults to None.
32+
presence_ratio_minimum (float, optional): Cutoff for presence ratio in visualizations. Defaults to None.
33+
isi_violations_maximum (float, optional): Cutoff for isi violations in visualizations. Defaults to None.
34+
dark_mode (bool, optional): Set background to black, foreground white. Default False, black on white.
3935
"""
4036
self._ephys = ephys
4137
self._key = key
@@ -134,7 +130,7 @@ def _format_fig(
134130
Figure to apply formatting. Defaults to empty.
135131
scale (float, optional): Scale to render figure. Defaults to scale from
136132
class init, 1.
137-
ratio (float, optional): Figure aspect ratio width/height . Defaults to 1.
133+
ratio (float, optional): Figure aspect ratio width/height. Defaults to 1.
138134
139135
Returns:
140136
go.Figure: Formatted figure
@@ -202,7 +198,7 @@ class initialization.
202198
return fig.add_trace(
203199
go.Scatter(
204200
x=histogram_bins[:-1],
205-
y=gaussian_filter1d(histogram, 1), # TODO: remove smoothing
201+
y=gaussian_filter1d(histogram, 1),
206202
mode="lines",
207203
line=dict(color="rgb(0, 160, 223)", width=2 * scale), # DataJoint Blue
208204
hovertemplate="%{x:.2f}<br>%{y:.2f}<extra></extra>",
@@ -215,8 +211,7 @@ def get_single_fig(self, fig_name: str, scale: float = None) -> go.Figure:
215211
216212
Args:
217213
fig_name (str): Name of figure to be rendered
218-
scale (float, optional): Scale to render fig. Defaults to scale at class
219-
init, 1.
214+
scale (float, optional): Scale to render fig. Defaults to scale at class init, 1.
220215
221216
Returns:
222217
go.Figure: Histogram plot
@@ -253,8 +248,7 @@ def get_grid(self, n_columns: int = 4, scale: float = 1.0) -> go.Figure:
253248
254249
Args:
255250
n_columns (int, optional): Number of column in grid. Defaults to 4.
256-
scale (float, optional): Scale to render fig. Defaults to scale at class
257-
init, 1.
251+
scale (float, optional): Scale to render fig. Defaults to scale at class init, 1.
258252
259253
Returns:
260254
go.Figure: grid of available plots

element_array_ephys/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Package metadata."""
2-
__version__ = "0.2.4"
2+
__version__ = "0.2.5"

images/attached_array_ephys_element_acute.svg

Lines changed: 451 additions & 3 deletions
Loading

0 commit comments

Comments
 (0)