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

Fenceposting with atTime? #45

Closed
mookerji opened this issue Sep 22, 2016 · 0 comments
Closed

Fenceposting with atTime? #45

mookerji opened this issue Sep 22, 2016 · 0 comments

Comments

@mookerji
Copy link

mookerji commented Sep 22, 2016

This is mildly related to #44. I was writing some of my own tests my use of TimeSeries when I noticed that I was missing some events when using atTime and bisect. Here's an example:

      let eventSource = new UnboundedIn();
      let collection = new Collection();
      let timeseries = new TimeSeries({name: "test",
                                       collection: collection});
      let pipeline = new Pipeline()
          .from(eventSource)
          .to(EventOut,
              event =>
              { collection = collection.addEvent(event);
                timeseries = new TimeSeries({name: "test",
                                             collection: collection});});
      assert(collection.size() == 0);
      assert(timeseries.size() == 0);
      eventSource.addEvent(new Event(time1, {value: 2}));
      assert(collection.size() == 1);
      assert(timeseries.size() == 1);
      console.log("timeseries" + timeseries.toString()); 
        // => {"name":"test","utc":true,"columns":["time","value"],"points":[[1465084800000,2]]}
      console.log("time1 index " + timeseries.bisect(time1)); 
        // => 0
      console.log("index 0 " + timeseries.at(0)); 
        // => {"time":1465084800000,"data":{"value":2}}
      console.log("using timeAt " + timeseries.atTime(time1)); 
        // => undefined :(

I think this is because at https://github.com/esnet/pond/blob/master/src/pond/lib/collection.js#L192, instead of if (pos && ....) you actually want if (pos >= 0 && ...).

pjm17971 pushed a commit that referenced this issue Oct 18, 2016
Also, fixed the script for building the docs and updated everything.
@pjm17971 pjm17971 mentioned this issue Oct 18, 2016
pjm17971 added a commit that referenced this issue Oct 18, 2016
v0.7.1
- renaming columns now does so with mapKeys, rather than breaking the whole thing apart
- fixes merging of TimeSeries so that if the result isn't chronological then it will sort them before trying to make a new TimeSeries
- fixes atTime() boundary condition (#45)
- fixed align processors to handle initial events that are already aligned
- internal calls to setCollection can skip the isChronological test with a flag since they know they are maintaining order.
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