<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import sys <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> import numpy as np <EOL> import quantities as pq <EOL> try : <EOL> from IPython . lib . pretty import pretty <EOL> except ImportError as err : <EOL> HAVE_IPYTHON = False <EOL> else : <EOL> HAVE_IPYTHON = True <EOL> from neo . core . spiketrain import ( check_has_dimensions_time , SpikeTrain , <EOL> _check_time_in_range , _new_spiketrain ) <EOL> from neo . core import Segment , Unit <EOL> from neo . test . tools import assert_arrays_equal , assert_neo_object_is_compliant <EOL> from neo . test . generate_datasets import ( get_fake_value , get_fake_values , <EOL> fake_neo , TEST_ANNOTATIONS ) <EOL> class Test__generate_datasets ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> np . random . seed ( <NUM_LIT:0> ) <EOL> self . annotations = dict ( [ ( str ( x ) , TEST_ANNOTATIONS [ x ] ) for x in <EOL> range ( len ( TEST_ANNOTATIONS ) ) ] ) <EOL> def test__get_fake_values ( self ) : <EOL> self . annotations [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> times = get_fake_value ( '<STR_LIT>' , pq . Quantity , seed = <NUM_LIT:0> , dim = <NUM_LIT:1> ) <EOL> t_start = get_fake_value ( '<STR_LIT>' , pq . Quantity , seed = <NUM_LIT:1> , dim = <NUM_LIT:0> ) <EOL> t_stop = get_fake_value ( '<STR_LIT>' , pq . Quantity , seed = <NUM_LIT:2> , dim = <NUM_LIT:0> ) <EOL> waveforms = get_fake_value ( '<STR_LIT>' , pq . Quantity , seed = <NUM_LIT:3> , dim = <NUM_LIT:3> ) <EOL> left_sweep = get_fake_value ( '<STR_LIT>' , pq . Quantity , seed = <NUM_LIT:4> , dim = <NUM_LIT:0> ) <EOL> sampling_rate = get_fake_value ( '<STR_LIT>' , pq . Quantity , <EOL> seed = <NUM_LIT:5> , dim = <NUM_LIT:0> ) <EOL> name = get_fake_value ( '<STR_LIT:name>' , str , seed = <NUM_LIT:6> , obj = SpikeTrain ) <EOL> description = get_fake_value ( '<STR_LIT:description>' , str , <EOL> seed = <NUM_LIT:7> , obj = '<STR_LIT>' ) <EOL> file_origin = get_fake_value ( '<STR_LIT>' , str ) <EOL> attrs1 = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT:description>' : description , <EOL> '<STR_LIT>' : file_origin } <EOL> attrs2 = attrs1 . copy ( ) <EOL> attrs2 . update ( self . annotations ) <EOL> res11 = get_fake_values ( SpikeTrain , annotate = False , seed = <NUM_LIT:0> ) <EOL> res12 = get_fake_values ( '<STR_LIT>' , annotate = False , seed = <NUM_LIT:0> ) <EOL> res21 = get_fake_values ( SpikeTrain , annotate = True , seed = <NUM_LIT:0> ) <EOL> res22 = get_fake_values ( '<STR_LIT>' , annotate = True , seed = <NUM_LIT:0> ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , times ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , times ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , times ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , times ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , t_start ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , t_start ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , t_start ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , t_start ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , t_stop ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , t_stop ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , t_stop ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , t_stop ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , waveforms ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , waveforms ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , waveforms ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , waveforms ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , left_sweep ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , left_sweep ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , left_sweep ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , left_sweep ) <EOL> assert_arrays_equal ( res11 . pop ( '<STR_LIT>' ) , sampling_rate ) <EOL> assert_arrays_equal ( res12 . pop ( '<STR_LIT>' ) , sampling_rate ) <EOL> assert_arrays_equal ( res21 . pop ( '<STR_LIT>' ) , sampling_rate ) <EOL> assert_arrays_equal ( res22 . pop ( '<STR_LIT>' ) , sampling_rate ) <EOL> self . assertEqual ( res11 , attrs1 ) <EOL> self . assertEqual ( res12 , attrs1 ) <EOL> self . assertEqual ( res21 , attrs2 ) <EOL> self . assertEqual ( res22 , attrs2 ) <EOL> def test__fake_neo__cascade ( self ) : <EOL> self . annotations [ '<STR_LIT>' ] = None <EOL> obj_type = '<STR_LIT>' <EOL> cascade = True <EOL> res = fake_neo ( obj_type = obj_type , cascade = cascade ) <EOL> self . assertTrue ( isinstance ( res , SpikeTrain ) ) <EOL> assert_neo_object_is_compliant ( res ) <EOL> self . assertEqual ( res . annotations , self . annotations ) <EOL> def test__fake_neo__nocascade ( self ) : <EOL> self . annotations [ '<STR_LIT>' ] = None <EOL> obj_type = SpikeTrain <EOL> cascade = False <EOL> res = fake_neo ( obj_type = obj_type , cascade = cascade ) <EOL> self . assertTrue ( isinstance ( res , SpikeTrain ) ) <EOL> assert_neo_object_is_compliant ( res ) <EOL> self . assertEqual ( res . annotations , self . annotations ) <EOL> class Testcheck_has_dimensions_time ( unittest . TestCase ) : <EOL> def test__check_has_dimensions_time ( self ) : <EOL> a = np . arange ( <NUM_LIT:3> ) * pq . ms <EOL> b = np . arange ( <NUM_LIT:3> ) * pq . mV <EOL> c = np . arange ( <NUM_LIT:3> ) * pq . mA <EOL> d = np . arange ( <NUM_LIT:3> ) * pq . minute <EOL> check_has_dimensions_time ( a ) <EOL> self . assertRaises ( ValueError , check_has_dimensions_time , b ) <EOL> self . assertRaises ( ValueError , check_has_dimensions_time , c ) <EOL> check_has_dimensions_time ( d ) <EOL> self . assertRaises ( ValueError , check_has_dimensions_time , a , b , c , d ) <EOL> class Testcheck_time_in_range ( unittest . TestCase ) : <EOL> def test__check_time_in_range_empty_array ( self ) : <EOL> value = np . array ( [ ] ) <EOL> t_start = <NUM_LIT:0> * pq . s <EOL> t_stop = <NUM_LIT:10> * pq . s <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = False ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_exact ( self ) : <EOL> value = np . array ( [ <NUM_LIT:0.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . s <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = False ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_scale ( self ) : <EOL> value = np . array ( [ <NUM_LIT:0.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . ms <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = False ) <EOL> def test__check_time_in_range_inside ( self ) : <EOL> value = np . array ( [ <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT> ] ) * pq . s <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = False ) <EOL> _check_time_in_range ( value , t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_below ( self ) : <EOL> value = np . array ( [ - <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT> ] ) * pq . s <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_below_scale ( self ) : <EOL> value = np . array ( [ - <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . ms <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> def test__check_time_in_range_above ( self ) : <EOL> value = np . array ( [ <NUM_LIT:0.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . s <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_above_scale ( self ) : <EOL> value = np . array ( [ <NUM_LIT:0.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . ms <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> def test__check_time_in_range_above_below ( self ) : <EOL> value = np . array ( [ - <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT> ] ) * pq . s <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = True ) <EOL> def test__check_time_in_range_above_below_scale ( self ) : <EOL> value = np . array ( [ - <NUM_LIT:1.> , <NUM_LIT> , <NUM_LIT> ] ) * pq . ms <EOL> t_start = <NUM_LIT:0.> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _check_time_in_range , value , <EOL> t_start = t_start , t_stop = t_stop , view = False ) <EOL> class TestConstructor ( unittest . TestCase ) : <EOL> def result_spike_check ( self , train , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) : <EOL> assert_arrays_equal ( train , st_out ) <EOL> assert_arrays_equal ( train , train . times ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train . t_start , t_start_out ) <EOL> self . assertEqual ( train . t_start , train . times . t_start ) <EOL> self . assertEqual ( train . t_stop , t_stop_out ) <EOL> self . assertEqual ( train . t_stop , train . times . t_stop ) <EOL> self . assertEqual ( train . units , units ) <EOL> self . assertEqual ( train . units , train . times . units ) <EOL> self . assertEqual ( train . t_start . units , units ) <EOL> self . assertEqual ( train . t_start . units , train . times . t_start . units ) <EOL> self . assertEqual ( train . t_stop . units , units ) <EOL> self . assertEqual ( train . t_stop . units , train . times . t_stop . units ) <EOL> self . assertEqual ( train . dtype , dtype ) <EOL> self . assertEqual ( train . dtype , train . times . dtype ) <EOL> self . assertEqual ( train . t_stop . dtype , dtype ) <EOL> self . assertEqual ( train . t_stop . dtype , train . times . t_stop . dtype ) <EOL> self . assertEqual ( train . t_start . dtype , dtype ) <EOL> self . assertEqual ( train . t_start . dtype , train . times . t_start . dtype ) <EOL> def test__create_minimal ( self ) : <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( [ ] * pq . s , t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , [ ] * pq . s , t_stop ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = [ ] * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_empty ( self ) : <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( [ ] , t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , [ ] , t_start = t_start , <EOL> t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = [ ] * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_empty_no_t_start ( self ) : <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( [ ] , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , [ ] , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = [ ] * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_list ( self ) : <EOL> times = range ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT>" ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start <EOL> t_stop_out = t_stop <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_list_set_dtype ( self ) : <EOL> times = range ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT>" , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT>" , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . astype ( dtype ) <EOL> st_out = pq . Quantity ( times , units = units , dtype = dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_list_no_start_stop_units ( self ) : <EOL> times = range ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT>" ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_list_no_start_stop_units_set_dtype ( self ) : <EOL> times = range ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT>" , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT>" , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = pq . Quantity ( times , units = units , dtype = dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> dtype = np . int <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start <EOL> t_stop_out = t_stop <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array_with_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> , dtype = '<STR_LIT>' ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start <EOL> t_stop_out = t_stop <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT:s>" , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT:s>" , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . astype ( dtype ) <EOL> st_out = times . astype ( dtype ) * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array_no_start_stop_units ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> dtype = np . int <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array_no_start_stop_units_with_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> , dtype = '<STR_LIT>' ) <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = "<STR_LIT:s>" ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = times * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_array_no_start_stop_units_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT:s>" , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = "<STR_LIT:s>" , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = times . astype ( dtype ) * units <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start <EOL> t_stop_out = t_stop <EOL> st_out = times <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_with_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> , dtype = '<STR_LIT>' ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . astype ( dtype ) <EOL> st_out = times . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . astype ( dtype ) <EOL> st_out = times . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_no_start_stop_units ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = t_start * units <EOL> t_stop_out = t_stop * units <EOL> st_out = times <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_no_start_stop_units_with_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> , dtype = '<STR_LIT>' ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = times . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_no_start_stop_units_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . ms <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = times . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_units ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start <EOL> t_stop_out = t_stop <EOL> st_out = times <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_units_with_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> , dtype = '<STR_LIT>' ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = '<STR_LIT:s>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . rescale ( units ) . astype ( dtype ) <EOL> st_out = times . rescale ( units ) . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_units_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = '<STR_LIT:s>' , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = '<STR_LIT:s>' , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = t_start . astype ( dtype ) <EOL> t_stop_out = t_stop . rescale ( units ) . astype ( dtype ) <EOL> st_out = times . rescale ( units ) . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_array_units_no_start_stop_units ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , units = '<STR_LIT:s>' ) <EOL> dtype = np . float64 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = times <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_quantity_units_no_start_stop_units_set_dtype ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . ms <EOL> t_start = <NUM_LIT:0.0> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( times , t_start = t_start , t_stop = t_stop , <EOL> units = '<STR_LIT:s>' , dtype = '<STR_LIT>' ) <EOL> train2 = _new_spiketrain ( SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop , <EOL> units = '<STR_LIT:s>' , dtype = '<STR_LIT>' ) <EOL> dtype = np . float32 <EOL> units = <NUM_LIT:1> * pq . s <EOL> t_start_out = pq . Quantity ( t_start , units = units , dtype = dtype ) <EOL> t_stop_out = pq . Quantity ( t_stop , units = units , dtype = dtype ) <EOL> st_out = times . rescale ( units ) . astype ( dtype ) <EOL> self . result_spike_check ( train1 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> self . result_spike_check ( train2 , st_out , t_start_out , t_stop_out , <EOL> dtype , units ) <EOL> def test__create_from_list_without_units_should_raise_ValueError ( self ) : <EOL> times = range ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> self . assertRaises ( ValueError , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _new_spiketrain , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> def test__create_from_array_without_units_should_raise_ValueError ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> self . assertRaises ( ValueError , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _new_spiketrain , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> def test__create_from_array_with_incompatible_units_ValueError ( self ) : <EOL> times = np . arange ( <NUM_LIT:10> ) * pq . km <EOL> t_start = <NUM_LIT:0.0> * pq . s <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> self . assertRaises ( ValueError , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _new_spiketrain , SpikeTrain , times , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> def test__create_with_times_outside_tstart_tstop_ValueError ( self ) : <EOL> t_start = <NUM_LIT> <EOL> t_stop = <NUM_LIT> <EOL> train1 = SpikeTrain ( np . arange ( t_start , t_stop ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> train2 = _new_spiketrain ( SpikeTrain , <EOL> np . arange ( t_start , t_stop ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> assert_neo_object_is_compliant ( train1 ) <EOL> assert_neo_object_is_compliant ( train2 ) <EOL> self . assertRaises ( ValueError , SpikeTrain , <EOL> np . arange ( t_start - <NUM_LIT:5> , t_stop ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _new_spiketrain , SpikeTrain , <EOL> np . arange ( t_start - <NUM_LIT:5> , t_stop ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , SpikeTrain , <EOL> np . arange ( t_start , t_stop + <NUM_LIT:5> ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> self . assertRaises ( ValueError , _new_spiketrain , SpikeTrain , <EOL> np . arange ( t_start , t_stop + <NUM_LIT:5> ) , units = '<STR_LIT>' , <EOL> t_start = t_start , t_stop = t_stop ) <EOL> def test_defaults ( self ) : <EOL> train1 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] , units = '<STR_LIT>' , t_stop = <NUM_LIT> ) <EOL> train2 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] , <EOL> units = '<STR_LIT>' , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train1 ) <EOL> assert_neo_object_is_compliant ( train2 ) <EOL> self . assertEqual ( train1 . dtype , np . float ) <EOL> self . assertEqual ( train2 . dtype , np . float ) <EOL> self . assertEqual ( train1 . sampling_rate , <NUM_LIT:1.0> * pq . Hz ) <EOL> self . assertEqual ( train2 . sampling_rate , <NUM_LIT:1.0> * pq . Hz ) <EOL> self . assertEqual ( train1 . waveforms , None ) <EOL> self . assertEqual ( train2 . waveforms , None ) <EOL> self . assertEqual ( train1 . left_sweep , None ) <EOL> self . assertEqual ( train2 . left_sweep , None ) <EOL> def test_default_tstart ( self ) : <EOL> train11 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , t_stop = <NUM_LIT> * pq . ms ) <EOL> train21 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , <EOL> t_stop = <NUM_LIT> * pq . ms ) <EOL> assert_neo_object_is_compliant ( train11 ) <EOL> assert_neo_object_is_compliant ( train21 ) <EOL> self . assertEqual ( train11 . t_start , <NUM_LIT:0.> * pq . s ) <EOL> self . assertEqual ( train21 . t_start , <NUM_LIT:0.> * pq . s ) <EOL> train12 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , t_start = <NUM_LIT> , t_stop = <NUM_LIT:8> ) <EOL> train22 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , <EOL> t_start = <NUM_LIT> , t_stop = <NUM_LIT:8> ) <EOL> assert_neo_object_is_compliant ( train12 ) <EOL> assert_neo_object_is_compliant ( train22 ) <EOL> self . assertEqual ( train12 . t_start , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( train22 . t_start , <NUM_LIT> * pq . s ) <EOL> def test_tstop_units_conversion ( self ) : <EOL> train11 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] * pq . s , t_stop = <NUM_LIT:10> ) <EOL> train21 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] * pq . s , t_stop = <NUM_LIT:10> ) <EOL> assert_neo_object_is_compliant ( train11 ) <EOL> assert_neo_object_is_compliant ( train21 ) <EOL> self . assertEqual ( train11 . t_stop , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( train21 . t_stop , <NUM_LIT> * pq . s ) <EOL> train12 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] * pq . s , t_stop = <NUM_LIT> * pq . ms ) <EOL> train22 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] * pq . s , <EOL> t_stop = <NUM_LIT> * pq . ms ) <EOL> assert_neo_object_is_compliant ( train12 ) <EOL> assert_neo_object_is_compliant ( train22 ) <EOL> self . assertEqual ( train12 . t_stop , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( train22 . t_stop , <NUM_LIT> * pq . s ) <EOL> train13 = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] , units = '<STR_LIT>' , t_stop = <NUM_LIT> * pq . ms ) <EOL> train23 = _new_spiketrain ( SpikeTrain , [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] , <EOL> units = '<STR_LIT>' , t_stop = <NUM_LIT> * pq . ms ) <EOL> assert_neo_object_is_compliant ( train13 ) <EOL> assert_neo_object_is_compliant ( train23 ) <EOL> self . assertEqual ( train13 . t_stop , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( train23 . t_stop , <NUM_LIT> * pq . s ) <EOL> class TestSorting ( unittest . TestCase ) : <EOL> def test_sort ( self ) : <EOL> waveforms = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] ] , [ [ <NUM_LIT> , <NUM_LIT> ] ] , [ [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , waveforms = waveforms , name = '<STR_LIT:n>' , <EOL> t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train . sort ( ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_arrays_equal ( train , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s ) <EOL> assert_arrays_equal ( train . waveforms , waveforms ) <EOL> self . assertEqual ( train . name , '<STR_LIT:n>' ) <EOL> self . assertEqual ( train . t_stop , <NUM_LIT> * pq . s ) <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:4> ] * pq . s , waveforms = waveforms , name = '<STR_LIT:n>' , <EOL> t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train . sort ( ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_arrays_equal ( train , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s ) <EOL> assert_arrays_equal ( train . waveforms , waveforms [ [ <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:1> ] ] ) <EOL> self . assertEqual ( train . name , '<STR_LIT:n>' ) <EOL> self . assertEqual ( train . t_start , <NUM_LIT:0.0> * pq . s ) <EOL> self . assertEqual ( train . t_stop , <NUM_LIT> * pq . s ) <EOL> class TestSlice ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . waveforms1 = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> self . data1 = np . array ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ) <EOL> self . data1quant = self . data1 * pq . s <EOL> self . train1 = SpikeTrain ( self . data1quant , waveforms = self . waveforms1 , <EOL> name = '<STR_LIT:n>' , arb = '<STR_LIT>' , t_stop = <NUM_LIT> ) <EOL> def test_compliant ( self ) : <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> def test_slice ( self ) : <EOL> result = self . train1 [ <NUM_LIT:1> : <NUM_LIT:2> ] <EOL> assert_arrays_equal ( self . train1 [ <NUM_LIT:1> : <NUM_LIT:2> ] , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> assert_arrays_equal ( self . train1 . waveforms [ <NUM_LIT:1> : <NUM_LIT:2> ] , result . waveforms ) <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> def test_slice_to_end ( self ) : <EOL> result = self . train1 [ <NUM_LIT:1> : ] <EOL> assert_arrays_equal ( self . train1 [ <NUM_LIT:1> : ] , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> assert_arrays_equal ( self . train1 . waveforms [ <NUM_LIT:1> : ] , result . waveforms ) <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> def test_slice_from_beginning ( self ) : <EOL> result = self . train1 [ : <NUM_LIT:2> ] <EOL> assert_arrays_equal ( self . train1 [ : <NUM_LIT:2> ] , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> assert_arrays_equal ( self . train1 . waveforms [ : <NUM_LIT:2> ] , result . waveforms ) <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> def test_slice_negative_idxs ( self ) : <EOL> result = self . train1 [ : - <NUM_LIT:1> ] <EOL> assert_arrays_equal ( self . train1 [ : - <NUM_LIT:1> ] , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> assert_arrays_equal ( self . train1 . waveforms [ : - <NUM_LIT:1> ] , result . waveforms ) <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> class TestTimeSlice ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . waveforms1 = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> self . data1 = np . array ( [ <NUM_LIT:0.1> , <NUM_LIT:0.5> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> ] ) <EOL> self . data1quant = self . data1 * pq . ms <EOL> self . train1 = SpikeTrain ( self . data1quant , t_stop = <NUM_LIT> * pq . ms , <EOL> waveforms = self . waveforms1 ) <EOL> def test_compliant ( self ) : <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> def test_time_slice_typical ( self ) : <EOL> t_start = <NUM_LIT> * pq . ms <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> result = self . train1 . time_slice ( t_start , t_stop ) <EOL> targ = SpikeTrain ( [ <NUM_LIT:0.5> , <NUM_LIT> , <NUM_LIT> ] * pq . ms , t_stop = <NUM_LIT> ) <EOL> assert_arrays_equal ( result , targ ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( t_start , result . t_start ) <EOL> self . assertEqual ( t_stop , result . t_stop ) <EOL> def test_time_slice_differnt_units ( self ) : <EOL> t_start = <NUM_LIT> * pq . s <EOL> t_stop = <NUM_LIT> * pq . s <EOL> result = self . train1 . time_slice ( t_start , t_stop ) <EOL> targ = SpikeTrain ( [ <NUM_LIT:0.5> , <NUM_LIT> , <NUM_LIT> ] * pq . ms , t_stop = <NUM_LIT> ) <EOL> assert_arrays_equal ( result , targ ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( t_start , result . t_start ) <EOL> self . assertEqual ( t_stop , result . t_stop ) <EOL> def test_time_slice_matching_ends ( self ) : <EOL> t_start = <NUM_LIT:0.1> * pq . ms <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> result = self . train1 . time_slice ( t_start , t_stop ) <EOL> assert_arrays_equal ( self . train1 , result ) <EOL> assert_arrays_equal ( self . waveforms1 , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( t_start , result . t_start ) <EOL> self . assertEqual ( t_stop , result . t_stop ) <EOL> def test_time_slice_out_of_boundries ( self ) : <EOL> self . train1 . t_start = <NUM_LIT:0.1> * pq . ms <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> t_start = <NUM_LIT> * pq . ms <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> result = self . train1 . time_slice ( t_start , t_stop ) <EOL> assert_arrays_equal ( self . train1 , result ) <EOL> assert_arrays_equal ( self . waveforms1 , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> def test_time_slice_empty ( self ) : <EOL> waveforms = np . array ( [ [ [ ] ] ] ) * pq . mV <EOL> train = SpikeTrain ( [ ] * pq . ms , t_stop = <NUM_LIT> , waveforms = waveforms ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> t_start = <NUM_LIT> * pq . ms <EOL> t_stop = <NUM_LIT> * pq . ms <EOL> result = train . time_slice ( t_start , t_stop ) <EOL> assert_arrays_equal ( train , result ) <EOL> assert_arrays_equal ( waveforms [ : - <NUM_LIT:1> ] , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( train . name , result . name ) <EOL> self . assertEqual ( train . description , result . description ) <EOL> self . assertEqual ( train . annotations , result . annotations ) <EOL> self . assertEqual ( train . file_origin , result . file_origin ) <EOL> self . assertEqual ( train . dtype , result . dtype ) <EOL> self . assertEqual ( t_start , result . t_start ) <EOL> self . assertEqual ( train . t_stop , result . t_stop ) <EOL> def test_time_slice_none_stop ( self ) : <EOL> t_start = <NUM_LIT:1> * pq . ms <EOL> result = self . train1 . time_slice ( t_start , None ) <EOL> assert_arrays_equal ( [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:7> ] * pq . ms , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> def test_time_slice_none_start ( self ) : <EOL> t_stop = <NUM_LIT:1> * pq . ms <EOL> result = self . train1 . time_slice ( None , t_stop ) <EOL> assert_arrays_equal ( [ <NUM_LIT:0.1> , <NUM_LIT:0.5> ] * pq . ms , result ) <EOL> targwaveforms = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> assert_arrays_equal ( targwaveforms , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( t_stop , result . t_stop ) <EOL> def test_time_slice_none_both ( self ) : <EOL> self . train1 . t_start = <NUM_LIT:0.1> * pq . ms <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result = self . train1 . time_slice ( None , None ) <EOL> assert_arrays_equal ( self . train1 , result ) <EOL> assert_arrays_equal ( self . waveforms1 , result . waveforms ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( self . train1 . name , result . name ) <EOL> self . assertEqual ( self . train1 . description , result . description ) <EOL> self . assertEqual ( self . train1 . annotations , result . annotations ) <EOL> self . assertEqual ( self . train1 . file_origin , result . file_origin ) <EOL> self . assertEqual ( self . train1 . dtype , result . dtype ) <EOL> self . assertEqual ( self . train1 . t_start , result . t_start ) <EOL> self . assertEqual ( self . train1 . t_stop , result . t_stop ) <EOL> class TestAttributesAnnotations ( unittest . TestCase ) : <EOL> def test_set_universally_recommended_attributes ( self ) : <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] , units = '<STR_LIT>' , name = '<STR_LIT:Name>' , <EOL> description = '<STR_LIT>' , file_origin = '<STR_LIT>' , <EOL> t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train . name , '<STR_LIT:Name>' ) <EOL> self . assertEqual ( train . description , '<STR_LIT>' ) <EOL> self . assertEqual ( train . file_origin , '<STR_LIT>' ) <EOL> def test_autoset_universally_recommended_attributes ( self ) : <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train . name , None ) <EOL> self . assertEqual ( train . description , None ) <EOL> self . assertEqual ( train . file_origin , None ) <EOL> def test_annotations ( self ) : <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train . annotations , { } ) <EOL> train = SpikeTrain ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s , t_stop = <NUM_LIT> , ratname = '<STR_LIT>' ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train . annotations , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> class TestChanging ( unittest . TestCase ) : <EOL> def test_change_with_copy_default ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , t_stop = <NUM_LIT> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT:3> * pq . s ) <EOL> def test_change_with_copy_false ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , copy = False , t_stop = <NUM_LIT> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> def test_change_with_copy_false_and_fake_rescale ( self ) : <EOL> data = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] * pq . ms <EOL> train = SpikeTrain ( data , units = '<STR_LIT>' , copy = False , t_stop = <NUM_LIT> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . ms <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . ms ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT> * pq . ms ) <EOL> def test_change_with_copy_false_and_rescale_true ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> self . assertRaises ( ValueError , SpikeTrain , data , units = '<STR_LIT>' , <EOL> copy = False , t_stop = <NUM_LIT> ) <EOL> def test_init_with_rescale ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , units = '<STR_LIT>' , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . ms ) <EOL> self . assertEqual ( train . _dimensionality , pq . ms . _dimensionality ) <EOL> self . assertEqual ( train . t_stop , <NUM_LIT> * pq . ms ) <EOL> def test_change_with_copy_true ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , copy = True , t_stop = <NUM_LIT:100> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT:3> * pq . s ) <EOL> def test_change_with_copy_default_and_data_not_quantity ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] <EOL> train = SpikeTrain ( data , units = '<STR_LIT>' , t_stop = <NUM_LIT:100> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT:3> * pq . s ) <EOL> def test_change_with_copy_false_and_data_not_quantity ( self ) : <EOL> data = np . array ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ) <EOL> train = SpikeTrain ( data , units = '<STR_LIT>' , copy = False , dtype = np . int , <EOL> t_stop = <NUM_LIT> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT> ) <EOL> def test_change_with_copy_false_and_dtype_change ( self ) : <EOL> data = np . array ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ) <EOL> self . assertRaises ( ValueError , SpikeTrain , data , units = '<STR_LIT>' , <EOL> copy = False , t_stop = <NUM_LIT> , dtype = np . float64 ) <EOL> def test_change_with_copy_true_and_data_not_quantity ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] <EOL> train = SpikeTrain ( data , units = '<STR_LIT>' , copy = True , t_stop = <NUM_LIT> ) <EOL> train [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:0> ] , <NUM_LIT:3> ) <EOL> def test_changing_slice_changes_original_spiketrain ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , copy = True , t_stop = <NUM_LIT> ) <EOL> result = train [ <NUM_LIT:1> : <NUM_LIT:3> ] <EOL> result [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertEqual ( train [ <NUM_LIT:1> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:1> ] , <NUM_LIT:4> * pq . s ) <EOL> def test_changing_slice_changes_original_spiketrain_with_copy_false ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . s <EOL> train = SpikeTrain ( data , copy = False , t_stop = <NUM_LIT> ) <EOL> result = train [ <NUM_LIT:1> : <NUM_LIT:3> ] <EOL> result [ <NUM_LIT:0> ] = <NUM_LIT> * pq . s <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> self . assertEqual ( train [ <NUM_LIT:1> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( data [ <NUM_LIT:1> ] , <NUM_LIT> * pq . s ) <EOL> def test__changing_spiketime_should_check_time_in_range ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , copy = False , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertRaises ( ValueError , train . __setitem__ , <NUM_LIT:0> , <NUM_LIT> * pq . ms ) <EOL> self . assertRaises ( ValueError , train . __setitem__ , <NUM_LIT:1> , <NUM_LIT> * pq . s ) <EOL> self . assertRaises ( ValueError , train . __setitem__ , <NUM_LIT:2> , <NUM_LIT> * pq . s ) <EOL> self . assertRaises ( ValueError , train . __setitem__ , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def test__changing_multiple_spiketimes ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , copy = False , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> train [ : ] = [ <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> ] * pq . ms <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_arrays_equal ( train , np . array ( [ <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> ] ) ) <EOL> def test__changing_multiple_spiketimes_should_check_time_in_range ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , copy = False , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> self . assertRaises ( ValueError , train . __setslice__ , <EOL> <NUM_LIT:0> , <NUM_LIT:3> , [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:11> ] * pq . ms ) <EOL> self . assertRaises ( ValueError , train . __setslice__ , <EOL> <NUM_LIT:0> , <NUM_LIT:3> , [ <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms ) <EOL> def test__rescale ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> result = train . rescale ( pq . s ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_neo_object_is_compliant ( result ) <EOL> assert_arrays_equal ( train , result ) <EOL> self . assertEqual ( result . units , <NUM_LIT:1> * pq . s ) <EOL> def test__rescale_same_units ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> result = train . rescale ( pq . ms ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> assert_arrays_equal ( train , result ) <EOL> self . assertEqual ( result . units , <NUM_LIT:1> * pq . ms ) <EOL> def test__rescale_incompatible_units_ValueError ( self ) : <EOL> data = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] * pq . ms <EOL> train = SpikeTrain ( data , t_start = <NUM_LIT:0.5> , t_stop = <NUM_LIT> ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> self . assertRaises ( ValueError , train . rescale , pq . m ) <EOL> class TestPropertiesMethods ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . data1 = [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] <EOL> self . data1quant = self . data1 * pq . ms <EOL> self . waveforms1 = np . array ( [ [ [ <NUM_LIT:0.> , <NUM_LIT:1.> ] , <EOL> [ <NUM_LIT:0.1> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] , <EOL> [ [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] ] ] ) * pq . mV <EOL> self . t_start1 = <NUM_LIT:0.5> <EOL> self . t_stop1 = <NUM_LIT> <EOL> self . t_start1quant = self . t_start1 * pq . ms <EOL> self . t_stop1quant = self . t_stop1 * pq . ms <EOL> self . sampling_rate1 = <NUM_LIT> * pq . Hz <EOL> self . left_sweep1 = <NUM_LIT> * pq . s <EOL> self . name1 = '<STR_LIT>' <EOL> self . description1 = '<STR_LIT>' <EOL> self . ann1 = { '<STR_LIT>' : [ <NUM_LIT:1> , <NUM_LIT:2> ] , '<STR_LIT>' : <NUM_LIT> } <EOL> self . train1 = SpikeTrain ( self . data1quant , <EOL> t_start = self . t_start1 , t_stop = self . t_stop1 , <EOL> waveforms = self . waveforms1 , <EOL> left_sweep = self . left_sweep1 , <EOL> sampling_rate = self . sampling_rate1 , <EOL> name = self . name1 , <EOL> description = self . description1 , <EOL> ** self . ann1 ) <EOL> def test__compliant ( self ) : <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> def test__repr ( self ) : <EOL> result = repr ( self . train1 ) <EOL> targ = '<STR_LIT>' <EOL> self . assertEqual ( result , targ ) <EOL> def test__duration ( self ) : <EOL> result1 = self . train1 . duration <EOL> self . train1 . t_start = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result2 = self . train1 . duration <EOL> self . train1 . t_start = self . t_start1quant <EOL> self . train1 . t_stop = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result3 = self . train1 . duration <EOL> self . assertEqual ( result1 , <NUM_LIT> * pq . ms ) <EOL> self . assertEqual ( result1 . units , <NUM_LIT:1.> * pq . ms ) <EOL> self . assertEqual ( result2 , None ) <EOL> self . assertEqual ( result3 , None ) <EOL> def test__spike_duration ( self ) : <EOL> result1 = self . train1 . spike_duration <EOL> self . train1 . sampling_rate = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result2 = self . train1 . spike_duration <EOL> self . train1 . sampling_rate = self . sampling_rate1 <EOL> self . train1 . waveforms = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result3 = self . train1 . spike_duration <EOL> self . assertEqual ( result1 , <NUM_LIT> / pq . Hz ) <EOL> self . assertEqual ( result1 . units , <NUM_LIT:1.> / pq . Hz ) <EOL> self . assertEqual ( result2 , None ) <EOL> self . assertEqual ( result3 , None ) <EOL> def test__sampling_period ( self ) : <EOL> result1 = self . train1 . sampling_period <EOL> self . train1 . sampling_rate = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result2 = self . train1 . sampling_period <EOL> self . train1 . sampling_rate = self . sampling_rate1 <EOL> self . train1 . sampling_period = <NUM_LIT> * pq . ms <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result3a = self . train1 . sampling_period <EOL> result3b = self . train1 . sampling_rate <EOL> self . train1 . sampling_period = None <EOL> result4a = self . train1 . sampling_period <EOL> result4b = self . train1 . sampling_rate <EOL> self . assertEqual ( result1 , <NUM_LIT> / pq . Hz ) <EOL> self . assertEqual ( result1 . units , <NUM_LIT:1.> / pq . Hz ) <EOL> self . assertEqual ( result2 , None ) <EOL> self . assertEqual ( result3a , <NUM_LIT> * pq . ms ) <EOL> self . assertEqual ( result3a . units , <NUM_LIT:1.> * pq . ms ) <EOL> self . assertEqual ( result3b , <NUM_LIT> / pq . ms ) <EOL> self . assertEqual ( result3b . units , <NUM_LIT:1.> / pq . ms ) <EOL> self . assertEqual ( result4a , None ) <EOL> self . assertEqual ( result4b , None ) <EOL> def test__right_sweep ( self ) : <EOL> result1 = self . train1 . right_sweep <EOL> self . train1 . left_sweep = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result2 = self . train1 . right_sweep <EOL> self . train1 . left_sweep = self . left_sweep1 <EOL> self . train1 . sampling_rate = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result3 = self . train1 . right_sweep <EOL> self . train1 . sampling_rate = self . sampling_rate1 <EOL> self . train1 . waveforms = None <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> result4 = self . train1 . right_sweep <EOL> self . assertEqual ( result1 , <NUM_LIT> * pq . s ) <EOL> self . assertEqual ( result1 . units , <NUM_LIT:1.> * pq . s ) <EOL> self . assertEqual ( result2 , None ) <EOL> self . assertEqual ( result3 , None ) <EOL> self . assertEqual ( result4 , None ) <EOL> def test__children ( self ) : <EOL> segment = Segment ( name = '<STR_LIT>' ) <EOL> segment . spiketrains = [ self . train1 ] <EOL> segment . create_many_to_one_relationship ( ) <EOL> unit = Unit ( name = '<STR_LIT>' ) <EOL> unit . spikes = [ self . train1 ] <EOL> unit . create_many_to_one_relationship ( ) <EOL> self . assertEqual ( self . train1 . _single_parent_objects , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . train1 . _multi_parent_objects , ( ) ) <EOL> self . assertEqual ( self . train1 . _single_parent_containers , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . train1 . _multi_parent_containers , ( ) ) <EOL> self . assertEqual ( self . train1 . _parent_objects , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( self . train1 . _parent_containers , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( len ( self . train1 . parents ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( self . train1 . parents [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( self . train1 . parents [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> assert_neo_object_is_compliant ( self . train1 ) <EOL> @ unittest . skipUnless ( HAVE_IPYTHON , "<STR_LIT>" ) <EOL> def test__pretty ( self ) : <EOL> res = pretty ( self . train1 ) <EOL> targ = ( "<STR_LIT>" + <EOL> "<STR_LIT>" % <EOL> ( self . name1 , self . description1 , pretty ( self . ann1 ) ) ) <EOL> self . assertEqual ( res , targ ) <EOL> class TestMiscellaneous ( unittest . TestCase ) : <EOL> def test__different_dtype_for_t_start_and_array ( self ) : <EOL> data = np . array ( [ <NUM_LIT:0> , <NUM_LIT> ] , dtype = np . float64 ) * pq . s <EOL> data16 = data . astype ( np . float16 ) <EOL> data32 = data . astype ( np . float32 ) <EOL> data64 = data . astype ( np . float64 ) <EOL> t_start = data [ <NUM_LIT:0> ] <EOL> t_stop = data [ <NUM_LIT:1> ] <EOL> t_start16 = data [ <NUM_LIT:0> ] . astype ( dtype = np . float16 ) <EOL> t_stop16 = data [ <NUM_LIT:1> ] . astype ( dtype = np . float16 ) <EOL> t_start32 = data [ <NUM_LIT:0> ] . astype ( dtype = np . float32 ) <EOL> t_stop32 = data [ <NUM_LIT:1> ] . astype ( dtype = np . float32 ) <EOL> t_start64 = data [ <NUM_LIT:0> ] . astype ( dtype = np . float64 ) <EOL> t_stop64 = data [ <NUM_LIT:1> ] . astype ( dtype = np . float64 ) <EOL> t_start_custom = <NUM_LIT:0.0> <EOL> t_stop_custom = <NUM_LIT> <EOL> t_start_custom16 = np . array ( t_start_custom , dtype = np . float16 ) <EOL> t_stop_custom16 = np . array ( t_stop_custom , dtype = np . float16 ) <EOL> t_start_custom32 = np . array ( t_start_custom , dtype = np . float32 ) <EOL> t_stop_custom32 = np . array ( t_stop_custom , dtype = np . float32 ) <EOL> t_start_custom64 = np . array ( t_start_custom , dtype = np . float64 ) <EOL> t_stop_custom64 = np . array ( t_stop_custom , dtype = np . float64 ) <EOL> train = SpikeTrain ( data64 , copy = True , t_start = t_start , t_stop = t_stop ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start16 , t_stop = t_stop16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start16 , t_stop = t_stop16 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start16 , t_stop = t_stop16 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start16 , t_stop = t_stop16 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start32 , t_stop = t_stop32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start32 , t_stop = t_stop32 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start32 , t_stop = t_stop32 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start32 , t_stop = t_stop32 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start64 , t_stop = t_stop64 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start64 , t_stop = t_stop64 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , <EOL> t_start = t_start_custom , t_stop = t_stop_custom , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom16 , t_stop = t_stop_custom16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom16 , t_stop = t_stop_custom16 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom16 , t_stop = t_stop_custom16 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom16 , t_stop = t_stop_custom16 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom32 , t_stop = t_stop_custom32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom32 , t_stop = t_stop_custom32 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom32 , t_stop = t_stop_custom32 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom32 , t_stop = t_stop_custom32 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom64 , t_stop = t_stop_custom64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom64 , t_stop = t_stop_custom64 , <EOL> dtype = np . float16 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom64 , t_stop = t_stop_custom64 , <EOL> dtype = np . float32 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start_custom64 , t_stop = t_stop_custom64 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , t_start = t_start , t_stop = t_stop ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data16 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , t_start = t_start , t_stop = t_stop ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , t_start = t_start , t_stop = t_stop , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start64 , t_stop = t_stop64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> train = SpikeTrain ( data32 , copy = True , <EOL> t_start = t_start64 , t_stop = t_stop64 , <EOL> dtype = np . float64 ) <EOL> assert_neo_object_is_compliant ( train ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
