Skip to content

Commit 9a78c15

Browse files
authored
Merge pull request #3 from CBroz1/ja
linter recommended changes, reduce linter exceptions
2 parents 47de1d5 + 904ccb9 commit 9a78c15

23 files changed

+265
-223
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ repos:
2828
rev: 5.11.2
2929
hooks:
3030
- id: isort
31+
args: ["--profile", "black"]
3132
description: Sorts imports in an alphabetical order
3233

3334
# flake8
@@ -42,6 +43,14 @@ repos:
4243
- "--select=B,C,E,F,W,T4,B9"
4344

4445
# these are errors that will be ignored by flake8
45-
# check out their meaning here
46-
# https://flake8.pycqa.org/en/latest/user/error-codes.html
47-
- "--ignore=C813,C901,E203,E266,E501,W503,F403,F401,E402,W605"
46+
# https://www.flake8rules.com/rules/{code}.html
47+
- "--ignore=E203,E501,W503,W605"
48+
# E203 - Colons should not have any space before them.
49+
# Needed for list indexing
50+
# E501 - Line lengths are recommended to be no greater than 79 characters.
51+
# Needed as we conform to 88
52+
# W503 - Line breaks should occur after the binary operator.
53+
# Needed because not compatible with black
54+
# W605 - a backslash-character pair that is not a valid escape sequence now
55+
# generates a DeprecationWarning. This will eventually become a SyntaxError.
56+
# Needed because we use \d as an escape sequence

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Contribution Guidelines
22

