histories module

Hints and guidelines

Time index tests

A key function of the History class is to compare a requested time index with its internal cache, and determine whether the data at that time index needs to be computed. How does this work with symbolic values ? The answer is that only the data are symbolic , not the axes. Symbolic time indices are allowed to have only one symbolic input – self._num_tidx – which is in fact a shared variable (i.e. it is associated to a concrete numerical value). So any time index can be evaluated with shim.eval() – the obtained value will depend on the current value of self._num_tidx, but differences between these values do not. So tests like:

shim.eval(symbolic_idx) <= shim.eval(self._sym_tidx)

always make sense: the difference between the left and right-hand side is conserved, even if their numerical values change.

One might wonder whether calling shim.eval everywhere like this is wise, given the cost of compilation. This is actually fine for a few reasons:
  • Only simply index arithmetic is allowed, so the compilation time is quite short (although still perceptible).
  • Theano caches compilations, so after the first one this is as fast as a normal function call. This is the reason it is preferable to do shim.eval(_sym_tidx) - 1 over shim.eval(_sym_tidx - 1).
  • These compilation costs are only incurred when building the graph – they don’t show up in the final computational graph, and so don’t affect runtime.

Full API

History Classes

sinn.histories.History
sinn.histories.Series
sinn.histories.Spiketrain

Other classes

sinn.histories.TimeAxis
sinn.histories.HistoryUpdateFunction

History methods

sinn.histories.History.__call__
sinn.histories.History.__getitem__
sinn.histories.History.__setitem__
sinn.histories.History.update
sinn.histories.History.clear
sinn.histories.History.lock
sinn.histories.History.unlock
sinn.histories.History.theano_reset
sinn.histories.History.truncate
sinn.histories.History.align_to
sinn.histories.History.interpolate
sinn.histories.History.time_interval
sinn.histories.History.index_interval
sinn.histories.History.get_time
sinn.histories.History.get_tidx
sinn.histories.History.convolve
sinn.histories.History._compute_up_to
sinn.histories.History.get_time_stops
sinn.histories.History._getitem_internal
sinn.histories.History._is_batch_computable

History attributes

sinn.histories.History.copy
sinn.histories.History.copy

History: Pydantic methods and validators

sinn.histories.History.copy
sinn.histories.History.parse_obj
sinn.histories.History.default_name
sinn.histories.History.normalize_dtype
sinn.histories.History.default_symbolic
sinn.histories.History.initialized_data

Attributes

Methods