Exemplo n.º 1
0
 def test_mixed_cut_features_mask(self):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               features=Mock(sampling_rate=16000, frame_shift=0.01))
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_feature_mask()
     assert mask.sum() == 0
Exemplo n.º 2
0
 def test_mixed_cut_audio_mask(self):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               recording=Mock(sampling_rate=16000))
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_audio_mask()
     assert mask.sum() == 0
Exemplo n.º 3
0
 def test_mixed_cut_features_mask(self, supervisions):
     cut = Cut('cut', start=0, duration=2, channel=0, features=Mock(sampling_rate=16000, frame_shift=0.01),
               supervisions=supervisions)
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_feature_mask()
     assert (mask[:50] == 1).all()
     assert (mask[50:200] == 0).all()
     assert (mask[200:250] == 1).all()
     assert (mask[250:] == 0).all()
Exemplo n.º 4
0
 def test_mixed_cut_audio_mask(self, supervisions):
     cut = Cut('cut', start=0, duration=2, channel=0, recording=Mock(sampling_rate=16000),
               supervisions=supervisions)
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_audio_mask()
     assert (mask[:8000] == 1).all()
     assert (mask[8000:32000] == 0).all()
     assert (mask[32000:40000] == 1).all()
     assert (mask[40000:] == 0).all()
Exemplo n.º 5
0
 def test_mixed_cut_features_mask(self, supervisions):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               features=Mock(sampling_rate=16000, frame_shift=0.01),
               supervisions=supervisions)
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_feature_mask()
     ones = np.index_exp[list(
         chain(range(0, 50), range(60, 80), range(200, 250),
               range(260, 280)))]
     zeros = np.index_exp[list(
         chain(range(50, 60), range(80, 200), range(250, 260),
               range(280, 400)))]
     assert (mask[ones] == 1).all()
     assert (mask[zeros] == 0).all()
Exemplo n.º 6
0
 def test_mixed_cut_audio_mask(self, supervisions):
     cut = Cut('cut',
               start=0,
               duration=2,
               channel=0,
               recording=Mock(sampling_rate=16000),
               supervisions=supervisions)
     mixed_cut = cut.append(cut)
     mask = mixed_cut.supervisions_audio_mask()
     ones = np.index_exp[list(
         chain(range(0, 8000), range(9600, 12800), range(32000, 40000),
               range(41600, 44800)))]
     zeros = np.index_exp[list(
         chain(range(8000, 9600), range(12800, 32000), range(40000, 41600),
               range(44800, 64000)))]
     assert (mask[ones] == 1).all()
     assert (mask[zeros] == 0).all()