Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domains lost when using TimeSeries.operation method #169

Open
mvcisback opened this issue Nov 13, 2017 · 3 comments
Open

Domains lost when using TimeSeries.operation method #169

mvcisback opened this issue Nov 13, 2017 · 3 comments

Comments

@mvcisback
Copy link

Minimal Example using traces v0.3.1

import traces
x = traces.TimeSeries([(0, True), (10, False)], domain=(0, 20))
x.domain  # (0, 20)
y = x.operation(x, lambda a,b: a^b)
y.domain  # (-inf, inf)

It seems to me that y's domain should still be (0, 20). From an API standpoint, if applying a binary operation on x1 and x2, I think that it'd be simpler to have the resulting domain be x1.domain & x2.domain

@mvcisback
Copy link
Author

Ah I see that domains have been removed for some reason on master (making this somewhat moot).

Searching around I couldn't seem to find a reason for this. Could someone provide a reference or reason?

@stringertheory
Copy link
Owner

Hi, thanks for opening the issue. We removed domains because people were finding them confusing, and we were finding that they were rarely used. It didn't seem like the minimal value they were adding was worth the confusion in explaining them. Would you mind sharing a more complete use case of how you are using domains and why they are useful? (and perhaps how ugly it would be without them)

@mvcisback
Copy link
Author

@stringertheory I am developing a library py-stl for working within Metric Temporal Logic and Signal Temporal Logic.

These are often used to determine if a time series signal meets some specification (for filtering perhaps). For example, one may write G[0, 10]((x > 0) -> F[0, 1](y < -1)) which translates to:

Between time 0 and 10, if x is greater than zero, then within the next 1 time steps y will be less than negative one.

My library would take the two signals x(t) and y(t) and evaluate the above formula. The problem is if x and y are defined on different domains, then the result may not be well defined.

For example, if x.domain = (0, 10), but y.domain = (0, 4), then the above formula is only defined if for all t > 4, x(t) = False.

It's worth noting that I made the design decision to make x and y different TimeSeries objects since it means I can often compress x > 0 and y < -1 quite abit using the compact method. This makes evaluation much more efficent, particularly if one is interested in at what time points a particular formula is True (similar to doing a sliding window and evaluating the formula on the window).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants