Skip to content

Releases: neurolib-dev/neurolib

Hotfix and getIndividualFromHistory()

10 Aug 18:10
14a768c
Compare
Choose a tag to compare

A small update with two minor changes. Thanks everyone for reporting issues! 🛠

  • Hotfix: include pypet_logging.ini in pypi package
  • Evolution: new method getIndividualFromHistory()

Bugfixes, examples and preparations for something big

13 Jul 12:42
c5ace61
Compare
Choose a tag to compare

Bugfixes:

  • example-0.5: Demonstrating the use of external stimuli on brain networks
  • example-1.3: 2D bifurcation diagrams using pypet
  • bold: BOLD numerical overflow bug fixed
  • evolution: dfEvolution and dfPop fix
  • exploration: fix seed for random initial conditions
  • various minor bugfixes

Hotfix: RNG seed

14 Jun 11:20
a7aa6f4
Compare
Choose a tag to compare

🔥 Hotfix for RNG seed in exploration: Seed None is now converted to "None" for for pypet compatibility only when saving the model.params to the trajectory.

🛠 Fix: dfEvolution drops duplicate entries from the evolution.history.

Happy computing 👩🏿‍🔬!

Stimulus construction

04 Jun 15:35
6da23b7
Compare
Choose a tag to compare
  • 💪🏾 New function func.construct_stimulus()
  • 🌈 New example of stimulus usage: examples/example-0.5-aln-external-stimulus.ipynb
  • 👩🏿‍🚒 Fixed RNG seed bug, where the seed value None was converted to 0 (because of pypet) and lead to a predictable random number generator

image

aln: record adaptation currents

26 May 18:08
e005c3f
Compare
Choose a tag to compare

🌈Model update:

aln now records adaptation currents! Accessible via model.outputs.IA

image

Exploration and Evolution: improvements

19 May 20:38
6288ba8
Compare
Choose a tag to compare

Release time 💪🏾!

Version 0.5.1 of neurolib is out and we have some juicy improvements for exploration and evolution!

Evolution:

  • NSGA-2 algorithm implemented (Deb et al. 2002)
  • Preselect complete algorithms (using algorithm="adaptive" or "nsga2")
  • Implement custom operators for all evolutionary operations
  • Keep track of the evolution history using evolution.history
  • Genealogy evolution.tree available from evolution.buildEvolutionTree() that is networkx compatible [1]
  • Continue working: saveEvolution() and loadEvolution() can load an evolution from another session [2]
  • Overview dataframe evolution.dfPop now has all fitness values as well
  • Get scores using getScores()
  • Plot evolution progress with evolutionaryUtils.plotProgress()

Exploration:

  • Use loadResults(all=True) to load all simulated results from disk to memory (available as .results) or use all=False to load runs individually from hdf. Both options populate dfResults.
  • loadResults() has memory cap to avoid filling up RAM
  • loadDfResults() creates the parameter table from a previous simulation
  • explorationUtils.plotExplorationResults() for plotting 2D slices of the explored results with some advanced functions like alpha maps and contours for predefined regions.

devUtils

  • A module that we are using for development and research with some nice features. Please do not rely on this file since there might be breaking changes in the future.
    • plot_outputs() like a true numerical simlord
    • model_fit() to compute the model's FC and FCD fit to the dataset, could be usefull for everyone
    • getPowerSpectrum() does what is says
    • getMeanPowerSpectrum() same
    • a very neat rolling_window() from a numpy PR that never got accepted

