@@ -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 ()})
0 commit comments