def test_precomputed():
    sounds = [slab.Sound.whitenoise() for _ in range(10)]
    sounds = slab.Precomputed(sounds)
    sounds = slab.Precomputed(sounds.random_choice(5))
    sounds.write(PATH / "precomputed.zip")
    sounds = slab.Precomputed.read(PATH / "precomputed.zip")
    cfg = slab.psychoacoustics.load_config("tests/config.txt")
Esempio n. 2
0
def make_binaural_adaptors():

    kwargs = {
        'speed': _adaptor_speed,
        'snr': 100,
        'direction': _adaptor_dir,
        'externalize': False
    }
    make_adaptor = functools.partial(moving_gaussian, **kwargs)
    return slab.Precomputed(make_adaptor, _n_adaptors_per_trial * 1)
Esempio n. 3
0
 def test_localization_test_headphones(self):
     targets = main.TABLE.head()
     signals = [
         slab.Precomputed(lambda: slab.Binaural(
             [slab.Sound.pinknoise(),
              slab.Sound.pinknoise()]),
                          n=10) for i in range(len(targets))
     ]
     seq = main.localization_test_headphones(targets=targets,
                                             signals=signals,
                                             n_reps=1,
                                             n_images=5,
                                             visual=False)
     assert len(seq.trials) == len(seq.data)
Esempio n. 4
0
def make_adapters():
    'Pre-make many adapter instances to speed-up constructing the stimuli.'
    kwargs = {'speed': _adapter_speed, 'SNR': 100, 'direction': _adapter_dir}
    make_adapter = functools.partial(moving_gaussian, **kwargs)
    adapter_list = slab.Precomputed(make_adapter, _n_adapters_per_trial * 3)
    return adapter_list