Open
Description
Given the current API (v0.3.1) there does not seem to be a straightforward way to do a unary operation.
Suppose one wishes to negate a boolean valued signal. One option is:
import traces
x = traces.TimeSeries([(0, False), (1, True)])
x.operation(x, lambda val, _: not val)
but this seems somewhat clunky.
Better might be
import traces
x = traces.TimeSeries([(0, True), (1, False)])
x.map(lambda val: not val)
Which could be syntatic sugar for:
traces.TimeSeries((t, not val) for (t, v) in x))
Metadata
Metadata
Assignees
Labels
No labels