Signal

class asammdf.signal.Signal(samples=None, timestamps=None, unit='', name='', info=None, comment='')[source]

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 | list | tuple

signal samples

timestamps : numpy.array | list | tuple

signal timestamps

unit : str

signal unit

name : str

signal name

info : dict

dict that contains extra information about the signal , default None

comment : str

signal comment, default ‘’

astype(np_type)[source]

returns new Signal with samples of dtype np_type

cut(start=None, stop=None)[source]

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:

result : 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
extend(other)[source]

extend signal with samples from another signal

Parameters:other : Signal
interp(new_timestamps)[source]

returns a new Signal interpolated using the new_timestamps

plot()[source]

plot Signal samples