def __str__(self): """ defines the output of print """ string_desc = format_descriptor(self.descriptors) rdm_desc = format_descriptor(self.rdm_descriptors) pattern_desc = format_descriptor(self.pattern_descriptors) diss = self.get_matrices()[0] return (f'pyrsa.rdm.{self.__class__.__name__}\n' f'{self.n_rdm} RDM(s) over {self.n_cond} conditions\n\n' f'dissimilarity_measure = \n{self.dissimilarity_measure}\n\n' f'dissimilarities[0] = \n{diss}\n\n' f'descriptors: \n{string_desc}\n' f'rdm_descriptors: \n{rdm_desc}\n' f'pattern_descriptors: \n{pattern_desc}\n')
def __str__(self): """ defines the output of print """ string_desc = format_descriptor(self.descriptors) string_obs_desc = format_descriptor(self.obs_descriptors) string_channel_desc = format_descriptor(self.channel_descriptors) if self.measurements.shape[0] > 5: measurements = self.measurements[:5, :] else: measurements = self.measurements return (f'pyrsa.data.{self.__class__.__name__}\n' f'measurements = \n{measurements}\n...\n\n' f'descriptors: \n{string_desc}\n\n' f'obs_descriptors: \n{string_obs_desc}\n\n' f'channel_descriptors: \n{string_channel_desc}\n')
def test_format_descriptor(self): from pyrsa.util.descriptor_utils import format_descriptor descriptors = {'foo': 'bar', 'foz': 12.3} self.assertEqual(format_descriptor(descriptors), 'foo = bar\nfoz = 12.3\n')