def addContainer(self, file): table = ElectrodeTable('electrodes') dev1 = Device('dev1', 'a test source') group = ElectrodeGroup('tetrode1', 'a test source', 'tetrode description', 'tetrode location', dev1) table.add_row(1, 1.0, 2.0, 3.0, -1.0, 'CA1', 'none', 'first channel of tetrode', group) table.add_row(2, 1.0, 2.0, 3.0, -2.0, 'CA1', 'none', 'second channel of tetrode', group) table.add_row(3, 1.0, 2.0, 3.0, -3.0, 'CA1', 'none', 'third channel of tetrode', group) table.add_row(4, 1.0, 2.0, 3.0, -4.0, 'CA1', 'none', 'fourth channel of tetrode', group) file.set_device(dev1) file.set_electrode_group(group) file.set_electrode_table(table) region = ElectrodeTableRegion( table, [0, 2], 'the first and third electrodes') # noqa: F405 data = list(zip(range(10), range(10, 20))) timestamps = list(range(10)) es = ElectricalSeries('test_eS', 'a hypothetical source', data, region, timestamps=timestamps) file.add_acquisition(es) return es
def addContainer(self, file): dev1 = Device('dev1', 'a test source') file.set_device(dev1) eg = ElectrodeGroup('elec1', 'a test source', 'a test ElectrodeGroup', 'a nonexistent place', dev1) file.set_electrode_group(eg) return eg
def setUp(self) -> None: data1 = np.array([1, 2, 2, 3, 1, 1, 3, 2, 3]) data2 = np.array([3, 4, 2, 4, 3, 2, 2, 4, 4]) device = Device(name="device") eg_1 = ElectrodeGroup(name="electrodegroup1", description="desc", location="brain", device=device) eg_2 = ElectrodeGroup(name="electrodegroup2", description="desc", location="brain", device=device) data3 = [eg_1, eg_2, eg_1, eg_1, eg_1, eg_1, eg_1, eg_1, eg_1] vd1 = VectorData("Data1", "vector data for creating a DynamicTable", data=data1) vd2 = VectorData("Data2", "vector data for creating a DynamicTable", data=data2) vd3 = VectorData("ElectrodeGroup", "vector data for creating a DynamicTable", data=data3) vd = [vd1, vd2, vd3] self.dynamic_table = DynamicTable( name="test table", description="This is a test table", columns=vd, colnames=["Data1", "Data2", "ElectrodeGroup"], )
def test_create_electrode_group(self): name = 'example_electrode_group' desc = 'An example electrode' loc = 'an example location' d = Device('a fake device', 'a fake source') elecgrp = self.nwbfile.create_electrode_group(name, 'a fake source', desc, loc, d) self.assertEqual(elecgrp.description, desc) self.assertEqual(elecgrp.location, loc) self.assertIs(elecgrp.device, d)
def test_init(self): device = Device('name') oS = OptogeneticStimulusSite('site1', device, 'description', 300., 'location') self.assertEqual(oS.name, 'site1') self.assertEqual(oS.device, device) self.assertEqual(oS.description, 'description') self.assertEqual(oS.excitation_lambda, 300.) self.assertEqual(oS.location, 'location') iS = OptogeneticSeries('test_iS', list(), oS, timestamps=list()) self.assertEqual(iS.name, 'test_iS') self.assertEqual(iS.unit, 'watts') self.assertEqual(iS.site, oS)
def test_init(self): device = Device('name') oS = OptogeneticStimulusSite(name='site1', device=device, description='description', excitation_lambda=300., location='location') self.assertEqual(oS.name, 'site1') self.assertEqual(oS.device, device) self.assertEqual(oS.description, 'description') self.assertEqual(oS.excitation_lambda, 300.) self.assertEqual(oS.location, 'location') iS = OptogeneticSeries(name='test_iS', data=[1, 2, 3], site=oS, timestamps=[0.1, 0.2, 0.3]) self.assertEqual(iS.name, 'test_iS') self.assertEqual(iS.unit, 'watts') self.assertEqual(iS.site, oS)
def test_init(self): device = Device('name', 'source') oS = OptogeneticStimulusSite('site1', 'a test source', device, 'description', 'excitation_lambda', 'location') self.assertEqual(oS.name, 'site1') self.assertEqual(oS.device, device) self.assertEqual(oS.description, 'description') self.assertEqual(oS.excitation_lambda, 'excitation_lambda') self.assertEqual(oS.location, 'location') iS = OptogeneticSeries('test_iS', 'a hypothetical source', list(), oS, timestamps=list()) self.assertEqual(iS.name, 'test_iS') self.assertEqual(iS.source, 'a hypothetical source') self.assertEqual(iS.unit, 'Watt') self.assertEqual(iS.site, oS)