예제 #1
0
def test_InMemoryEpochSource():
    ep_times = np.arange(0, 10., .5)
    ep_durations = np.ones(ep_times.shape) * .1
    ep_labels = np.array(
        ['Epoch0 num {}'.format(i) for i in range(ep_times.size)], dtype='U')
    epoch0 = {
        'time': ep_times,
        'duration': ep_durations,
        'label': ep_labels,
        'name': 'Epoch0'
    }

    ep_times = np.arange(-6, 8., 2.)
    ep_durations = np.ones(ep_times.shape) * .2
    ep_labels = np.array(
        ['Epoch1 num {}'.format(i) for i in range(ep_times.size)], dtype='U')
    epoch1 = {
        'time': ep_times,
        'duration': ep_durations,
        'label': ep_labels,
        'name': 'Epoch1'
    }

    all_epochs = [epoch0, epoch1]

    source = ephyviewer.InMemoryEpochSource(all_epochs=all_epochs)

    assert source.t_start == -6.
    assert source.t_stop == 9.6
    assert source.get_size(0) == 20
예제 #2
0
def make_fake_epoch_source():
    all_epochs = []
    for c in range(3):
        ep_times = np.arange(0, 10., .5) + c*3
        ep_durations = np.ones(ep_times.shape) * .1
        ep_labels = np.array(['Event{} num {}'.format(c, i) for i in range(ep_times.size)], dtype='U')
        all_epochs.append({ 'time':ep_times, 'duration':ep_durations, 'label':ep_labels, 'name':'Event{}'.format(c) })

    source = ephyviewer.InMemoryEpochSource(all_epochs=all_epochs)
    return source