Skip to content

chronos⚓︎

Time sequence management, notably Chronology and Ticker.

Chronology ⚓︎

Time schedules with consistency checks.

  • Uses int records, so tt[k] == k*dt.
  • Uses generators, so time series may be arbitrarily long.

Example illustration:

                     [----dto------]
              [--dt--]
tt:    0.0    0.2    0.4    0.6    0.8    1.0    T
kk:    0      1      2      3      4      5      K
       |------|------|------|------|------|------|
ko:    None   None   0      None   1      None   Ko
kko:                 2             4             6
                     [----dko------]

Warning

By convention, there is no obs at 0. This is hardcorded in DAPPER, whose cycling starts by the forecast.

Identities (subject to precision):

len(kk)  == len(tt)  == K   +1
len(kko) == len(tto) == Ko+1

kko[0]   == dko      == dto/dt == K/(Ko+1)
kko[-1]  == K        == T/dt
Ko       == T/dto-1

These attributes may be set (altered) after init: dt, dko, K, T. Setting other attributes (alone) is ambiguous (e.g. should dto*=2 yield a doubling of T too?), and so should/will raise an exception.

mask ⚓︎

Example use: kk_BI = kk[mask]

masko ⚓︎

Example use: kko_BI = kko[masko]

ticker ⚓︎

Fancy version of range(1,K+1).

Also yields t, dt, and ko.

copy() ⚓︎

Copy via state vars.

cycle(ko) ⚓︎

The range (in kk) between observation ko-1 and ko.

Also yields t and dt.

Ticker ⚓︎

Iterator over kk and kko, yielding (k,ko,t,dt).

Includes __len__ for progressbar usage.

ko = kko.index(k), or None otherwise, but computed without this repeated look-up operation.