Signal¶
-
class
asammdf.signal.
Signal
(samples=None, timestamps=None, unit='', name='', conversion=None, comment='')¶ The Signal represents a signal described by it’s samples and timestamps. It can do aritmethic operations agains other Signal or numeric type. The operations are computed in respect to the timestamps (time correct). The integer signals are not interpolated, instead the last value relative to the current timestamp is used. samples, timstamps and name are mandatory arguments.
Parameters: samples : numpy.array
signal samples
timestamps : numpy.array
signal timestamps
unit : str
signal unit
name : str
signal name
conversion : dict
dict describing the channel conversion , default None
comment : str
signal comment, default ‘’
Methods
astype
cut
interp
plot
-
astype
(np_type)¶ returns new Signal with samples of dtype np_type
-
cut
(start, stop)¶ Cuts the signal according to the start and stop values, by using the insertion indexes in the signal’s time axis.
Parameters: start : float
start timestamp for cutting
stop : float
stop timestamp for cutting
Returns: outsig : Signal
new Signal cut from the original
Examples
>>> new_sig = old_sig.cut(1.0, 10.5) >>> new_sig.timestamps[0], new_sig.timestamps[-1] 0.98, 10.48
-
interp
(new_timestamps)¶ returns a new Signal interpolated using the new_timestamps
-
plot
()¶ plot Signal samples
-