Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)

src/n/e/NeuroTools-0.2.0/test/test_analogs.py   NeuroTools(Download)
    def testSliceExcludeEvents(self):
        sig = analogs.AnalogSignal(np.sin(np.arange(10000.)), 0.1)
        # check something in the middle splits in 2
        res0 = list(sig.slice_exclude_events([500.0],t_min=0., t_max=0.))
        assert len(res0)==2
        # check that event at t_start yields only one slice, removing t_max
        res1 = list(sig.slice_exclude_events([0.0],t_min=10., t_max=10.))
        assert len(res1)==1
        assert res1[0].t_start == sig.t_start+10.0
        assert res1[0].duration() == 990.0      
        # check something in the middle splits in 2
        res2 = list(sig.slice_exclude_events([250.0, 750.0], t_min=50., t_max=50.))
        # check behaviour at the end (t_stop)
        res3 = list(sig.slice_exclude_events([1000.0], t_min=50., t_max=50.))
        assert len(res3)==1
        assert res3[0].duration() == 950.0