def test_03_manual_resolution_not_latest(self): align_qc = AlignmentQC(self.probe_id, one=one, brain_atlas=brain_atlas, channels=False) align_qc.load_data(prev_alignments=self.traj['json'], xyz_picks=np.array(self.xyz_picks) / 1e6, cluster_chns=self.cluster_chns) align_qc.resolve_manual('2020-09-28T10:03:06_alejandro', update=True, upload_alyx=True, upload_flatiron=False, force=True) insertion = one.alyx.rest('insertions', 'read', id=self.probe_id) assert (insertion['json']['qc'] == 'NOT_SET') assert (insertion['json']['extended_qc']['alignment_count'] == 3) assert (insertion['json']['extended_qc']['alignment_stored'] == '2020-09-28T10:03:06_alejandro') assert (insertion['json']['extended_qc']['alignment_resolved'] == 1) assert (insertion['json']['extended_qc']['alignment_resolved_by'] == 'experimenter') assert (insertion['json']['extended_qc']['alignment_qc'] < 0.8) assert (np.isclose(insertion['json']['extended_qc']['alignment_qc'], 0.604081)) traj = one.alyx.rest('trajectories', 'list', probe_id=self.probe_id, provenance='Ephys aligned histology track') assert (self.prev_traj_id != traj[0]['id'])
def setUpClass(cls) -> None: data = np.load(Path( Path(__file__).parent.parent.joinpath( 'fixtures', 'qc', 'data_alignmentqc_manual.npz')), allow_pickle=True) cls.xyz_picks = (data['xyz_picks'] * 1e6).tolist() cls.alignments = data['alignments'].tolist() cls.cluster_chns = data['cluster_chns'] data = np.load(Path( Path(__file__).parent.parent.joinpath( 'fixtures', 'qc', 'data_alignmentqc_existing.npz')), allow_pickle=True) insertion = data['insertion'].tolist() insertion['json'] = {'xyz_picks': cls.xyz_picks} probe_insertion = one.alyx.rest('insertions', 'create', data=insertion) cls.probe_id = probe_insertion['id'] cls.probe_name = probe_insertion['name'] cls.trajectory = data['trajectory'].tolist() cls.trajectory.update({'probe_insertion': cls.probe_id}) cls.trajectory.update({'json': cls.alignments}) cls.traj = one.alyx.rest('trajectories', 'create', data=cls.trajectory) align_qc = AlignmentQC(cls.probe_id, one=one, brain_atlas=brain_atlas, channels=False) align_qc.load_data(prev_alignments=cls.traj['json'], xyz_picks=np.array(cls.xyz_picks) / 1e6, cluster_chns=cls.cluster_chns) cls.file_paths = align_qc.resolve_manual('2020-09-28T15:57:25_mayo', update=True, upload_alyx=True, upload_flatiron=True) print(cls.file_paths)
def _02_manual_resolution_latest(self): align_qc = AlignmentQC(self.probe_id, one=one, brain_atlas=brain_atlas, channels=False) align_qc.load_data(prev_alignments=self.traj['json'], xyz_picks=np.array(self.xyz_picks) / 1e6, cluster_chns=self.cluster_chns, depths=SITES_COORDINATES[:, 1], chn_coords=SITES_COORDINATES) align_qc.resolve_manual('2020-09-28T15:57:25_mayo', update=True, upload_alyx=True, upload_flatiron=False) _verify(self, alignment_resolved='experimenter', alignment_stored='2020-09-28T15:57:25_mayo', alignment_count=3, trajectory_created=False, alignment_qc=0.604081)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 28 08:57:24 2020 @author: guido """ from oneibl.one import ONE one = ONE() probe_id = one.alyx.rest('insertions', 'list', subject='SWC_014', date='2019-12-10', name='probe01')[0]['id'] traj = one.alyx.rest('trajectories', 'list', probe_insertion=probe_id, provenance='Ephys aligned histology track')[0] alignment_keys = traj['json'].keys() print(alignment_keys) from ibllib.qc.alignment_qc import AlignmentQC align_key = "2020-06-15T10:03:50_guido" # change this to your chosen alignment key align_qc = AlignmentQC(probe_id, one=one) align_qc.resolve_manual(align_key) from oneibl.one import ONE one = ONE() probe_id = one.alyx.rest('insertions', 'list', subject='SWC_014', date='2019-12-10', name='probe01')[0]['id'] align_key = '2020-06-15T10:03:50_guido' from ibllib.qc.alignment_qc import AlignmentQC align_qc = AlignmentQC(probe_id, one=one) align_qc.resolve_manual(align_key, force=True)