def test_load_sections(): # load a file which exists section_path = ( 'tests/resources/mir_datasets/RWC-Classical/' + 'annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C003.CHORUS.TXT' ) section_data = rwc_classical.load_sections(section_path) # check types assert type(section_data) == utils.SectionData assert type(section_data.intervals) is np.ndarray assert type(section_data.labels) is list # check values assert np.array_equal(section_data.intervals[:, 0], np.array([0.29, 419.96])) assert np.array_equal(section_data.intervals[:, 1], np.array([46.14, 433.71])) assert np.array_equal(section_data.labels, np.array(['chorus A', 'ending'])) # load a file which doesn't exist section_data_none = rwc_classical.load_sections('fake/file/path') assert section_data_none is None
def sections(self): """SectionData: human-labeled section annotation""" return load_sections(self.sections_path)