@@ -26,7 +26,7 @@ class AnnotationSeries(TimeSeries):
2626 {'name' : 'data' , 'type' : ('array_data' , 'data' , TimeSeries ),
2727 'doc' : 'The data this TimeSeries dataset stores. Can also store binary data e.g. image frames' ,
2828 'default' : list ()},
29- {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ),
29+ {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ), 'shape' : ( None , ),
3030 'doc' : 'Timestamps for samples stored in data' , 'default' : None },
3131 {'name' : 'comments' , 'type' : str ,
3232 'doc' : 'Human-readable comments about this TimeSeries dataset' , 'default' : 'no comments' },
@@ -68,19 +68,18 @@ class AbstractFeatureSeries(TimeSeries):
6868 _help = "Features of an applied stimulus. This is useful when storing the raw stimulus is impractical."
6969
7070 @docval ({'name' : 'name' , 'type' : str , 'doc' : 'The name of this TimeSeries dataset' },
71- {'name' : 'feature_units' , 'type' : (str , Iterable ), 'doc' : 'The unit of each feature' },
72- {'name' : 'features' , 'type' : (str , Iterable ), 'doc' : 'Description of each feature' },
73-
74- {'name' : 'data' , 'type' : ('array_data' , 'data' , TimeSeries ),
75- 'doc' : 'The data this TimeSeries dataset stores. Can also store binary data e.g. image frames' ,
76- 'default' : list ()},
71+ {'name' : 'feature_units' , 'type' : Iterable , 'shape' : (None , ), 'doc' : 'The unit of each feature' },
72+ {'name' : 'features' , 'type' : Iterable , 'shape' : (None , ), 'doc' : 'Description of each feature' },
73+ {'name' : 'data' , 'type' : ('array_data' , 'data' , TimeSeries ), 'shape' : ((None ,), (None , None )),
74+ 'default' : list (),
75+ 'doc' : 'The data this TimeSeries dataset stores. Can also store binary data e.g. image frames' },
7776 {'name' : 'resolution' , 'type' : float ,
7877 'doc' : 'The smallest meaningful difference (in specified unit) between values in data' ,
7978 'default' : _default_resolution },
8079 {'name' : 'conversion' , 'type' : float ,
8180 'doc' : 'Scalar to multiply each element in data to convert it to the specified unit' ,
8281 'default' : _default_conversion },
83- {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ),
82+ {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ), 'shape' : ( None , ),
8483 'doc' : 'Timestamps for samples stored in data' , 'default' : None },
8584 {'name' : 'starting_time' , 'type' : float , 'doc' : 'The timestamp of the first sample' , 'default' : None },
8685 {'name' : 'rate' , 'type' : float , 'doc' : 'Sampling rate in Hz' , 'default' : None },
@@ -105,8 +104,11 @@ def __init__(self, **kwargs):
105104 {'name' : 'features' , 'type' : (list , np .ndarray ), 'doc' : 'the feature values for this time point' })
106105 def add_features (self , ** kwargs ):
107106 time , features = getargs ('time' , 'features' , kwargs )
108- self .timestamps .append (time )
109- self .data .append (features )
107+ if type (self .timestamps ) == list and type (self .data ) is list :
108+ self .timestamps .append (time )
109+ self .data .append (features )
110+ else :
111+ raise ValueError ('Can only add feature if timestamps and data are lists' )
110112
111113
112114@register_class ('IntervalSeries' , CORE_NAMESPACE )
@@ -116,7 +118,7 @@ class IntervalSeries(TimeSeries):
116118 data field stores whether the interval just started (>0 value) or ended (<0 value). Different interval
117119 types can be represented in the same series by using multiple key values (eg, 1 for feature A, 2
118120 for feature B, 3 for feature C, etc). The field data stores an 8-bit integer. This is largely an alias
119- of a standard TimeSeries but that is identifiable as representing time intervals in a machinereadable
121+ of a standard TimeSeries but that is identifiable as representing time intervals in a machine-readable
120122 way.
121123 """
122124
@@ -125,9 +127,9 @@ class IntervalSeries(TimeSeries):
125127 _help = "Stores the start and stop times for events."
126128
127129 @docval ({'name' : 'name' , 'type' : str , 'doc' : 'The name of this TimeSeries dataset' },
128- {'name' : 'data' , 'type' : ('array_data' , 'data' , TimeSeries ),
130+ {'name' : 'data' , 'type' : ('array_data' , 'data' , TimeSeries ), 'shape' : ( None ,),
129131 'doc' : '>0 if interval started, <0 if interval ended.' , 'default' : list ()},
130- {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ),
132+ {'name' : 'timestamps' , 'type' : ('array_data' , 'data' , TimeSeries ), 'shape' : ( None ,),
131133 'doc' : 'Timestamps for samples stored in data' , 'default' : list ()},
132134 {'name' : 'comments' , 'type' : str ,
133135 'doc' : 'Human-readable comments about this TimeSeries dataset' , 'default' : 'no comments' },
0 commit comments