def test__children(self):
        blk = Block(name="a block")
        blk.recordingchannelgroups = self.rcg
        blk.segments = self.seg
        blk.create_many_to_one_relationship()

        self.assertEqual(blk._container_child_objects, ("Segment", "RecordingChannelGroup"))
        self.assertEqual(blk._data_child_objects, ())
        self.assertEqual(blk._single_parent_objects, ())
        self.assertEqual(blk._multi_child_objects, ())
        self.assertEqual(blk._multi_parent_objects, ())
        self.assertEqual(blk._child_properties, ("Unit", "RecordingChannel"))

        self.assertEqual(blk._single_child_objects, ("Segment", "RecordingChannelGroup"))

        self.assertEqual(blk._container_child_containers, ("segments", "recordingchannelgroups"))
        self.assertEqual(blk._data_child_containers, ())
        self.assertEqual(blk._single_child_containers, ("segments", "recordingchannelgroups"))
        self.assertEqual(blk._single_parent_containers, ())
        self.assertEqual(blk._multi_child_containers, ())
        self.assertEqual(blk._multi_parent_containers, ())

        self.assertEqual(blk._child_objects, ("Segment", "RecordingChannelGroup"))
        self.assertEqual(blk._child_containers, ("segments", "recordingchannelgroups"))
        self.assertEqual(blk._parent_objects, ())
        self.assertEqual(blk._parent_containers, ())

        self.assertEqual(blk.parents, ())
        self.assertEqual(len(blk.children), len(self.seg) + len(self.rcg))
        self.assertEqual(blk.children[0].name, self.segnames[0])
        self.assertEqual(blk.children[1].name, self.segnames[1])
        self.assertEqual(blk.children[2].name, self.segnames[2])
        self.assertEqual(blk.children[3].name, self.segnames[3])
        self.assertEqual(blk.children[4].name, self.rcgnames[0])
        self.assertEqual(blk.children[5].name, self.rcgnames[1])
Exemple #2
0
    def test_block_list_units(self):
        blk = Block(name='a block')
        blk.recordingchannelgroups = [self.rcg1, self.rcg2]
        blk.create_many_to_one_relationship()
        #assert_neo_object_is_compliant(blk)

        unitres1 = [unit.name for unit in blk.recordingchannelgroups[0].units]
        unitres2 = [unit.name for unit in blk.recordingchannelgroups[1].units]
        unitres = [unit.name for unit in blk.list_units]

        self.assertEqual(self.unitnames1, unitres1)
        self.assertEqual(self.unitnames2, unitres2)
        self.assertEqual(self.unitnames, unitres)
    def test_block_list_units(self):
        blk = Block(name="a block")
        blk.recordingchannelgroups = [self.rcg1, self.rcg2]
        blk.create_many_to_one_relationship()
        # assert_neo_object_is_compliant(blk)

        unitres1 = [unit.name for unit in blk.recordingchannelgroups[0].units]
        unitres2 = [unit.name for unit in blk.recordingchannelgroups[1].units]
        unitres = [unit.name for unit in blk.list_units]

        self.assertEqual(self.unitnames1, unitres1)
        self.assertEqual(self.unitnames2, unitres2)
        self.assertEqual(self.unitnames, unitres)
    def test_block_list_recordingchannel(self):
        blk = Block(name="a block")
        blk.recordingchannelgroups = [self.rcg1, self.rcg2]
        blk.create_many_to_one_relationship()
        # assert_neo_object_is_compliant(blk)

        chanres1 = [chan.name for chan in blk.recordingchannelgroups[0].recordingchannels]
        chanres2 = [chan.name for chan in blk.recordingchannelgroups[1].recordingchannels]
        chanres = [chan.name for chan in blk.list_recordingchannels]

        self.assertEqual(self.channames1, chanres1)
        self.assertEqual(self.channames2, chanres2)
        self.assertEqual(self.channames, chanres)
Exemple #5
0
    def test_block_list_recordingchannel(self):
        blk = Block(name='a block')
        blk.recordingchannelgroups = [self.rcg1, self.rcg2]
        blk.create_many_to_one_relationship()
        #assert_neo_object_is_compliant(blk)

        chanres1 = [chan.name for chan in
                    blk.recordingchannelgroups[0].recordingchannels]
        chanres2 = [chan.name for chan in
                    blk.recordingchannelgroups[1].recordingchannels]
        chanres = [chan.name for chan in blk.list_recordingchannels]

        self.assertEqual(self.channames1, chanres1)
        self.assertEqual(self.channames2, chanres2)
        self.assertEqual(self.channames, chanres)
Exemple #6
0
 def __init__(self, parameters, full_datastore, replace=False):
     ParametrizedObject.__init__(self, parameters)
     # we will hold the recordings as one neo Block
     self.block = Block()
     self.analysis_results = []
     self.replace = replace
     self.sensory_stimulus = collections.OrderedDict()
     self.full_datastore = full_datastore  # should be self if actually the
