Giter Site home page Giter Site logo

sparsetimeseries.jl's Introduction

SparseTimeSeries

Build Status Codecov

If you are looking for general time series functionality, check out the much more mature TimeSeries.jl package first.

Functionality overview

The package supports, value of arbitrary type and any timestamp which can be sorted.

The key data types are the Event, which wraps a (timestamp, value) pair; the Segment which wraps a (time start, time end, value) triplet; the EventSeries (subtype of AbstracVector), which holds the time series.

The EventSeries has, in addition to the standard AbstracVector interface, the following methods:

  • align(::EventSeries...) returns a tuple of EventSeries containing subsets of the corresponding series input, such that the time domain of each output series corresponds to the largest common time domain of the input series. (See select below.)
  • cumtime(::EventSeries, value) returns the cumulative time for which the series takes the input value.
  • fill_forward_event(::EventSeries, time) returns the most recent Event prior to input time.
  • fill_forward_value(::EventSeries, time) returns the most recent value prior to input time.
  • fuse(;named_eventseries) returns a new a new EventSeries with time sorted Events for each timestamp in the input series, where the values are named tuples containing the fill forward value of all input time series.
  • segments(events) returns an iterator over all Segements defined by consecutive Events in the input.
  • select(::EventSeries, tstart, tend) returns an EventSeries which is a subset of the input series, containing the Events in the time domain [tstart, tend]. The endpoint values are set by filling forward.
  • splice(;named_eventseries...) returns a new a new EventSeries with time sorted Events for each timestamp in the input series, where the values are values are name-value pairs.

sparsetimeseries.jl's People

Contributors

jonalm avatar juliatagbot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

sparsetimeseries.jl's Issues

creating event series from an iterable of events

Is there an easy way to create an EventSeries out from an iterable of Events ?

julia> a = Event(123,"abc"); b = Event(456,"def"); c = Event(789,"ghi");
julia> s = EventSeries([a,b,c])
# I would expect this:
3-element EventSeries{Int64,Array{Int64,1},String,Array{String,1}}:
 {timest.: 123, value: abc}
 {timest.: 456, value: def}
 {timest.: 789, value: ghi}

strict selection for time series

select behavior for EventSeries is hard to understand:

julia> e = EventSeries([123, 456, 789], ["abc", "def", "ghi"])
3-element EventSeries{Int64,Array{Int64,1},String,Array{String,1}}:
 {timest.: 123, value: abc}
 {timest.: 456, value: def}
 {timest.: 789, value: ghi}

julia> select(e, 200, 600)
3-element EventSeries{Int64,Array{Int64,1},String,Array{String,1}}:
 {timest.: 200, value: abc}
 {timest.: 456, value: def}
 {timest.: 600, value: def}

julia> select(e, 200, 900)
ERROR: AssertionError: invaid time limits
Stacktrace:
 [1] select(::EventSeries{Int64,Array{Int64,1},String,Array{String,1}}, ::Int64, ::Int64) at /home/hugo/.julia/packages/SparseTimeSeries/25lgY/src/series_types.jl:219
 [2] top-level scope at REPL[36]:1
  1. when selecting between 200 and 600, select seems to feed backwards instead of forward as mentioned in help
  2. when selecting outside limits, the message says invaid (typo)
  3. there could be an option to select events strictly between boundaries

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.