IntrinsicTimescales.jl is a software package for estimating Intrinsic Neural Timescales (INTs) from time-series data. It uses model-free methods (ACW-50, ACW-0, fitting an exponential decay function etc.) and simulation-based methods (adaptive approximate Bayesian computation: aABC, automatic differentiation variational inference: ADVI) to estimate INTs.
The documentation is available here.
This package is written in Julia. If you do not have Julia installed, you can install it from here. Once you have Julia installed, you can install IntrinsicTimescales.jl by running the following command in the Julia REPL:
using Pkg
Pkg.add("IntrinsicTimescales")
Soon, there will also be a Python wrapper called INTpy, which will allow you to use IntrinsicTimescales.jl from Python.
IntrinsicTimescales.jl uses two ways to estimate INTs: model-free methods and simulation-based inference. Model-free methods include ACW-50, ACW-0, ACW-e, area under the curve (AUC), decay rate of an exponential fit to ACF and knee freqency of a lorentzian fit to PSD. Simulation-based methods are based on Zeraati et al. (2022) paper and do parameter estimation by assuming the data came from an Ornstein-Uhlenbeck process. For estimation, in addition to the adaptive approximate Bayesian computation (aABC) method used in Zeraati et al. (2022), we also present automatic differentiation variational inference (ADVI). Additionally, we adapt the aABC method with adaptive choice of epsilon. See documentation for details.
For model-free methods, simply use the acw
function.
using IntrinsicTimescales
data = randn(10, 5000) # Data in the form of (trials x time)
fs = 100.0 # Sampling frequency
acwresults = acw(data, fs; acwtypes = [:acw0, :acw50, :acweuler, :auc, :tau, :knee], dims=ndims(data))
# or even simpler:
acwresults = acw(data, fs)
where fs
is sampling frequency, optional parameters acwtypes
is a vector of
symbols (indicated with :
) telling which methods to use and dims
is indicating the dimension of time in your array (by default, the last dimension). The resulting acwresults
gives the results in the same order of acwtypes
.
For simulation based methods, pick one of the one_timescale_model
, one_timescale_with_missing_model
, one_timescale_and_osc_model
and one_timescale_and_osc_with_missing_model
functions. These models correspond to different generative models depending on whether there is an oscillation or not. For each generative model, there are with or without missing variants which use different ways to calculate ACF and PSD. Once you pick the model, the syntax is
data = randn(10, 5000) # Data in the form of (trials x time)
time = 1:5000 # Time vector
model = one_timescale_model(data, time, :abc)
result = int_fit(model)
or
model = one_timescale_model(data, time, :advi)
result = int_fit(model)
These functions are highly customizable, see the documentation for details.
Questions and contributions are welcome. Use the issues section of our github page to report bugs, make feature requests, ask questions or tackle the issues by making pull requests.
The current roadmap of the package is here. Feel free to make suggestions / contributions.
This project is licensed under the MIT License - see the LICENSE file for details. Note that certain dependencies (such as FFTW) may not have MIT licenses.