Repository navigation
Releases
v0.5.1
Highlights
- Documentation site: https://shimoura.github.io/microcircuit-lab/, with installation, six tutorials (four pages and two notebooks: a parameter sweep, NEST and Brian2 compared), the guides and the Python API.
Changed
init, when the package runs from a git clone (an editable install), copies the examples from that clone as it is, instead of fetching them from GitHub, and says so. Git's progress lines are now shown only when the clone fails.- Messages for what the package doesn't do yet say "isn't implemented yet" and give the workaround (scaling a project's own rule, a
from_fileconnection, weights from a project distribution, or an already scaled network; the mean current for other units and ports; other distributions for background and stimuli; Brian2 background and stimuli through non-static synapses;final_connectionswith several MPI processes). Scripts that match the old wording need the new one. - Messages and the
new-buildertemplate link to the documentation site instead of files that only a clone has. - The toy and downscaled PD14 simulation files set
print_time: false: in a notebook, NEST's progress line can stall runs with many short steps. Set it totrueto see the progress in a terminal. - New
docsextra (pip install -e ".[docs]") to build the site locally.
Fixed
num_synapses_from_conn_probstops with a clear message for an empty population (it raisedZeroDivisionError) and forconn_prob >= 1(it overflowed).
v0.5.0
Each example now lives in its own folder, laid out like a project, so everything of one model is in one place. Nothing changes in the network files or in the results.
Examples in examples/<name>/
toy,toy_two_areas,pd14,jiang24andhumameach have one folder with their builder, networks, simulation and analysis settings, plots, experiment scripts, the Brian2 models they use, and their README.- Run an example from its folder, as any project:
cd examples/pd14 && microcircuit-lab run --network pd14_downscaled.
init
init <project> --example <name>copies an example into the project's folders (builders/pd14,configs/network/pd14, ...). It can be given several times:--example pd14 --example jiang24.- If the project has a different version of one of the example's items (e.g. its own
builders/pd14), the example is not copied andinitsays which item. What the project already has the same is passed over without a message, and a toy you changed is kept. - Without git or a connection,
initstill makes the folders and says why nothing was copied.
Smaller changes
- Outside a project,
runandgeneratesay where to run from, or to make a project withinit. - Links to the examples in the README and the config docs point to GitHub, so they also work in a project's copy of the core.
Breaking changes
| Before | Now |
|---|---|
init --with-core copied every example into the project |
it copies only the core; add examples with --example <name> |
the examples at the repository root (builders/, configs/, analyses/, experiments/, extensions/) |
in examples/<name>/; microcircuit-lab run at the repository root finds nothing |
Upgrading
- Projects: nothing to change; your files stay where they are. To add an example:
microcircuit-lab init . --example <name>. - Clones of this repository: run the examples from
examples/<name>/. - Old runs: they still re-plot.
v0.4.2
Faster reading, building and writing of networks with many connection rows, and a few checks set right. NEST results are unchanged; Brian2 networks get other synapses for the same seed (same statistics).
Faster
- Reading
connectivity.yaml: a connection's weight and delay are checked against its rule once, for the whole table, instead of again for every row (a network of 7,600 rows: 1.5 → 1.0 s). - Reading
from_filerows: the check for a file used by two connections counts the file names once (30,000 rows: 8.9 → 0.4 s). - NEST: each connection's weight and delay fields are worked out once, not for every row.
- Writing YAML uses libyaml, as reading already did. Builders write the same files, faster.
Fixed
- Brian2, many connections from one population. Rows with multapses (
fixed_total_number,fixed_indegree,fixed_outdegree) crashed from about 190 rows leaving one population, and fewer rows took minutes to compile the first time. Their pairs are now drawn with numpy and connected in one call (150 rows: 82 → 15 s on the first run). Memory while connecting is slightly higher (about 8 bytes per synapse). - A
dcstimulus's delay is checked in full again:delay: {mean: 1.0}ordelay: {}was accepted and failed while building. - A
from_filerow that sets a weight field (e.g.weight: {mean: 5}) now gets the right advice: write only the weight's unit.
Who checks what
The core checks the file format, the values it computes with and what each shared name means; each simulator checks its own names. See "Who checks what" in CONTRIBUTING.md. So:
- A simulator's own rule (e.g.
symmetric_pairwise_bernoulli) gets itsp,indegree,outdegreeorn_synapseschecked by the simulator, not by the core.
Breaking changes
| Before | Now |
|---|---|
a draw without spread: std: 0 (normal, lognormal), min equal to max (uniform), lower_bound equal to upper_bound. NEST failed while building, Brian2 ran it |
refused; write the value as value: ... |
These change results without an error:
- Brian2 spikes change on every network: synapses are drawn another way, so the same seed gives other synapses, with the same statistics.
- Error messages of a background input's weight start with
The background input of <population>:, and errors in the connection table ofconnectivity.yamlstart withconnectivity.yaml:.
Upgrading
- Networks made by a builder: nothing to change (they regenerate to the same files).
- Hand-written files: only a draw without spread needs changing; reading the file tells you where.
- Old runs: they still re-plot.
v0.4.1
v0.4.1
Two new network models, and NEST and Brian2 now agree on results that used to differ without a message. A few files need one more line: see "Breaking changes".
New network models
jiang24andjiang24_stp(Jiang et al. 2024, without and with short-term plasticity; NEST only), by @Pedro-RP:microcircuit-lab generate jiang24, and--stpfor the second.
New
metadata.jsonrecords the build time, the simulation time and the Python version.- A simulator's own connection rule takes
p,indegree,outdegreeorn_synapsesas its own argument, and arguments may be true or false:{rule: symmetric_pairwise_bernoulli, p: 0.1, make_symmetric: true}. - Builders write
rule:on every connection, so the files show it. The example networks were regenerated.
Fixed: results that differed between simulators
- Brian2, weights of both signs. A drawn weight with no bound at 0 sent every synapse of a connection by the sign of the mean weight. Each synapse now goes by its own sign, as in NEST (example: 44.6 Hz before, against 3.4 Hz in NEST).
- Brian2, Poisson stimulus. It gave at most one spike per time step, so strong stimuli were too weak (8 kHz: 4.3 Hz against 15.9 Hz in NEST). It now draws a Poisson number of spikes per step.
- Input delays. On Brian2 the background input now starts one
delayinto the run and a Poisson stimulus arrives at the same time step as in NEST. overwrite: trueemptied onlyrecordings/, so a second run into the same folder could return the first run's saved firing rates. It now empties everything the run writes again.- Saved firing rates and spectra (
cached_population_firing_rates,cached_power_spectrum) returned another area's or another time window's result. They are now kept per area and computed again when the settings change.
Fixed: problems found before the run, not during or after it
- Stimulus timings:
rate_timesmust increase and matchrate_values,stopmust come afterstart, and times must be multiples of the time step. - A delay that can round to 0 time steps is refused on NEST too.
- Brian2: a background input or stimulus through a synapse other than the static one, and saving the final connections of a gap junction.
- A NEST error while connecting names the connection it happened in.
Breaking changes
Each of these fails with a message that shows what to write.
| Before | Now |
|---|---|
a dc stimulus without delay (NEST used 1 ms, Brian2 none) |
delay: {value: 1.0} is required and applied on both |
file: ../shared/E_to_I.csv on a from_file connection |
the file must be inside the network folder |
| a stimulus time between two time steps (Brian2 rounded it) | refused on both simulators |
register_artifact(...) and the artifacts list in metadata.json |
removed; delete the call |
Brian2: a synapse model with its own on_pre and a drawn weight with no bound at 0 |
refused; give the weight lower_bound: 0 or upper_bound: 0 (or the synapse a receptor_port) |
These change results without an error:
- Brian2 spike times change on every network with a background input or a stimulus. Rates agree with before, except in the two cases fixed above, where they now match NEST.
- Full-scale
pd14on NEST with several threads gets other synapses for the same seed, with the same statistics: the builder now leaves out the 9 population pairs with no synapses.
Also fixed
- A saved connection with no synapses is left out of
final_connections/, and two saved connections can no longer share a file name. - Welch's power spectrum works with fewer than 8 bins.
- A network built in Python gets a clear message when it names a population that does not exist.
- Docs: what a left-out parameter and left-out
allow_autapses/allow_multapsesmean.
Upgrading
- Networks made by a builder: run
microcircuit-lab generate <name>again. - Hand-written files: add
delay: {value: 1.0}to eachdcstimulus; reading the file tells you where. - Old runs: they still re-plot.
v0.4.0
v0.4.0
The network files now show exactly what each simulator draws, every option is written the same way, and connections can come from a file. This release changes the file format: update your networks once (see "Upgrading").
New
- Drawn values, one format for weights, delays and neuron values:
{value: 87.8}, or{distribution: normal, mean: 87.8, std: 8.78}, wheremeanandstdare those of the distribution, before any bound (forlognormaltoo). - Bounds on every drawn value:
lower_bound,upper_bound,bound_mode: redraw | clip. - Other distributions: NEST's own (
{distribution: exponential, beta: 2}), or your own, inextensions/nest/(a function) orextensions/brian2/(aDistribution).--extensionsworks with both simulators. - Connections from a file:
rule: from_filewith a CSV ofsource_index,target_index,weight,delay. - Final connections:
recording.final_connectionssaves each synapse's weight and delay at the end of a run, ready to run again. - Plots per area: a multi-area network gets
plots/<area>/by default;area: togethergives one set.
Breaking changes
Every removed form fails with a message that shows the new one.
| Before (v0.3) | Now (v0.4) |
|---|---|
{mean: 87.8, rel_std: 0.1, distribution: normal} |
{distribution: normal, mean: 87.8, std: 8.78} |
{mean: 0.1, rel_std: 0.0, distribution: fixed} |
{value: 0.1} |
bound_mode: redraw at the top of connectivity.yaml; delay minimum |
lower_bound / upper_bound / bound_mode on each weight and delay; a drawn delay needs lower_bound |
parameters: {pairwise_avg_num_conns: 2} (CSV: JSON column) |
pairwise_avg_num_conns: 2 (CSV: one column per argument) |
area: all / --area all |
leave area out (one set per area); area: together for one set |
--area V1 writes to plots/ |
writes to plots/V1/ |
These change meaning without an error:
- Lognormal neuron values:
mean/stdare now those of the values. Before, NEST took them as log-space numbers:tau_m: {distribution: lognormal, mean: 2.3, std: 0.1}meant about 10 ms and now means 2.3 ms. Writemean: 10.0, std: 1.0to keep the old values. - Brian2 draws neuron values with its own random numbers: same statistics, different spike times.
- A multi-area network without
areanow gets one set of plots per area, not one set with every population.
Also changed:
- A neuron-value distribution that isn't shared needs every argument it takes, and nothing it doesn't take.
- Brian2's
exponentialcomes fromextensions/brian2/. - Scaling refuses
from_fileconnections, and weights from a distribution that isn't shared whenK_scalingisn't 1. - Python API:
WeightDistribution,DelayDistributionandSHARED_DISTRIBUTIONSmoved tomicrocircuit_lab.config.distributions.
Fixed
- Scaling divided a weight's
meanbut not the arguments it is drawn with.
Upgrading
- Networks made by a builder: run
microcircuit-lab generate <name>again. - Hand-written files: reading them prints each change to make.
- Old runs: they still re-plot.
run.networkof an old run says which version made it.
v0.3.3
Fixed
- Brian2: a second build in the same Python process no longer fails.
- Saved times keep every decimal of the time step (Brian2 at steps like 0.0125 ms was rounded).
- Errors across network files are short and name the folder;
runprints config errors without a traceback.
Changed
- Backend contract: each
backends/<name>/hassimulator.py(withBackend) andspike_files.py(see CONTRIBUTING, "A simulator").
v0.3.2
Changed
microcircuit-lab init <project>now copies a working example instead of only empty folders: the toy network, once per way of working (#37).configs/network/toy/: the YAML files written by hand, with comments.builders/toy/: a small commented builder that writes the same network toconfigs/network/toy_from_builder/.- The toy's simulation and analysis settings, and
extensions/brian2/when Brian2 is installed. - Running
initagain adds only what is missing. Offline, the folders are still created and the message says why.
- The toy's runs go to
output/<network>, sotoyandtoy_from_builderruns stay apart.
Fixed
- Outdated comments in the toys'
reference.yaml. git cloneno longer prints a temporary path duringinit.
v0.3.1
Changed
write_network_directorywrites every value, defaults included (bound_mode: redraw,rule,distribution: normal), so network files keep their meaning if a default of the core changes. The example networks were written again. (#31, by @NadineduToit)- Python 3.11 is accepted (3.12 was required before). (#32, by @NadineduToit)
- pandas ≥ 3.0 is now required: from pandas 3 on, its default parser reads the numbers in
connections.csvexactly. (#36)
Fixed
- Brian2: connection code is compiled once per rule instead of once per connection.
toy_two_areas_advancedfirst run: 75 s (was 18 min). Same spikes as before. (#34) - Runs made with older versions re-plot:
read_runreads the full network only whenrun.networkis used. If that network can't be read, the error names the version the run was made with. New:run.reference. (#35) run --backend <simulator>without that simulator installed exits with one line saying how to install it. (#36)- NEST: building twice in one process no longer reuses devices deleted by the kernel reset. (#36)
Upgrading
- Update pandas if your environment has pandas 2:
pip install -U "pandas>=3".
v0.3.0
microcircuit-lab v0.3.0
The network files now hold every number the simulator gets, a second simulator (Brian2) runs the same configs, and runs are read back with one function.
New
- Brian2 backend:
backend: {name: brian2, options: {...}}in the simulation file, or--backend brian2. Runtime (Cython or numpy) andcpp_standalone. Same statistics as NEST on the example networks; full-scale pd14 is within 2% of the reference rates on both. - Project definitions for Brian2 in
extensions/brian2/: neuron and synapse models (on_post, pathways, per-pathway delays), connection rules and weight/delay distributions by name withparameters. Receptor ports by name. - Connection rules
one_to_oneandall_to_all. - Record any neuron variable:
recording.variables: {V_m: {interval: 1.0, sample_size: 5}, I_syn_ex: {...}}. read_run(run_dir): spikes, recordings, node IDs, network and settings of a finished run, without the simulator. Plots use it too.- Scaling as an explicit step:
scale_network+write_networkwrite a scaled network folder;scaling.yamlrecords how. Builders take--n-scaling/--k-scaling. New example:pd14_downscaled, with its own analysis settings. - Background as its mean current:
replace_background_by_mean_current(pd14:--background mean_current). init --with-corecopies only the installed simulators' backends (--backendsto choose or add one).
Changed
- Raster plot: defaults 6 in wide, dots 1.5, no legend; a label is joined to its band by a short line only when it had to move.
- The package README is grouped by simulator (NEST, Brian2), with one section on the run folder; changing the core is in CONTRIBUTING.md.
Fixed
- A network passed to
Simulationstraight fromread_networkorscale_networkran with K times too little background input. The backends now create each generator atrate × indegree. overwrite: trueemptiesrecordings/, so the previous run's recordings are no longer read as the new run's.- Analyses refuse an
endpastt_sim; the power spectrum uses whole bins only. - Plots are skipped, with a message, when spikes were not recorded;
--validate-referenceno longer hides errors;--run-dirrefuses the simulation flags. - Errors in
network.yaml,scaling.yamland other YAML files name the folder and the file. - Brian2 refuses fixed delays below half the time step, as NEST does.
- Scaling warns about connections it drops by rounding.
Breaking changes
Old files fail with a message showing the new form.
| Before | Now |
|---|---|
| Python 3.11 | Python 3.12 or newer |
weight.unit: PSP / PSC / native, psp_conversion_aliases |
unit: pA / nS / mV; builders convert PSPs (builder_tools.psp_to_psc_iaf_psc_exp) |
scaling.yaml with factors, scaled at run time |
scale_network writes a scaled folder; scaling.yaml is a record |
background_mode: mean_current |
replace_background_by_mean_current in a builder |
background_inputs.yaml, background_indegree in populations.yaml |
poisson_background.yaml, indegree in each entry |
voltage_recording, voltage_interval, voltage_sample_size |
recording.variables |
recording.variables.<var>.populations: [] |
refused: list at least one, or leave it out for all |
--extension-modules, backend option extension_modules |
--nest-modules / nest_modules (NESTML modules), --extensions (Python definitions) |
prepare_network, load_network |
read_network |
Simulation.from_run_dir; plot functions take simulation |
read_run; plot functions take run |
metadata.json first_gid |
first_node_id, last_node_id |
| humam: scaling compensates the background input only | the recurrent input too, from the full-scale rates in reference.yaml; its I_e changed |
toy_two_areas --clusters / --advanced with scaling |
refused |
Run folders made with v0.2 can't be read by read_run; simulate them again.
Known issues
- Brian2 compiles each connection without multapses on its own the first time it runs, so a network with many of them starts slowly (
toy_two_areas_advanced: about 18 minutes the first time, then 26 s).
v0.2.0
Breaking: network.connections is now a table, read by column (connections["weight.mean"]), not by row.
What's Changed
- Connections held as one table; CSV file for large networks by @shimoura in #23
- Workflow page: each step of a run, its input, output and code by @shimoura in #24
Full Changelog: v0.1.0...v0.2.0