Exemple #7
0
    def test_block_merge(self):
        blk1 = Block(name='block 1')
        blk2 = Block(name='block 2')

        rcg3 = RecordingChannelGroup(name=self.rcgname1)
        rcg3.units = self.units1 + [self.units2[0]]
        rcg3.recordingchannels = self.chan1 + [self.chan2[1]]

        blk1.recordingchannelgroups = [self.rcg1]
        blk2.recordingchannelgroups = [self.rcg2, rcg3]
        blk1.segments = self.seg1
        blk2.segments = self.seg2

        blk1.merge(blk2)

        rcgres1 = [rcg.name for rcg in blk1.recordingchannelgroups]
        rcgres2 = [rcg.name for rcg in blk2.recordingchannelgroups]

        segres1 = [seg.name for seg in blk1.segments]
        segres2 = [seg.name for seg in blk2.segments]

        chanres1 = [chan.name for chan in blk1.list_recordingchannels]
        chanres2 = [chan.name for chan in blk2.list_recordingchannels]

        unitres1 = [unit.name for unit in blk1.list_units]
        unitres2 = [unit.name for unit in blk2.list_units]

        self.assertEqual(rcgres1, [self.rcgname1, self.rcgname2])
        self.assertEqual(rcgres2, [self.rcgname2, self.rcgname1])

        self.assertEqual(segres1, self.segnames)
        self.assertEqual(segres2, self.segnames2)

        self.assertEqual(chanres1, self.channames1 + self.channames2[-2::-1])
        self.assertEqual(chanres2, self.channames2[:-1] + self.channames1)

        self.assertEqual(unitres1, self.unitnames)
        self.assertEqual(unitres2, self.unitnames2[:-1] + self.unitnames1)
    def test_block_merge(self):
        blk1 = Block(name="block 1")
        blk2 = Block(name="block 2")

        rcg3 = RecordingChannelGroup(name=self.rcgname1)
        rcg3.units = self.units1 + [self.units2[0]]
        rcg3.recordingchannels = self.chan1 + [self.chan2[1]]

        blk1.recordingchannelgroups = [self.rcg1]
        blk2.recordingchannelgroups = [self.rcg2, rcg3]
        blk1.segments = self.seg1
        blk2.segments = self.seg2

        blk1.merge(blk2)

        rcgres1 = [rcg.name for rcg in blk1.recordingchannelgroups]
        rcgres2 = [rcg.name for rcg in blk2.recordingchannelgroups]

        segres1 = [seg.name for seg in blk1.segments]
        segres2 = [seg.name for seg in blk2.segments]

        chanres1 = [chan.name for chan in blk1.list_recordingchannels]
        chanres2 = [chan.name for chan in blk2.list_recordingchannels]

        unitres1 = [unit.name for unit in blk1.list_units]
        unitres2 = [unit.name for unit in blk2.list_units]

        self.assertEqual(rcgres1, [self.rcgname1, self.rcgname2])
        self.assertEqual(rcgres2, [self.rcgname2, self.rcgname1])

        self.assertEqual(segres1, self.segnames)
        self.assertEqual(segres2, self.segnames2)

        self.assertEqual(chanres1, self.channames1 + self.channames2[-2::-1])
        self.assertEqual(chanres2, self.channames2[:-1] + self.channames1)

        self.assertEqual(unitres1, self.unitnames)
        self.assertEqual(unitres2, self.unitnames2[:-1] + self.unitnames1)
Exemple #9
0
    def test__children(self):
        blk = Block(name='a block')
        blk.recordingchannelgroups = self.rcg
        blk.segments = self.seg
        blk.create_many_to_one_relationship()

        self.assertEqual(blk._container_child_objects,
                         ('Segment', 'RecordingChannelGroup'))
        self.assertEqual(blk._data_child_objects, ())
        self.assertEqual(blk._single_parent_objects, ())
        self.assertEqual(blk._multi_child_objects, ())
        self.assertEqual(blk._multi_parent_objects, ())
        self.assertEqual(blk._child_properties, ('Unit', 'RecordingChannel'))

        self.assertEqual(blk._single_child_objects,
                         ('Segment', 'RecordingChannelGroup'))

        self.assertEqual(blk._container_child_containers,
                         ('segments', 'recordingchannelgroups'))
        self.assertEqual(blk._data_child_containers, ())
        self.assertEqual(blk._single_child_containers,
                         ('segments', 'recordingchannelgroups'))
        self.assertEqual(blk._single_parent_containers, ())
        self.assertEqual(blk._multi_child_containers, ())
        self.assertEqual(blk._multi_parent_containers, ())

        self.assertEqual(blk._child_objects,
                         ('Segment', 'RecordingChannelGroup'))
        self.assertEqual(blk._child_containers,
                         ('segments', 'recordingchannelgroups'))
        self.assertEqual(blk._parent_objects, ())
        self.assertEqual(blk._parent_containers, ())

        self.assertEqual(blk.parents, ())
        self.assertEqual(len(blk.children), len(self.seg) + len(self.rcg))
        self.assertEqual(blk.children[0].name, self.segnames[0])
        self.assertEqual(blk.children[1].name, self.segnames[1])
        self.assertEqual(blk.children[2].name, self.segnames[2])
        self.assertEqual(blk.children[3].name, self.segnames[3])
        self.assertEqual(blk.children[4].name, self.rcgnames[0])
        self.assertEqual(blk.children[5].name, self.rcgnames[1])
 def test_block_init(self):
     blk = Block(name='a block')
     assert_neo_object_is_compliant(blk)
     self.assertEqual(blk.name, 'a block')
     self.assertEqual(blk.file_origin, None)
Exemple #11
0
 def test_init(self):
     b = Block(name='a block')
     self.assertEqual(b.name, 'a block')
     self.assertEqual(b.file_origin, None)