Skip to content

Commit d153f70

Browse files
committed
alignment qc takes argument probe collection to know where to save the resolved channels and cluster files
1 parent 2a194e7 commit d153f70

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ibllib/qc/alignment_qc.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AlignmentQC(base.QC):
2020
Class that is used to update the extended_qc of the probe insertion fields with the results
2121
from the ephys alignment procedure
2222
"""
23-
def __init__(self, probe_id, one=None, brain_atlas=None, channels=True):
23+
def __init__(self, probe_id, one=None, brain_atlas=None, channels=True, collection=None):
2424
super().__init__(probe_id, one=one, log=_log, endpoint='insertions')
2525

2626
# Data
@@ -43,6 +43,8 @@ def __init__(self, probe_id, one=None, brain_atlas=None, channels=True):
4343
self.resolved = (self.insertion.get('json', {'temp': 0}).get('extended_qc').
4444
get('alignment_resolved', False))
4545

46+
self.probe_collection = collection
47+
4648
def load_data(self, prev_alignments=None, xyz_picks=None, depths=None, cluster_chns=None):
4749
""""
4850
Load data required to assess alignment qc and compute similarity matrix. If no arguments
@@ -76,11 +78,17 @@ def load_data(self, prev_alignments=None, xyz_picks=None, depths=None, cluster_c
7678
else:
7779
self.depths = depths
7880

81+
if not self.probe_collection:
82+
all_collections = self.one.list_collections(self.insertion['session'])
83+
if f'alf/{self.insertion["name"]}/pykilosort' in all_collections:
84+
self.probe_collection = f'alf/{self.insertion["name"]}/pykilosort'
85+
else:
86+
self.probe_collection = f'alf/{self.insertion["name"]}'
87+
7988
if not np.any(cluster_chns):
8089
self.cluster_chns = self.one.load_dataset(self.insertion['session'],
8190
'clusters.channels.npy',
82-
collection=f'alf/{self.insertion["name"]}',
83-
download_only=True)
91+
collection=self.probe_collection)
8492
else:
8593
self.cluster_chns = cluster_chns
8694

@@ -281,7 +289,7 @@ def upload_channels(self, alignment_key, upload_alyx, upload_flatiron):
281289
if upload_flatiron:
282290
ftp_patcher = FTPPatcher(one=self.one)
283291
insertion = self.one.alyx.get(f'/insertions/{self.eid}', clobber=True)
284-
alf_path = self.one.eid2path(insertion['session']).joinpath('alf', insertion['name'])
292+
alf_path = self.one.eid2path(insertion['session']).joinpath(self.probe_collection)
285293
alf_path.mkdir(exist_ok=True, parents=True)
286294

287295
# Make the channels.mlapdv dataset

0 commit comments

Comments
 (0)