コード例 #1
0
 def test_units_property_mutation(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         units = group.units
         u = units[5]
         units[5] = u + 20
         self.assertEqual(u, group.units[5])
コード例 #2
0
 def test_get_channel_group(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         self.assertEqual("Group 1", group.name)
         self.assertRaises(KeyError, f.get_channel_group, 5)
         group = f.get_channel_group("Group 1")
         self.assertRaises(KeyError, f.get_channel_group, "Group 2")
         self.assertEqual(183, len(group.channels))
コード例 #3
0
 def test_description(self):
     with open_sample(samples.brw, "r") as f:
         descr = f.description
     self.assertIs(str, type(descr), "Description should be of type str.")
     with open_sample_copy(samples.brw) as f:
         f.description = "BRW-File Level3 - Hi, I'm Elfo"
         descr = f.description
     with open_sample_copy(samples.bxr) as f:
         f.description = "BXR-File Level2 - Hi, I'm Elfo"
         descr = f.description
     self.assertEqual(descr, "BXR-File Level2 - Hi, I'm Elfo")
コード例 #4
0
 def test_recording_vars(self):
     with open_sample(samples.bxr, "r") as f:
         vars = (
             "BitDepth",
             "ExperimentType",
             "MaxVolt",
             "MinVolt",
             "NRecFrames",
             "SamplingRate",
             "SignalInversion",
         )
         values = (12, 0, 4125.0, -4125.0, 8028300, 17855.5020, 1.0)
         props = (
             "bit_depth",
             "experiment_type",
             "max_volt",
             "min_volt",
             "n_frames",
             "sampling_rate",
             "signal_inversion",
             "duration",
         )
         prop_values = (12, 0, 4125.0, -4125.0, 8028300, 17855.5020, 1.0,
                        449.6261)
         for var, value in zip(vars, values):
             with self.subTest(recording_variable=var):
                 if type(value) is float:
                     self.assertAlmostEqual(value,
                                            f.get_recording_variable(var),
                                            places=3)
                 else:
                     self.assertEqual(value, f.get_recording_variable(var))
         for prop, value in zip(props, prop_values):
             with self.subTest(property=prop):
                 if type(value) is float:
                     self.assertAlmostEqual(value,
                                            getattr(f, prop),
                                            places=3)
                 else:
                     self.assertEqual(value, getattr(f, prop))
コード例 #5
0
 def test_visible_property(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         self.assertIs(True, group.visible)
コード例 #6
0
 def test_units_property(self):
     with open_sample(samples.bxr, "r") as f:
         units = f.get_channel_group(0).units
         self.assertEqual(70, len(units))
         self.assertIs(numpy.ndarray, type(units))
コード例 #7
0
 def test_channels_property_mutation(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         channels = group.channels
         channels.append("trash")
         self.assertEqual(183, len(group.channels))
コード例 #8
0
 def test_channels_property(self):
     with open_sample(samples.bxr, "r") as f:
         channels = f.get_channel_group(0).channels
         self.assertEqual(183, len(channels))
         self.assertIs(bwpy.Channel, type(channels[0]))
コード例 #9
0
 def test_name_property(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         self.assertEqual("Group 1", group.name)
コード例 #10
0
 def test_get_channel_groups(self):
     with open_sample(samples.bxr, "r") as f:
         groups = f.get_channel_groups()
         self.assertEqual("Group 1", groups[0]._name)
         self.assertEqual(1, len(groups))
コード例 #11
0
 def test_raw_recording_info(self):
     with open_sample(samples.bxr, "r") as f:
         raw = f.get_raw_recording_info()
         self.assertIsNotNone(raw)
コード例 #12
0
 def test_channel_groups_prop(self):
     with open_sample(samples.bxr, "r") as f:
         groups = f.channel_groups
         self.assertEqual(1, len(groups))
         self.assertIs(bwpy.ChannelGroup, type(groups[0]))
コード例 #13
0
 def test_guid(self):
     with open_sample(samples.brw, "r") as f:
         guid = f.guid
     self.assertIs(str, type(guid), "GUID should be of type str.")
     self.assertEqual("cfef184e-a0ea-41af-976b-45dcec62d561", guid)
コード例 #14
0
 def test_version(self):
     with open_sample(samples.brw, "r") as f:
         version = f.version
     self.assertEqual(numpy.int32, type(version))
     self.assertEqual(version, 320)
コード例 #15
0
 def test_write_description(self):
     with open_sample(samples.brw, "r") as f:
         with self.assertRaises(RuntimeError):
             f.description = "Hi, I'm Elfo"
コード例 #16
0
 def test_color_property(self):
     with open_sample(samples.bxr, "r") as f:
         group = f.get_channel_group(0)
         self.assertIs(tuple, type(group.color))
         self.assertEqual(4, len(group.color))
コード例 #17
0
 def test_channel_group_names(self):
     with open_sample(samples.bxr, "r") as f:
         names = f.get_channel_group_names()
         self.assertEqual(["Group 1"], names)
コード例 #18
0
 def test_missing_recording_var(self):
     with open_sample(samples.bxr, "r") as f:
         with self.assertRaises(KeyError):
             f.get_recording_variable("ThisReallyShouldntExistInHere")