Skip to content

Unary operations on TimeSeries #170

Open
@mvcisback

Description

@mvcisback

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions