Skip to content

Commit b0011a1

Browse files
author
Thinh Nguyen
committed
minor code cleanup
1 parent 6859e52 commit b0011a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

elements_ephys/ephys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,15 @@ def create1_from_clustering_task(self, key, curation_note=''):
401401
"""
402402
A convenient function to create a new corresponding "Curation" for a particular "ClusteringTask"
403403
"""
404-
if not len(Clustering & key):
404+
if key not in Clustering():
405405
raise ValueError(f'No corresponding entry in Clustering available for: {key}; do `Clustering.populate(key)`')
406406

407407
root_dir = pathlib.Path(get_ephys_root_data_dir())
408408
task_mode, output_dir = (ClusteringTask & key).fetch1('task_mode', 'clustering_output_dir')
409409
ks_dir = root_dir / output_dir
410410
creation_time, is_curated, is_qc = kilosort.extract_clustering_info(ks_dir)
411411
# Synthesize curation_id
412-
curation_id = (dj.U().aggr(self & key, n='max(curation_id)').fetch1('n') or 0) + 1
412+
curation_id = dj.U().aggr(self & key, n='ifnull(max(curation_id)+1,1)').fetch1('n')
413413
self.insert1({**key, 'curation_id': curation_id,
414414
'curation_time': creation_time, 'curation_output_dir': output_dir,
415415
'quality_control': is_qc, 'manual_curation': is_curated,

0 commit comments

Comments
 (0)