Example #1
0
 def test_create_alyx_probe_insertions(self):
     # Connect to test DB
     one = ONE(username='******',
               password='******',
               base_url='https://test.alyx.internationalbrainlab.org')
     # Use existing session on test database
     eid = 'b1c968ad-4874-468d-b2e4-5ffa9b9964e9'
     # Force probe insertion 3A
     misc.create_alyx_probe_insertions(eid,
                                       one=one,
                                       model='3A',
                                       labels=['probe00', 'probe01'])
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest('insertions', 'list', session=eid)
     self.assertTrue(alyx_insertion[0]['model'] == '3A')
     self.assertTrue(alyx_insertion[0]['name'] in ['probe00', 'probe01'])
     self.assertTrue(alyx_insertion[1]['model'] == '3A')
     self.assertTrue(alyx_insertion[1]['name'] in ['probe00', 'probe01'])
     # Cleanup DB
     one.alyx.rest('insertions', 'delete', id=alyx_insertion[0]['id'])
     one.alyx.rest('insertions', 'delete', id=alyx_insertion[1]['id'])
     # Force probe insertion 3B
     misc.create_alyx_probe_insertions(eid,
                                       one=one,
                                       model='3B2',
                                       labels=['probe00', 'probe01'])
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest('insertions', 'list', session=eid)
     self.assertTrue(alyx_insertion[0]['model'] == '3B2')
     self.assertTrue(alyx_insertion[0]['name'] in ['probe00', 'probe01'])
     self.assertTrue(alyx_insertion[1]['model'] == '3B2')
     self.assertTrue(alyx_insertion[1]['name'] in ['probe00', 'probe01'])
     # Cleanup DB
     one.alyx.rest('insertions', 'delete', id=alyx_insertion[0]['id'])
     one.alyx.rest('insertions', 'delete', id=alyx_insertion[1]['id'])
Example #2
0
 def test_create_alyx_probe_insertions(self):
     # Connect to test DB
     one = ONE(
         username="******",
         password="******",
         base_url="https://test.alyx.internationalbrainlab.org",
     )
     # Use existing session on test database
     eid = "b1c968ad-4874-468d-b2e4-5ffa9b9964e9"
     # Force probe insertion 3A
     misc.create_alyx_probe_insertions(
         eid, one=one, model="3A", labels=["probe00", "probe01"], force=True
     )
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest("insertions", "list", session=eid)
     self.assertTrue(alyx_insertion[0]["model"] == "3A")
     self.assertTrue(alyx_insertion[0]["name"] in ["probe00", "probe01"])
     self.assertTrue(alyx_insertion[1]["model"] == "3A")
     self.assertTrue(alyx_insertion[1]["name"] in ["probe00", "probe01"])
     # Cleanup DB
     one.alyx.rest("insertions", "delete", id=alyx_insertion[0]["id"])
     one.alyx.rest("insertions", "delete", id=alyx_insertion[1]["id"])
     # Force probe insertion 3B
     misc.create_alyx_probe_insertions(eid, one=one, model="3B2", labels=["probe00", "probe01"])
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest("insertions", "list", session=eid)
     self.assertTrue(alyx_insertion[0]["model"] == "3B2")
     self.assertTrue(alyx_insertion[0]["name"] in ["probe00", "probe01"])
     self.assertTrue(alyx_insertion[1]["model"] == "3B2")
     self.assertTrue(alyx_insertion[1]["name"] in ["probe00", "probe01"])
     # Cleanup DB
     one.alyx.rest("insertions", "delete", id=alyx_insertion[0]["id"])
     one.alyx.rest("insertions", "delete", id=alyx_insertion[1]["id"])
 def setUpClass(cls) -> None:
     probe = ['probe00', 'probe01']
     create_alyx_probe_insertions(session_path=EPHYS_SESSION,
                                  model='3B2',
                                  labels=probe,
                                  one=one,
                                  force=True)
     cls.probe_id = one.alyx.rest('insertions',
                                  'list',
                                  session=EPHYS_SESSION,
                                  name='probe00')[0]['id']
     cls.probe_id2 = one.alyx.rest('insertions',
                                   'list',
                                   session=EPHYS_SESSION,
                                   name='probe01')[0]['id']
     data = np.load(Path(
         Path(__file__).parent.joinpath('fixtures',
                                        'data_alignmentqc_gui.npz')),
                    allow_pickle=True)
     cls.xyz_picks = data['xyz_picks']
     cls.alignments = data['alignments'].tolist()
     cls.cluster_chns = data['cluster_chns']
     register_track(cls.probe_id,
                    picks=cls.xyz_picks,
                    one=one,
                    overwrite=True,
                    channels=False)
     register_track(cls.probe_id2,
                    picks=cls.xyz_picks,
                    one=one,
                    overwrite=True,
                    channels=False)
