Skip to content

Commit

Permalink
updated performance features test
Browse files Browse the repository at this point in the history
  • Loading branch information
huispaty committed Oct 2, 2024
1 parent 14d2d77 commit b61d8bf
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions tests/test_performance_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,36 @@
import os



class TestPerformanceFeatures(unittest.TestCase):
def test_performance_features(self):
fields = ['id','pedal_feature.onset_value','pedal_feature.offset_value','pedal_feature.to_prev_release',
'pedal_feature.to_next_release','onset','duration', 'pitch', 'p_onset', 'p_duration','velocity', 'beat_period']
True_array = np.array([('n1', 0.23374297, 89.74999 , 62.000057, 0., 0.16015087, -0.5, 0.5 , 59, 4.9925 , 0.8775 , 44, 1.4700003),
('n4', 0.03011051, 114.25004 , 61.000244, 0., 0.4027142 , 0. , 1. , 40, 5.7025 , 2.4375 , 22, 2.8474998),
('n3', 2.527984 , 87.500046, 61.000244, 0., 0.4027142 , 0. , 0.25, 56, 5.77625, 2.36375, 26, 2.8474998)],
dtype=[('id', '<U256'),
('articulation_feature.kor', '<f4'),
('pedal_feature.onset_value', '<f4'),
('pedal_feature.offset_value', '<f4'),
('pedal_feature.to_prev_release', '<f4'),
('pedal_feature.to_next_release', '<f4'),
('onset', '<f4'),
('duration', '<f4'),
('pitch', '<i4'),
('p_onset', '<f4'),
('p_duration', '<f4'),
('velocity', '<i4'),
('beat_period', '<f4')])
fields = ['id',
'articulation_feature.kor', 'pedal_feature.onset_value', 'pedal_feature.offset_value', 'pedal_feature.to_prev_release',
'pedal_feature.to_next_release', 'onset', 'duration', 'pitch', 'p_onset', 'p_duration', 'velocity', 'beat_period']
True_array = np.array(
[('n1', 0.23374297, 89.74999, 62.000057, 0., 0.16015087, -0.5, 0.5, 59, 4.9925, 0.8775, 44, 1.4700003),
('n4', 0.03011051, 114.25004, 61.000244, 0.,
0.4027142, 0., 1., 40, 5.7025, 2.4375, 22, 2.8474998),
('n3', 0.8451489, 87.500046, 113., 0., 1.5302137, 0., 0.25, 56, 5.77625, 1.23625, 26, 2.8474998)],
dtype=[('id', '<U256'),
('articulation_feature.kor', '<f4'),
('pedal_feature.onset_value', '<f4'),
('pedal_feature.offset_value', '<f4'),
('pedal_feature.to_prev_release', '<f4'),
('pedal_feature.to_next_release', '<f4'),
('onset', '<f4'),
('duration', '<f4'),
('pitch', '<i4'),
('p_onset', '<f4'),
('p_duration', '<f4'),
('velocity', '<i4'),
('beat_period', '<f4')])
fn = MATCH_EXPRESSIVE_FEATURES_TESTFILES[0]
perf, alignment, score = load_match(filename=fn, create_score=True)
features = make_performance_features(score,
perf,
alignment,
feature_functions = "all")

self.assertTrue(np.all(True_array[fields] == features[fields][:3]), f"The expression features don't match the original.")
feature_functions="all")

self.assertTrue(np.all(True_array[fields] == features[fields][:3]),
f"The expression features don't match the original.")

0 comments on commit b61d8bf

Please sign in to comment.