Liking cljdoc? Tell your friends :D

std.timeseries.common


+default+clj


clusterclj

(cluster arr n f)

clusters a space with an aggregate function

(cluster (range 1 200) 10 math/mean) => [10 29 48 67 86 105 124 143 162 181]

clusters a space with an aggregate function

(cluster (range 1 200) 10  math/mean)
=> [10 29 48 67 86 105 124 143 162 181]
raw docstring

create-templateclj

(create-template entry)

creates a template for entry

creates a template for entry
raw docstring

durationclj

(duration arr {:keys [key unit order]})

calculates the duration from array and options

(duration [1 2 3 4] {:key identity :unit :m}) => 180000

calculates the duration from array and options

(duration [1 2 3 4] {:key identity :unit :m})
=> 180000
raw docstring

flat-fnclj

(flat-fn template)

creates a nested to flat transform

(def transform-fn (flat-fn (raw-template {:a {:b {:c 1}}})))

(transform-fn {:a {:b {:c 10}}}) => {:a.b.c 10}

creates a nested to flat transform

(def transform-fn (flat-fn (raw-template {:a {:b {:c 1}}})))

(transform-fn {:a {:b {:c 10}}})
=> {:a.b.c 10}
raw docstring

from-msclj

(from-ms ms to)

converts ms time into a given unit

(from-ms 100 :ns) => 100000000

converts ms time into a given unit

(from-ms 100 :ns)
=> 100000000
raw docstring

from-nsclj

(from-ns ns to)

converts a time from ns

converts a time from ns
raw docstring

linspaceclj

(linspace arr n)

takes the linear space of n samples

(linspace (range 100) 10) => [0 11 22 33 44 55 66 77 88 99]

takes the linear space of n samples

(linspace (range 100) 10)
=> [0 11 22 33 44 55 66 77 88 99]
raw docstring

make-emptyclj

(make-empty entry)

creates an empty entry given structure

(make-empty {:a 1 :b "hello" :c :world}) => {:a 0, :b "", :c nil}

creates an empty entry given structure

(make-empty {:a 1 :b "hello" :c :world})
=> {:a 0, :b "", :c nil}
raw docstring

nest-fnclj

(nest-fn template)

creates a nested to flat transform

(def transform-fn (nest-fn (raw-template {:a {:b {:c 1}}})))

(transform-fn {:a.b.c 10}) => {:a {:b {:c 10}}}

creates a nested to flat transform

(def transform-fn (nest-fn (raw-template {:a {:b {:c 1}}})))

(transform-fn {:a.b.c 10})
=> {:a {:b {:c 10}}}
raw docstring

order-compclj


order-comp-eqclj


order-flipclj

(order-flip order)

returns the opposite of the order

(order-flip :asc) => :desc

returns the opposite of the order

(order-flip :asc)
=> :desc
raw docstring

order-fnclj

(order-fn [asc desc])

creates a function that returns or flips the input

(mapv (order-fn [:up :down]) [:asc :desc] [false true]) => [:up :up]

creates a function that returns or flips the input

(mapv (order-fn [:up :down])
      [:asc :desc]
      [false true])
=> [:up :up]
raw docstring

order-fnsclj

(order-fns order)
(order-fns order flip)

returns commonly used functions

(order-fns :asc) => {:comp-fn <, :comp-eq-fn <=, :op-fn +}

returns commonly used functions

(order-fns :asc)
=> {:comp-fn <, :comp-eq-fn <=, :op-fn +}
raw docstring

order-opclj


parse-sample-exprclj

(parse-sample-expr sample time-opts)

parses a sample expression

(parse-sample-expr [10] {}) => {:size 10, :strategy :linear}

parses a sample expression

(parse-sample-expr [10] {})
=> {:size 10, :strategy :linear}
raw docstring

parse-timeclj

(parse-time s)
(parse-time s unit)

parses a string or keyword time representation

(parse-time :0.1m :us) => 6000000

(parse-time :0.5ms :us) => 500

parses a string or keyword time representation

(parse-time :0.1m :us)
=> 6000000

(parse-time :0.5ms :us)
=> 500
raw docstring

parse-time-exprclj

(parse-time-expr m)

parses a time expression

(parse-time-expr {:interval "0.5ms"}) => {:key identity, :unit :ms, :order :asc, :interval 0}

parses a time expression

(parse-time-expr {:interval "0.5ms"})
=> {:key identity, :unit :ms, :order :asc, :interval 0}
raw docstring

process-sampleclj

(process-sample arr {:keys [size strategy every] :as m} time-opts)

process sample given sampling function

(process-sample (range 100) (parse-sample-expr [10 :random] {}) {:key identity :order :asc}) ;; (4 20 39 51 51 60 70 72 89 96) => coll?

;; extended sampling function from range (process-sample (range 100) (parse-sample-expr [[0 :10ms] :range] {:key identity :order :asc :unit :ms}) {:key identity :order :asc :unit :ms}) => [0 1 2 3 4 5 6 7 8 9 10]

process sample given sampling function

(process-sample (range 100)
                (parse-sample-expr [10 :random] {})
                {:key identity :order :asc})
;; (4 20 39 51 51 60 70 72 89 96)
=> coll?

;; extended sampling function from range
(process-sample (range 100)
                (parse-sample-expr [[0 :10ms] :range] {:key identity :order :asc :unit :ms})
                {:key identity :order :asc :unit :ms})
=> [0 1 2 3 4 5 6 7 8 9 10]
raw docstring

raw-templateclj

(raw-template entry)

creates a template for nest/flat mapping

(raw-template {:a {:b 1 :c "2"}}) => {:nest {:a {:b "{{a.b}}", :c "{{a.c}}"}}, :flat {:a.b "{{a.b}}", :a.c "{{a.c}}"}, :types {:a.b java.lang.Long, :a.c java.lang.String} :empty {:a.b 0, :a.c ""}}

creates a template for nest/flat mapping

(raw-template {:a {:b 1 :c "2"}})
=> {:nest {:a {:b "{{a.b}}",
               :c "{{a.c}}"}},
    :flat {:a.b "{{a.b}}",
           :a.c "{{a.c}}"},
    :types {:a.b java.lang.Long,
            :a.c java.lang.String}
    :empty {:a.b 0, :a.c ""}}
raw docstring

sampling-fncljmultimethod

extensible sampling function

extensible sampling function
raw docstring

sampling-parsercljmultimethod

extensible parser function

extensible parser function
raw docstring

to-msclj

(to-ms ms from)

converts a time to ms time

(to-ms 10000 :ns) => 0

(to-ms 10000 :s) => 10000000

converts a time to ms time

(to-ms 10000 :ns)
=> 0

(to-ms 10000 :s)
=> 10000000
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close