Example #4
0
    def test_creation(self):
        probe = ['probe00', 'probe01']
        create_alyx_probe_insertions(session_path=EPHYS_SESSION, model='3B2', labels=probe,
                                     one=one, force=True)
        insertion = one.alyx.rest('insertions', 'list', session=EPHYS_SESSION)
        assert(len(insertion) == 2)
        assert (insertion[0]['json']['qc'] == 'NOT_SET')
        assert (len(insertion[0]['json']['extended_qc']) == 0)

        one.alyx.rest('insertions', 'delete', id=insertion[0]['id'])
        one.alyx.rest('insertions', 'delete', id=insertion[1]['id'])
Example #5
0
 def setUpClass(cls) -> None:
     probe = ['probe00', 'probe01']
     create_alyx_probe_insertions(session_path=EPHYS_SESSION, model='3B2', labels=probe,
                                  one=one, force=True)
     cls.probe00_id = one.alyx.rest('insertions', 'list', session=EPHYS_SESSION,
                                    name='probe00')[0]['id']
     cls.probe01_id = one.alyx.rest('insertions', 'list', session=EPHYS_SESSION,
                                    name='probe01')[0]['id']
     data = np.load(Path(Path(__file__).parent.parent.
                         joinpath('fixtures', 'qc', 'data_alignmentqc_existing.npz')),
                    allow_pickle=True)
     cls.xyz_picks = np.array(data['xyz_picks']) / 1e6
Example #6
0
 def test_create_alyx_probe_insertions(self):
     # Connect to test DB
     one = ONE(**TEST_DB)
     # Use existing session on test database
     eid = "b1c968ad-4874-468d-b2e4-5ffa9b9964e9"
     # Force probe insertion 3A
     misc.create_alyx_probe_insertions(eid,
                                       one=one,
                                       model="3A",
                                       labels=["probe00", "probe01"],
                                       force=True)
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest("insertions",
                                    "list",
                                    session=eid,
                                    no_cache=True)
     alyx_insertion = [x for x in alyx_insertion if x["model"] == "3A"]
     self.assertTrue(alyx_insertion[0]["model"] == "3A")
     self.assertTrue(alyx_insertion[0]["name"] in ["probe00", "probe01"])
     self.assertTrue(alyx_insertion[1]["model"] == "3A")
     self.assertTrue(alyx_insertion[1]["name"] in ["probe00", "probe01"])
     # Cleanup DB
     one.alyx.rest("insertions", "delete", id=alyx_insertion[0]["id"])
     one.alyx.rest("insertions", "delete", id=alyx_insertion[1]["id"])
     # Force probe insertion 3B
     misc.create_alyx_probe_insertions(eid,
                                       one=one,
                                       model="3B2",
                                       labels=["probe00", "probe01"])
     # Verify it's been inserted
     alyx_insertion = one.alyx.rest("insertions",
                                    "list",
                                    session=eid,
                                    no_cache=True)
     self.assertTrue(alyx_insertion[0]["model"] == "3B2")
     self.assertTrue(alyx_insertion[0]["name"] in ["probe00", "probe01"])
     self.assertTrue(alyx_insertion[1]["model"] == "3B2")
     self.assertTrue(alyx_insertion[1]["name"] in ["probe00", "probe01"])
     # Cleanup DB
     one.alyx.rest("insertions", "delete", id=alyx_insertion[0]["id"])
     one.alyx.rest("insertions", "delete", id=alyx_insertion[1]["id"])
Example #7
0
 def setUpClass(cls) -> None:
     probe = [
         ''.join(random.choices(string.ascii_letters, k=5)),
         ''.join(random.choices(string.ascii_letters, k=5))
     ]
     ins = create_alyx_probe_insertions(session_path=EPHYS_SESSION,
                                        model='3B2',
                                        labels=probe,
                                        one=one,
                                        force=True)
     cls.probe00_id, cls.probe01_id = (x['id'] for x in ins)
     data = np.load(Path(
         Path(__file__).parent.parent.joinpath(
             'fixtures', 'qc', 'data_alignmentqc_existing.npz')),
                    allow_pickle=True)
     cls.xyz_picks = np.array(data['xyz_picks']) / 1e6