Esempio n. 1
0
def test_signal_save_load(signal, signal_tmpdir):
    '''
    Test that signals save and load properly
    '''
    #    if not os.path.exists(signal_tmpdir):
    #        os.mkdir(signal_tmpdir)
    signal.save(str(signal_tmpdir), fmt='%1.3e')

    signals_found = RasterizedSignal.list_signals(str(signal_tmpdir))
    assert len(signals_found) == 1

    save_directory = os.path.join(str(signal_tmpdir), signals_found[0])
    signal_loaded = RasterizedSignal.load(save_directory)

    assert np.all(signal.as_continuous() == signal_loaded.as_continuous())
Esempio n. 2
0
def test_epoch_save_load(signal, signal_tmpdir):
    '''
    Test that epochs save and load properly
    '''

    before = signal.epochs

    signal.save(str(signal_tmpdir), fmt='%1.3e')
    signals_found = RasterizedSignal.list_signals(str(signal_tmpdir))
    save_directory = os.path.join(str(signal_tmpdir), signals_found[0])
    signal_loaded = RasterizedSignal.load(save_directory)

    after = signal_loaded.epochs
    print("Dataframes equal?\n"
          "Before:\n{0}\n"
          "After:\n{1}\n".format(before, after))
    assert before.equals(after)