Other:

  • Data loading:
    • Dataset can load different SC matrix normalizations: "max", "waytotal", "nvoxel"
    • Can precompute FCD matrices to avoid having to do it later (fcd=True)
  • neurolib/utils/atlas.py added with aal2 region names (thanks @jajcayn) and coordinates of centers of regions (from scans of @caglorithm's brain 🤯)
  • ParameterSpace has .lowerBound and .upperBound.
  • pypet finally doesn't create a billion log files anymore due to a custom log config

[1] Plotting the genealogy tree:

import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_pydot import graphviz_layout

G = nx.DiGraph(evolution.tree)
G = G.reverse()     # Make the graph top-down
pos = graphviz_layout(G, prog='dot')
plt.figure(figsize=(8, 8))
nx.draw(G, pos, node_size=50, alpha=0.5, node_color=list(evolution.id_score.values()), with_labels=False)
plt.show()

tree

[2] Loading precomputed evolution

evaluateSimulation = lambda x: x # the funciton can be ommited, that's why we define a lambda here
pars = ParameterSpace(['a', 'b'], # should be same as previously saved evolution
                      [[0.0, 4.0], [0.0, 5.0]])
evolution = Evolution(evaluateSimulation, pars, weightList = [1.0])
evolution = evolution.loadEvolution("data/evolution-results-2020-05-15-00H-24M-48S.dill")

Thalamic neural mass model and Exploration tools

08 Apr 19:57
52a26de
Compare
Choose a tag to compare

We're happy to introduce a few new features in this release!

  • 🧠 New model: Thalamus model ThalamicMassModel (thanks to @jajcayn)
    • Model by Costa et al. 2016, PLOS Computational Biology
  • ⚒ New tools for parameter exploration: explorationUtils.py aka eu
    • Postprocessing of exploration results using eu.processExplorationResults()
    • Find parameters of explored simulations using eu.findCloseResults()
    • Plot exploration results via eu.plotExplorationResults() (see example image below)
  • 🧪 Custom transformation of the inputs to the BOLDModel.
    • This is particularly handy for phenomenological models (such as FHNModel, HopfModel and WCModel) which do not produce firing rate outputs with units in Hz.
  • 🔬Improvements
    • Models can now generate random initial conditions using model.randomICs()
    • model.params['bold'] = True forces BOLD simulation
    • BoxSearch class: search.run() passes arguments to model.run()
    • BOLD output time array renamed to t_BOLD

🖼 Example image generated by eu.plotExplorationResults(): Exploration results of a brain network of FHNModel nodes using the hcp dataset.
exploration-fhn-fc

Wilson-Cowan model and consistent chunkwise durations

11 Mar 10:47
4c77e2c
Compare
Choose a tag to compare

Changes:

  • New model: Wilson-Cowan neural mass model implemented (thanks to @ChristophMetzner )
  • Simulations now start their output at t=dt (as opposed to t=0 before). Everything before is now considered an initial condition.
  • Fix: Running a simulation chunkwise (using model.run(chunkwise=True)) and normally (using model.run()) produces output of the same length
  • Fix: aln network coupling, which apparent when simulating chunkwise with model.run(chunkwise=True, chunksize=1)
  • Fix: Correct use of seed for RNG
  • Fix: Matrices are not normalized to max-1 anymore before each run.
  • Fix: Kolmogorov distance of FCD matrices and timeseries

Automatic chunkwise integration, model simplification, better datasets and evolution

26 Feb 14:21
f87d941
Compare
Choose a tag to compare

We are happy to announce a new release of neurolib which brings us a lot closer to reaching one of our main milestones, the implementation of a multi-model Circuit 🤯🐝🎉.

Changes:

  • This update brings Python 3.6-3.8 support (backwards compatibility)
  • A new feature of all models called autochunk can integrate a model chunkwise by itself which makes model implementation a lot easier! If a model wants to use this feature, it has to specify a list of its state_vars (state variables), the name of the analogous init_vars (initial values), output_vars for automatic storing of the model results and optionally a `default_output.
  • autochunk can also integrate every model by a single dt. This is a necessary preparation for the upcoming Circuit class.
  • With this update, every model can now also produce a BOLD signal. If the model is not a firing rate model (that produces outputs with a physcal unit of Hz, namely spikes per second), it can specify an attribute normalize_bold_input and the output will be normalized to a given range (given by normalize_bold_input_max) and a BOLD signal will be computed. See neurolib.models.hopf for an example.
  • The DTI datasets can now be loaded with several normalization methods, if the appropriate information is provided in the dataset. The provided DTI matrices are produced using FSL, from which we included the waytotal.txt (number of valid fibers found) and the nvoxel.txt file (number of voxels of the source region).
  • The evolutionary algorithm now allows you to register your own mating and mutation operators, making use of the simple interface that is provided by the deap package.
  • Got rid of 230 lines of code while the functionality increased. Yay!

Whole-brain optimization and signal processing

13 Feb 12:54
f5e5bfc
Compare
Choose a tag to compare

This brand new release adds some fancy features and has a ton of fixes.

Main changes include:

  • Whole-brain optimization using the evolutionary pipeline. See example notebook!
  • Evolution supports custom mating and selection operators.
  • A new Signal class with lots of options to process model outputs. See example notebook!
  • Use new ParameterSpace in evolution and exploration.

Happy modeling!