3-
This project follows the [DataJoint Contribution Guidelines](https://docs.datajoint.io/python/community/02-Contribute.html). Please reference the link for more full details.
3+
This project follows the [DataJoint Contribution Guidelines](https://docs.datajoint.io/python/community/02-Contribute.html). Please reference the link for more full details.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fully functional pipeline.
88

99
![diagram](https://raw.githubusercontent.com/datajoint/element-array-ephys/main/images/diagram_flowchart.svg)
1010

11-
Installation and usage instructions can be found at the
11+
Installation and usage instructions can be found at the
1212
[Element documentation](https://datajoint.com/docs/elements/element-array-ephys).

docs/src/api/make_pages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@
4141

4242
with mkdocs_gen_files.open("api/navigation.md", "w") as nav_file:
4343
nav_file.writelines(nav.build_literate_nav())
44-

element_array_ephys/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import datajoint as dj
21
import logging
32
import os
43

4+
import datajoint as dj
5+
6+
from . import ephys_acute as ephys
7+
8+
__all__ = ["ephys", "get_logger"]
59

610
dj.config["enable_python_native_blobs"] = True
711

@@ -10,6 +14,3 @@ def get_logger(name):
1014
log = logging.getLogger(name)
1115
log.setLevel(os.getenv("LOGLEVEL", "INFO"))
1216
return log
13-
14-
15-
from . import ephys_acute as ephys

element_array_ephys/ephys_acute.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import datajoint as dj
1+
import gc
2+
import importlib
3+
import inspect
24
import pathlib
35
import re
4-
import numpy as np
5-
import inspect
6-
import importlib
7-
import gc
86
from decimal import Decimal
9-
import pandas as pd
107

11-
from element_interface.utils import find_root_directory, find_full_path, dict_to_uuid
8+
import datajoint as dj
9+
import numpy as np
10+
import pandas as pd
11+
from element_interface.utils import dict_to_uuid, find_full_path, find_root_directory
1212

13-
from .readers import spikeglx, kilosort, openephys
14-
from . import probe, get_logger, ephys_report
13+
from . import ephys_report, get_logger, probe
14+
from .readers import kilosort, openephys, spikeglx
1515

1616
log = get_logger(__name__)
1717

@@ -127,7 +127,7 @@ class AcquisitionSoftware(dj.Lookup):
127127
"""
128128

129129
definition = """ # Software used for recording of neuropixels probes
130-
acq_software: varchar(24)
130+
acq_software: varchar(24)
131131
"""
132132
contents = zip(["SpikeGLX", "Open Ephys"])
133133

@@ -264,7 +264,7 @@ class EphysRecording(dj.Imported):
264264

265265
definition = """
266266
# Ephys recording from a probe insertion for a given session.
267-
-> ProbeInsertion
267+
-> ProbeInsertion
268268
---
269269
-> probe.ElectrodeConfig
270270
-> AcquisitionSoftware
@@ -465,9 +465,9 @@ class Electrode(dj.Part):
465465

466466
definition = """
467467
-> master
468-
-> probe.ElectrodeConfig.Electrode
468+
-> probe.ElectrodeConfig.Electrode
469469
---
470-
lfp: longblob # (uV) recorded lfp at this electrode
470+
lfp: longblob # (uV) recorded lfp at this electrode
471471
"""
472472

473473
# Only store LFP for every 9th channel, due to high channel density,
@@ -615,7 +615,7 @@ class ClusteringParamSet(dj.Lookup):
615615
# Parameter set to be used in a clustering procedure
616616
paramset_idx: smallint
617617
---
618-
-> ClusteringMethod
618+
-> ClusteringMethod
619619
paramset_desc: varchar(128)
620620
param_set_hash: uuid
621621
unique index (param_set_hash)
@@ -800,7 +800,7 @@ class Clustering(dj.Imported):
800800
# Clustering Procedure
801801
-> ClusteringTask
802802
---
803-
clustering_time: datetime # time of generation of this set of clustering results
803+
clustering_time: datetime # time of generation of this set of clustering results
804804
package_version='': varchar(16)
805805
"""
806806

@@ -925,11 +925,11 @@ class Curation(dj.Manual):
925925
-> Clustering
926926
curation_id: int
927927
---
928-
curation_time: datetime # time of generation of this set of curated clustering results
928+
curation_time: datetime # time of generation of this set of curated clustering results
929929
curation_output_dir: varchar(255) # output directory of the curated results, relative to root data directory
930930
quality_control: bool # has this clustering result undergone quality control?
931931
manual_curation: bool # has manual curation been performed on this clustering result?
932-
curation_note='': varchar(2000)
932+
curation_note='': varchar(2000)
933933
"""
934934

935935
def create1_from_clustering_task(self, key, curation_note=""):
@@ -978,7 +978,7 @@ class CuratedClustering(dj.Imported):
978978

979979
definition = """
980980
# Clustering results of a curation.
981-
-> Curation
981+
-> Curation
982982
"""
983983

984984
class Unit(dj.Part):
@@ -1005,7 +1005,7 @@ class Unit(dj.Part):
10051005
spike_count: int # how many spikes in this recording for this unit
10061006
spike_times: longblob # (s) spike times of this unit, relative to the start of the EphysRecording
10071007
spike_sites : longblob # array of electrode associated with each spike
1008-
spike_depths=null : longblob # (um) array of depths associated with each spike, relative to the (0, 0) of the probe
1008+
spike_depths=null : longblob # (um) array of depths associated with each spike, relative to the (0, 0) of the probe
10091009
"""
10101010

10111011
def make(self, key):
@@ -1131,8 +1131,8 @@ class Waveform(dj.Part):
11311131
# Spike waveforms and their mean across spikes for the given unit
11321132
-> master
11331133
-> CuratedClustering.Unit
1134-
-> probe.ElectrodeConfig.Electrode
1135-
---
1134+
-> probe.ElectrodeConfig.Electrode
1135+
---
11361136
waveform_mean: longblob # (uV) mean waveform across spikes of the given unit
11371137
waveforms=null: longblob # (uV) (spike x sample) waveforms of a sampling of spikes at the given electrode for the given unit
11381138
"""
@@ -1260,7 +1260,7 @@ class QualityMetrics(dj.Imported):
12601260

12611261
definition = """
12621262
# Clusters and waveforms metrics
1263-
-> CuratedClustering
1263+
-> CuratedClustering
12641264
"""
12651265

12661266
class Cluster(dj.Part):
@@ -1285,26 +1285,26 @@ class Cluster(dj.Part):
12851285
contamination_rate (float): Frequency of spikes in the refractory period.
12861286
"""
12871287

1288-
definition = """
1288+
definition = """
12891289
# Cluster metrics for a particular unit
12901290
-> master
12911291
-> CuratedClustering.Unit
12921292
---
1293-
firing_rate=null: float # (Hz) firing rate for a unit
1293+
firing_rate=null: float # (Hz) firing rate for a unit
12941294
snr=null: float # signal-to-noise ratio for a unit
12951295
presence_ratio=null: float # fraction of time in which spikes are present
12961296
isi_violation=null: float # rate of ISI violation as a fraction of overall rate
12971297
number_violation=null: int # total number of ISI violations
12981298
amplitude_cutoff=null: float # estimate of miss rate based on amplitude histogram
12991299
isolation_distance=null: float # distance to nearest cluster in Mahalanobis space
1300-
l_ratio=null: float #
1300+
l_ratio=null: float #
13011301
d_prime=null: float # Classification accuracy based on LDA
13021302
nn_hit_rate=null: float # Fraction of neighbors for target cluster that are also in target cluster
13031303
nn_miss_rate=null: float # Fraction of neighbors outside target cluster that are in target cluster
13041304
silhouette_score=null: float # Standard metric for cluster overlap
13051305
max_drift=null: float # Maximum change in spike depth throughout recording
1306-
cumulative_drift=null: float # Cumulative change in spike depth throughout recording
1307-
contamination_rate=null: float #
1306+
cumulative_drift=null: float # Cumulative change in spike depth throughout recording
1307+
contamination_rate=null: float #
13081308
"""
13091309

13101310
class Waveform(dj.Part):
@@ -1324,7 +1324,7 @@ class Waveform(dj.Part):
13241324
velocity_below (float) inverse velocity of waveform propagation from soma toward the bottom of the probe.
13251325
"""
13261326

1327-
definition = """
1327+
definition = """
13281328
# Waveform metrics for a particular unit
13291329
-> master
13301330
-> CuratedClustering.Unit

0 commit comments

Comments
 (0)