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) == annotations.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"]))

    # empty file
    section_path = (
        "tests/resources/mir_datasets/rwc_classical/" +
        "annotations/AIST.RWC-MDB-C-2001.CHORUS/RM-C025_A.CHORUS.TXT")

    section_data = rwc_classical.load_sections(section_path)

    assert section_data == None
Esempio n. 2
0
 def load_sections(self, *args, **kwargs):
     return load_sections(*args, **kwargs)
Esempio n. 3
0
 def sections(self) -> Optional[annotations.SectionData]:
     return load_sections(self.sections_path)
Esempio n. 4
0
 def sections(self):
     """SectionData: human-labeled section annotation"""
     return load_sections(self.sections_path)
Esempio n. 5
0
 def sections(self):
     return load_sections(self.sections_path)