Beispiel #1
0
def test_neo_object_sources():

    from neo.test.generate_datasets import generate_one_simple_segment
    import neo

    neo_seg = generate_one_simple_segment(supported_objects=[
        neo.Segment, neo.AnalogSignal, neo.Event, neo.Epoch, neo.SpikeTrain
    ])

    sources = ephyviewer.get_sources_from_neo_segment(neo_seg)

    for s in sources['signal']:
        print(s.t_start, s.nb_channel, s.sample_rate)
        print(s.get_chunk(i_start=0, i_stop=1024).shape)

    for s in sources['epoch']:
        print(s.t_start, s.nb_channel)
        print(s.get_chunk_by_time(chan=0, t_start=0, t_stop=10.))

    for s in sources['event']:
        print(s.t_start, s.nb_channel)
        print(s.get_chunk_by_time(chan=0, t_start=0, t_stop=10.))

    for s in sources['spike']:
        print(s.t_start, s.nb_channel)
        print(s.get_chunk_by_time(chan=0, t_start=0., t_stop=10.))
Beispiel #2
0
##############################
# case 1 : create viewers one at a time directly from neo objects in memory
win = MainViewer(show_auto_scale=True)

# from one neo.AnalogSignal
view1 = TraceViewer.from_neo_analogsignal(neo_seg.analogsignals[0], 'sigs')
win.add_view(view1)

# from several neo.SpikeTrains (3 spiketrains here)
view2 = SpikeTrainViewer.from_neo_spiketrains(neo_seg.spiketrains[0:3],
                                              'spikes')
win.add_view(view2)

# from several neo.Epoch
view3 = EpochViewer.from_neo_epochs(neo_seg.epochs, 'epochs')
win.add_view(view3)

# from several neo.Event
view4 = EventList.from_neo_events(neo_seg.events, 'events')
win.add_view(view4, location='bottom', orientation='horizontal')

win.show()

##############################
# case 2 : automagically create data sources and a complete window from a neo segment
sources = get_sources_from_neo_segment(neo_seg)
win2 = compose_mainviewer_from_sources(sources)
win2.show()

app.exec_()