Module Glm.Filter

type t
val to_col : t -> Owl.Mat.mat
val width : t -> int
val n_channels : t -> int
val from_channels : t array -> t

from_channels a creates a multi-channel filter out of an array of single-channel filters

val combine : t array -> Owl.Mat.mat -> t

combine bank weights computes a weighted sum of the filters

val get_weights : t array -> t -> Owl.Mat.mat

get_weights bank filter computes the weights w such that combine bank w equals filter.

val exponential : tau:float -> float -> float

Simple exponential filter exp(-t/tau), normalised to unit integral

val alpha : tau:float -> float -> float

Alpha filter t*exp(-t/tau), normalised to unit integral

val causal_from_fun : dt:float -> t_max:float -> (float -> float) -> t

causal_from_fun ~dt ~t_max f creates a filter using function f (e.g. exponential ~tau or alpha ~tau), over a time window [-t_max : t_max] and with time discretized in bins of size dt. really_causal (defaults to false) enforces that the convolution of a signal with the resulting filter will be "numerically causal", e.g. the effect of a spike in the signal is only felt in the next time bin after convolution.

val causal_bank : dt:float -> t_max:float -> tau_min:float -> c:float -> int -> t array

causal_bank ~dt ~t_max ~tau_min ~c n creates a mixed bank of n exponential and n alpha causal (or really_causal, see causal_from_fun) filters, over a time window [-t_max : t_max] discretised with time resolution dt. The time constants of these filters are tau_min * (c ^ i) for i=0, ..., n-1.

val bank : dt:float -> t_max:float -> tau_min:float -> c:float -> int -> t array

Same as causal_bank except that it also includes the anti-causal version of each filter, resulting in (4n) filters altogether.

val plot : t array -> (module Gp.Plot) -> unit

Creates a figure (plottable using Gp.draw) to illustrate the filters; filters are normalized to unit peak for visualisation purposes.

val convolve : ?strictly_causal:bool -> Owl.Mat.mat -> t -> Owl.Mat.mat

convolve signal filter.