Releases: neurolib-dev/neurolib
Hotfix and getIndividualFromHistory()
A small update with two minor changes. Thanks everyone for reporting issues! 🛠
- Hotfix: include
pypet_logging.iniin pypi package - Evolution: new method
getIndividualFromHistory()
Bugfixes, examples and preparations for something big
Bugfixes:
example-0.5: Demonstrating the use of external stimuli on brain networksexample-1.3: 2D bifurcation diagrams usingpypetbold: BOLD numerical overflow bug fixedevolution: dfEvolution and dfPop fixexploration: fix seed for random initial conditions- various minor bugfixes
Hotfix: RNG seed
🔥 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
aln: record adaptation currents
Exploration and Evolution: improvements
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.treeavailable fromevolution.buildEvolutionTree()that isnetworkxcompatible [1] - Continue working:
saveEvolution()andloadEvolution()can load an evolution from another session [2] - Overview dataframe
evolution.dfPopnow 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 useall=Falseto load runs individually from hdf. Both options populatedfResults. loadResults()has memory cap to avoid filling up RAMloadDfResults()creates the parameter table from a previous simulationexplorationUtils.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 simlordmodel_fit()to compute the model's FC and FCD fit to the dataset, could be usefull for everyonegetPowerSpectrum()does what is saysgetMeanPowerSpectrum()same- a very neat
rolling_window()from anumpyPR that never got accepted
Other:
- Data loading:
Datasetcan load different SC matrix normalizations:"max", "waytotal", "nvoxel"- Can precompute FCD matrices to avoid having to do it later (
fcd=True)
neurolib/utils/atlas.pyadded with aal2 region names (thanks @jajcayn) and coordinates of centers of regions (from scans of @caglorithm's brain 🤯)ParameterSpacehas.lowerBoundand.upperBound.pypetfinally 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()[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
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.pyakaeu- 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)
- Postprocessing of exploration results using
- 🧪 Custom transformation of the inputs to the
BOLDModel.- This is particularly handy for phenomenological models (such as
FHNModel,HopfModelandWCModel) which do not produce firing rate outputs with units inHz.
- This is particularly handy for phenomenological models (such as
- 🔬Improvements
- Models can now generate random initial conditions using
model.randomICs() model.params['bold'] = Trueforces BOLD simulationBoxSearchclass:search.run()passes arguments tomodel.run()- BOLD output time array renamed to
t_BOLD
- Models can now generate random initial conditions using
🖼 Example image generated by eu.plotExplorationResults(): Exploration results of a brain network of FHNModel nodes using the hcp dataset.

Wilson-Cowan model and consistent chunkwise durations
Changes:
- New model: Wilson-Cowan neural mass model implemented (thanks to @ChristophMetzner )
- Simulations now start their output at
t=dt(as opposed tot=0before). Everything before is now considered an initial condition. - Fix: Running a simulation chunkwise (using
model.run(chunkwise=True)) and normally (usingmodel.run()) produces output of the same length - Fix:
alnnetwork coupling, which apparent when simulating chunkwise withmodel.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
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
autochunkcan 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 itsstate_vars(state variables), the name of the analogousinit_vars(initial values),output_varsfor automatic storing of the model results and optionally a `default_output. autochunkcan also integrate every model by a singledt. This is a necessary preparation for the upcomingCircuitclass.- 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 attributenormalize_bold_inputand the output will be normalized to a given range (given bynormalize_bold_input_max) and a BOLD signal will be computed. Seeneurolib.models.hopffor 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 thewaytotal.txt(number of valid fibers found) and thenvoxel.txtfile (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
deappackage. - Got rid of 230 lines of code while the functionality increased. Yay!
Whole-brain optimization and signal processing
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
Signalclass with lots of options to process model outputs. See example notebook! - Use new
ParameterSpacein evolution and exploration.
Happy modeling!


