def test_load_notes_annotations(self): from tests.test_evaluation_notes import ANNOTATIONS annotations = load_notes(pj(ANNOTATIONS_PATH, 'stereo_sample.notes')) self.assertIsInstance(annotations, np.ndarray) self.assertEqual(annotations.shape, (8, 4)) self.assertTrue(np.allclose(annotations, ANNOTATIONS))
def test_load_notes_from_file_handle(self): file_handle = open(pj(ANNOTATIONS_PATH, 'stereo_sample.notes')) annotations = load_notes(file_handle) self.assertIsInstance(annotations, np.ndarray) file_handle.close()
def test_values(self): result = load_notes(pj(ANNOTATIONS_PATH, 'stereo_sample.notes')) self.assertTrue(np.allclose(result, NOTES))
def test_load_notes_from_file(self): annotations = load_notes(pj(ANNOTATIONS_PATH, 'stereo_sample.notes')) self.assertIsInstance(annotations, np.ndarray)
from __future__ import absolute_import, division, print_function import unittest from os.path import join as pj from madmom.features import Activations from madmom.features.notes import * from madmom.io import load_notes from . import ACTIVATIONS_PATH, AUDIO_PATH, DETECTIONS_PATH sample_file = pj(AUDIO_PATH, "stereo_sample.wav") sample_act_rnn = Activations( pj(ACTIVATIONS_PATH, "stereo_sample.notes_brnn.npz")) sample_act_cnn = Activations( pj(ACTIVATIONS_PATH, "stereo_sample.notes_cnn.npz")) sample_det = load_notes( pj(DETECTIONS_PATH, "stereo_sample.piano_transcriptor.txt")) class TestRNNOnsetProcessorClass(unittest.TestCase): def setUp(self): self.processor = RNNPianoNoteProcessor() def test_process(self): act = self.processor(sample_file) self.assertTrue(np.allclose(act, sample_act_rnn, atol=1e-6)) class TestNoteOnsetPeakPickingProcessorClass(unittest.TestCase): def setUp(self): self.processor = NoteOnsetPeakPickingProcessor(threshold=0.35, smooth=0.09,