def test_detect_holds_during_release(self): # Two long notes that are pressed and released at mutually exclusive times action_data = np.asarray([ [ 100, 200, 0 ], [ 300, 400, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertTrue(np.all(mask == 0)) # Two long notes that are pressed and released at mutually exclusive times, # but press of one happens when the other is released action_data = np.asarray([ [ 100, 200, 0 ], [ 200, 300, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertTrue(np.all(mask == 0)) # Two long notes that are pressed and release at same time action_data = np.asarray([ [ 100, 200, 0 ], [ 100, 200, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertTrue(np.all(mask == 0)) # Two long notes, where one is pressed before the other, but released at same time action_data = np.asarray([ [ 50, 200, 0 ], [ 100, 200, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertTrue(np.all(mask == 0)) # Two long notes that are pressed at same time, but one is released before another action_data = np.asarray([ [ 100, 150, 0 ], [ 100, 200, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertFalse(np.all(mask == 0)) # Two long notes where one is pressed and released before another action_data = np.asarray([ [ 100, 150, 0 ], [ 120, 200, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertFalse(np.all(mask == 0)) # Two long notes where one is pressed and released while holding another action_data = np.asarray([ [ 100, 300, 0 ], [ 150, 250, 1 ], ]) mask = ManiaMapMetrics.detect_holds_during_release(action_data) self.assertFalse(np.all(mask == 0)) # Crash test beatmap = BeatmapIO.open_beatmap('unit_tests\\maps\\mania\\test\\chords_250ms.osu') action_data = ManiaActionData.get_action_data(beatmap) mask = ManiaMapMetrics.detect_holds_during_release(action_data) beatmap = BeatmapIO.open_beatmap('unit_tests\\maps\\mania\\playable\\DJ Genericname - Dear You (Taiwan-NAK) [S.Star\'s 4K HD+].osu') action_data = ManiaActionData.get_action_data(beatmap) mask = ManiaMapMetrics.detect_holds_during_release(action_data)
def test_calc_press_rate(self): beatmap = BeatmapIO.open_beatmap('unit_tests\\maps\\mania\\test\\chords_250ms.osu') action_data = ManiaActionData.get_action_data(beatmap) # TODO: test functionality press_rate = ManiaMapMetrics.calc_press_rate(action_data, col=0)
def setUpClass(cls): cls.beatmap = BeatmapIO.open_beatmap( 'unit_tests\\maps\\osu\\test\\abraker - unknown (abraker) [250ms].osu' ) cls.map_data = StdMapData.get_map_data(cls.beatmap)