Skip to content

Commit 886a660

Browse files
committed
change chronic registration to read in channels
1 parent 831ef16 commit 886a660

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

ibllib/pipes/histology.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,22 @@ def register_chronic_track(chronic_id, picks=None, one=None, overwrite=False, ch
237237
:return:
238238
"""
239239
assert one
240-
brain_locations, insertion_histology = register_track(chronic_id, picks=picks, one=one, overwrite=overwrite,
241-
channels=channels, brain_atlas=brain_atlas,
242-
endpoint='chronic-insertions')
243-
244-
# Update all the associated probe insertions with the relevant QC and xyz_picks
245240
chronic = one.alyx.rest('chronic-insertions', 'list', id=chronic_id)[0]
246241
for probe_id in chronic['probe_insertion']:
247242
pid = probe_id['id']
248-
if picks is None or picks.size == 0:
249-
hist_qc = base.QC(pid, one=one, endpoint='insertions')
250-
hist_qc.update_extended_qc({'tracing_exists': False})
251-
hist_qc.update('CRITICAL', namespace='tracing')
252-
else:
253-
one.alyx.json_field_update(endpoint='insertions', uuid=pid, field_name='json',
254-
data={'xyz_picks': np.int32(picks * 1e6).tolist()})
255-
# Update the insertion qc to register tracing exits
256-
hist_qc = base.QC(pid, one=one, endpoint='insertions')
257-
hist_qc.update_extended_qc({'tracing_exists': True})
243+
brain_locations, insertion_histology = register_track(pid, picks=picks, one=one, overwrite=overwrite,
244+
channels=channels, brain_atlas=brain_atlas)
245+
246+
if picks is None or picks.size == 0:
247+
hist_qc = base.QC(chronic_id, one=one, endpoint='chronic-insertions')
248+
hist_qc.update_extended_qc({'tracing_exists': False})
249+
hist_qc.update('CRITICAL', namespace='tracing')
250+
else:
251+
one.alyx.json_field_update(endpoint='chronic-insertions', uuid=chronic_id, field_name='json',
252+
data={'xyz_picks': np.int32(picks * 1e6).tolist()})
253+
# Update the insertion qc to register tracing exits
254+
hist_qc = base.QC(chronic_id, one=one, endpoint='chronic-insertions')
255+
hist_qc.update_extended_qc({'tracing_exists': True})
258256

259257
return brain_locations, insertion_histology
260258

@@ -291,7 +289,14 @@ def register_track(probe_id, picks=None, one=None, overwrite=False, channels=Tru
291289
insertion_histology = None
292290
# Here need to change the track qc to critical and also extended qc to zero
293291
else:
294-
brain_locations, insertion_histology = get_brain_regions(picks, brain_atlas=brain_atlas)
292+
try:
293+
eid, pname = one.pid2eid(probe_id)
294+
chan_pos = one.load_dataset(eid, 'channels.localCoordinates.npy', collection=f'alf/{pname}/pykilosort')
295+
except Exception:
296+
chan_pos = None
297+
298+
brain_locations, insertion_histology = get_brain_regions(picks, channels_positions=chan_pos,
299+
brain_atlas=brain_atlas)
295300
# 1) update the alyx models, first put the picked points in the insertion json
296301
one.alyx.json_field_update(endpoint=endpoint, uuid=probe_id, field_name='json',
297302
data={'xyz_picks': np.int32(picks * 1e6).tolist()})

ibllib/plots/figures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,11 @@ def dlc_qc_plot(session_path, one=None, device_collection='raw_video_data',
785785
# Load session level data
786786
for alf_object in ['trials', 'wheel', 'licks']:
787787
try:
788-
data[f'{alf_object}'] = alfio.load_object(session_path.joinpath(trials_collection), alf_object) # load locally
788+
if alf_object == 'licks':
789+
data[f'{alf_object}'] = alfio.load_object(session_path.joinpath('alf'),
790+
alf_object) # load locally
791+
else:
792+
data[f'{alf_object}'] = alfio.load_object(session_path.joinpath(trials_collection), alf_object) # load locally
789793
continue
790794
except ALFObjectNotFound:
791795
pass

0 commit comments

Comments
 (0)