Skip to content

Python API

The functions you call from a script, a builder or an analysis, with their docstrings. Their use, with examples: Running from a script, A new network model, Analysing a run.

On GitHub this page shows only the names; the documentation site shows the docstrings, which are also in the code and in help(...).

Run and read

Simulation

A network and its simulation settings, run on a backend.

output_dir = None instance-attribute

is_main_process = True instance-attribute

from_yaml(config_dir='configs', network_name='toy', simulation_name=None, backend=None, backend_options=None) classmethod

Build a simulation from the config files.

Parameters:

Name Type Description Default
config_dir str | Path

The folder holding network/, simulation/ and analysis/.

'configs'
network_name str

The network folder, <config_dir>/network/<network_name>/.

'toy'
simulation_name str | None

The simulation profile, <config_dir>/simulation/<simulation_name>.yaml. By default the same name as the network. If that default file doesn't exist, the defaults of SimulationConfig() are used (with a warning), so a new network runs before it has a profile; a profile named explicitly must exist.

None
backend BackendName | None

The simulator, "nest" or "brian2". By default the one in the backend section of the simulation profile ("nest" without it).

None
backend_options dict[str, Any] | None

Extra keyword arguments for the backend, passed through unchanged, e.g. {"nest_modules": ["my_module"]} to load a NESTML model in NEST. They replace the profile's options of the same name. The profile's options are dropped when backend names another simulator.

None

Returns:

Type Description
Simulation

Ready to run(); the network is already read.

run()

Build the network in the simulator, simulate it and save the outputs.

What is saved (recordings, the config, metadata) is set by the recording and output sections of the simulation config; see :func:microcircuit_lab.run_folder.write.save_run_outputs. output_dir points to the run folder afterwards. With several MPI processes, only the first prints and saves; the others have is_main_process False.

read_network(folder)

Read a network folder as written and check it.

Parameters:

Name Type Description Default
folder str | Path

The network folder, e.g. configs/network/toy.

required

Returns:

Type Description
NetworkConfig

The network as described by its files, e.g. to change it, or to scale it with :func:~microcircuit_lab.builder_tools.scaling.scale_network.

read_run(run_dir)

Open a finished run folder, without the simulator.

Parameters:

Name Type Description Default
run_dir str | Path

The run folder, e.g. output/toy/20261018_120000.

required

Returns:

Type Description
Run

The run's settings, and its spikes and recordings, which are read when asked for.

Raises:

Type Description
FileNotFoundError

If run_dir does not exist.

ValueError

If the run has no config.yaml (output.save_config: false) or no metadata.json (output.save_metadata: false), the metadata lacks the node IDs of a population (simulate the run again), or this version cannot read the run's simulation settings or reference rates.

Builder tools

builder_tools

Everything a builder needs, in one import.

A builder turns a model's data (published tables, pickles, recordings) into a network folder configs/network/<name>/::

from microcircuit_lab.builder_tools import delay, weight, write_network_directory, zero_bound

write_network_directory(
    "configs/network/my_model",
    populations=[{"name": "E", "size": 800, "neuron": "lif", ...}],
    neurons={"lif": {"model": "iaf_psc_exp", "parameters": {...}}},
    connections=[{"source": "E", "target": "E", "n_synapses": 8000,
                  "weight": weight(87.8, unit="pA", rel_std=0.1, **zero_bound(87.8, "redraw")),
                  "delay": delay(1.5, rel_std=0.5, lower_bound=0.1, bound_mode="redraw")}],
    poisson_background={"E": {"rate": 8.0, "indegree": 1600, "weight": weight(87.8, unit="pA"),
                             "delay": delay(1.5)}},
)

Modules: entries.py (weight, delay, synapses from a probability), write.py (network folders), psp.py (PSP to PSC), scaling.py (scale a network) and constant_current.py / mean_input.py (the currents and quantities it uses).

  • :func:write_network_directory writes every file of the folder and checks the result (with :func:microcircuit_lab.network.load.read_network), so a mistake raises with the file and the field named.
  • :func:scale_network returns a network scaled down (fewer neurons and synapses, stronger weights, the lost mean input as a current), and :func:write_network writes such a network as a folder.
  • :func:replace_background_by_mean_current returns the network with its background Poisson input replaced by a constant current of the same mean, to apply before writing it.
  • :func:mean_current is the constant current (pA) with the mean of a Poisson input, for a builder that adds the input of areas it leaves out.
  • :func:weight and :func:delay build the weight / delay entries every connection, background input and stimulus needs.
  • :func:num_synapses_from_conn_prob turns a connection probability into a number of synapses (Potjans & Diesmann 2014).
  • :func:psp_to_psc_iaf_psc_exp converts a PSP amplitude (mV) into the current (pA) that produces it, for a model whose weights are given as PSPs (:func:psc_to_psp goes back). The core never converts a weight itself.

None of these invents model values: a field a builder leaves out is either a default of the config models or an error. Using them is optional; files written any other way are checked the same way when the network is loaded.

write_network_directory(path, *, populations, neurons, connections, poisson_background, scaling=None, reference=None, stimuli=None, synapses=None, synapse_lists=None, compact=True)

Write a whole network folder and check it.

Each argument is the content of one file, without the file's top-level key (populations:, connections:, ...), which is added here.

Parameters:

Name Type Description Default
path str | Path

The network folder to write, e.g. configs/network/my_model. Existing files are overwritten.

required
populations Iterable[Mapping[str, Any]]

One dict per population (name, size, neuron, initial_state).

required
neurons Mapping[str, Mapping[str, Any]]

{neuron name: {"model": ..., "parameters": {...}}}.

required
connections Iterable[Mapping[str, Any]] | ConnectionTable

One dict per projection (source, target, n_synapses or another rule with its number, weight, delay, optionally synapse). Or, for a large network, a :class:~microcircuit_lab.config.connection_table.ConnectionTable, written as connections.csv.

required
poisson_background Mapping[str, Mapping[str, Any]]

{population name: {"rate": ..., "indegree": ..., "weight": ..., "delay": ...}}.

required
scaling Mapping[str, Any] | None

The record of a scaled network (scaling.yaml), which :func:write_network passes on; None writes none.

None
reference Mapping[str, float] | None

{population name: full-scale mean rate}; None writes no reference.yaml.

None
stimuli Iterable[Mapping[str, Any]] | None

The list of stimuli; None writes no stimuli.yaml.

None
synapses Mapping[str, Mapping[str, Any]] | None

{synapse name: {"model": ..., "parameters": {...}, "receptor_port": ...}}; None writes no synapses.yaml.

None
synapse_lists Mapping[str, SynapseList] | None

The synapses of each connection with rule: from_file, by the file it names (e.g. {"synapses/E_to_I.csv": SynapseList(...)}), each written as that CSV file in the folder.

None
compact bool

Connections are always written one per line. True writes populations and the Poisson background the same way; False writes them in block style, easier to read for a small network.

True

Returns:

Type Description
NetworkConfig

The network as written, from :func:~microcircuit_lab.network.load.read_network (e.g. to scale it). A mistake raises there, with the file and the field named.

write_network(network, path, *, csv=False, compact=True)

Write network as a network folder, e.g. one returned by :func:scale_network.

Populations that share a neuron entry keep sharing it while their neurons are the same; a population whose neuron differs (e.g. its own compensation current in I_e) gets an entry of its own, named after the population.

Parameters:

Name Type Description Default
network NetworkConfig

The network as written (background rates per synapse).

required
path str | Path

The folder to write, e.g. configs/network/toy_downscaled.

required
csv bool

Write the connections as connections.csv (for a large network) instead of in connectivity.yaml.

False
compact bool

As for :func:write_network_directory.

True

Returns:

Type Description
NetworkConfig

The network read back from the folder.

weight(mean, *, unit, rel_std=0.0, distribution=None, lower_bound=None, upper_bound=None, bound_mode=None, **arguments)

A weight entry for a connection, background input or stimulus, from its mean and its relative spread, as papers and reference codes give them.

Parameters:

Name Type Description Default
mean float

The mean weight the simulator gets, in unit.

required
unit str

"pA" (a current), "nS" (a conductance) or "mV" (a jump of the membrane potential). Nothing is converted.

required
rel_std float

Standard deviation divided by |mean|; 0 (and no distribution) for a fixed weight, written as value.

0.0
distribution str | None

"normal" (the default with a spread) or "lognormal", written with mean and std = |mean| * rel_std; "uniform", written as the min and max with that mean and standard deviation; or a distribution that is not shared (connections only; the simulator's own or the project's), written with mean.

None
**arguments float

The arguments of a distribution that is not shared, e.g. beta=20.

{}
lower_bound float | None

Bounds of a drawn weight, and what to do past them ("redraw" or "clip"); see :func:zero_bound to keep the weight's sign. A fixed weight is not drawn, so it is written without them.

None
upper_bound float | None

Bounds of a drawn weight, and what to do past them ("redraw" or "clip"); see :func:zero_bound to keep the weight's sign. A fixed weight is not drawn, so it is written without them.

None
bound_mode float | None

Bounds of a drawn weight, and what to do past them ("redraw" or "clip"); see :func:zero_bound to keep the weight's sign. A fixed weight is not drawn, so it is written without them.

None

Returns:

Type Description
dict

The entry as written in the YAML file. It is checked against :class:~microcircuit_lab.config.distributions.WeightDistribution, so a bad value raises here.

delay(mean, *, rel_std=0.0, distribution=None, lower_bound=None, upper_bound=None, bound_mode=None, **arguments)

A delay entry for a connection, background input or stimulus, as :func:weight.

Parameters:

Name Type Description Default
mean float

Mean delay in ms.

required
rel_std float

Standard deviation divided by mean; 0 for a fixed delay.

0.0
distribution str | None

As in :func:weight.

None
**arguments str | None

As in :func:weight.

None
lower_bound float | None

Bounds (ms) of a drawn delay, which needs a lower_bound, and what to do past them ("redraw" or "clip"); left out for a fixed delay.

None
upper_bound float | None

Bounds (ms) of a drawn delay, which needs a lower_bound, and what to do past them ("redraw" or "clip"); left out for a fixed delay.

None
bound_mode float | None

Bounds (ms) of a drawn delay, which needs a lower_bound, and what to do past them ("redraw" or "clip"); left out for a fixed delay.

None

Returns:

Type Description
dict

The entry as written in the YAML file, checked against :class:~microcircuit_lab.config.distributions.DelayDistribution.

zero_bound(mean, bound_mode)

Bounds that keep a drawn weight's sign: lower_bound: 0 for a weight with a mean of 0 or more, upper_bound: 0 for a negative one, with bound_mode "redraw" or "clip". For :func:weight: weight(w, unit="pA", rel_std=0.1, **zero_bound(w, "redraw")).

num_synapses_from_conn_prob(conn_prob, n_source, n_target)

Compute the total number of synapses from a connection probability.

Parameters:

Name Type Description Default
conn_prob float

Connection probability.

required
n_source int

Number of source neurons.

required
n_target int

Number of target neurons.

required

Returns:

Type Description
int

Expected total number of synapses.

Raises:

Type Description
ValueError

If a population is empty, or if conn_prob is 1 or more (the expected number of synapses grows without bound).

psp_to_psc_iaf_psc_exp(psp, C_m, tau_m, tau_syn)

Convert a PSP amplitude (mV) to the current amplitude (pA) that produces it.

Holds for a current-based LIF neuron with exponential synaptic currents. It is named after NEST's iaf_psc_exp, where people know it from, but it only depends on C_m, tau_m and tau_syn (see :func:psc_over_psp), whatever the model is called.

Parameters:

Name Type Description Default
psp float

The PSP amplitude, in mV.

required
C_m float

Membrane capacitance, in pF.

required
tau_m float

Membrane time constant, in ms.

required
tau_syn float

Synaptic time constant, in ms.

required

Returns:

Type Description
float

The current amplitude, in pA.

psc_to_psp(psc, C_m, tau_m, tau_syn)

Convert a current amplitude (pA) to the PSP amplitude (mV) it produces; the inverse of :func:psp_to_psc_iaf_psc_exp.

Parameters:

Name Type Description Default
psc float

The current amplitude, in pA.

required
C_m float

As in :func:psp_to_psc_iaf_psc_exp.

required
tau_m float

As in :func:psp_to_psc_iaf_psc_exp.

required
tau_syn float

As in :func:psp_to_psc_iaf_psc_exp.

required

Returns:

Type Description
float

The PSP amplitude, in mV.

scale_network(network, *, N_scaling, K_scaling, scaled_from, preserve_mean_input=True, preserve_variance=True, compensate_recurrent_input=True)

Return network scaled down, as the files of the scaled network show it.

  1. The number of neurons of each population times N_scaling.
  2. The synapses per neuron times K_scaling: the number each connection rule takes (see :func:scale_rule_number) and the background indegrees.
  3. The weights divided by sqrt(K_scaling) (preserve_variance, which keeps the fluctuations of the input) or by K_scaling (which keeps its mean), for connections and background inputs.
  4. With preserve_variance and preserve_mean_input: a constant current added to each neuron's I_e, the mean input lost in step 3 (van Albada, Helias & Diesmann 2015). The lost background input always; the lost recurrent input too with compensate_recurrent_input, from reference.full_mean_rates.

Stimuli are not scaled. A network that was already scaled is refused: its compensation would take the first one's currents as the full input.

Parameters:

Name Type Description Default
network NetworkConfig

The network as written, at full scale (e.g. from :func:~microcircuit_lab.network.load.read_network).

required
N_scaling float

The factors, above 0 (1 keeps that number).

required
K_scaling float

The factors, above 0 (1 keeps that number).

required
scaled_from str

The name of the full-scale network, written in the record.

required
preserve_mean_input bool

As above.

True
preserve_variance bool

As above.

True
compensate_recurrent_input bool

As above.

True

Returns:

Type Description
NetworkConfig

The scaled network; its scaling records how it was made (written as scaling.yaml, never applied).

Raises:

Type Description
ValueError

If network was already scaled; if a population would have no neuron left; if a connection's rule cannot be scaled; if K_scaling is not 1 and a connection's weight distribution is not a shared one; or, to add the current, if a weight is not in pA on the default receptor port.

replace_background_by_mean_current(network)

Replace the background Poisson input by a constant current of the same mean.

The current (pA) is the mean of the background input as the network gives it (rate per synapse, indegree, weight), added to I_e (see Potjans & Diesmann 2014, Fig. 5). The returned network has no background input left: poisson_background is empty.

Parameters:

Name Type Description Default
network NetworkConfig

The network, with its background weights in pA on the default receptor port.

required

Returns:

Type Description
NetworkConfig

A new network without background input.

mean_current(weight, indegree, rate, tau_syn)

The constant current (pA) with the mean of the input of indegree synapses of amplitude weight (pA) firing at rate (spikes/s).

One spike gives an exponential current of amplitude weight and time constant tau_syn (ms), a charge of tau_syn * weight (ms x pA); the factor 0.001 turns it into pA x s. This assumes current-based synapses with exponential currents (tau_syn_ex, tau_syn_in).

Analysis

analysis

Analysis and visualization utilities.

compute_population_firing_rates(run, begin=0.0, end=None, *, populations=None, area=None)

The mean firing rate of each population.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None

Returns:

Type Description
dict of str to float

{population: mean rate}, in spikes/s.

compute_neuron_firing_rates(run, begin=0.0, end=None, *, populations=None, area=None)

The firing rate of every neuron, per population.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None

Returns:

Type Description
dict of str to numpy.ndarray

{population: rate of each neuron}, in spikes/s.

compute_population_isi_cv(run, begin=0.0, end=None, *, populations=None, area=None, min_spikes=3)

The mean ISI CV of each population, over the neurons where it is defined.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
min_spikes int

The fewest spikes a neuron needs.

3

Returns:

Type Description
dict of str to float

{population: mean CV}.

compute_neuron_isi_cv(run, begin=0.0, end=None, *, populations=None, area=None, min_spikes=3)

The coefficient of variation of the inter-spike intervals (ISI CV) of every neuron, per population.

A neuron needs at least min_spikes spikes in the window for its CV to be defined; a neuron with fewer gets NaN, which NaN-aware averages skip.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
min_spikes int

The fewest spikes a neuron needs.

3

Returns:

Type Description
dict of str to numpy.ndarray

{population: CV of each neuron}.

compute_power_spectrum(run, begin=0.0, end=None, *, populations=None, area=None, bin_size=1.0, method='welch', method_kwargs=None)

The power spectrum of each population's rate.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
bin_size float

The bin width of the rate signal, in ms.

1.0
method str

The estimator: a name in :data:POWER_SPECTRUM_METHODS ("welch", "periodogram", "multitaper").

'welch'
method_kwargs dict | None

Extra arguments for the estimator, e.g. {"bandwidth": 4.0} for "multitaper".

None

Returns:

Type Description
dict of str to tuple

{population: (frequencies in Hz, power)}.

compute_reference_deviation(run, begin=0.0, end=None, *, populations=None, area=None)

How far each population's mean rate is from its reference rate.

The reference rates are full_mean_rates in the network's reference.yaml. This is the number behind plot_firing_rates(..., show_reference=True), for a check in a script.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None

Returns:

Type Description
dict of str to float

{population: (simulated - reference) / reference}.

Raises:

Type Description
ValueError

If the network has no reference rates, or none for a selected population.

list_areas(run)

The areas of a multi-area network, in population order.

An area is the <area> in a population named <area>__<population>. Next to such names, a population without __ (e.g. TC) is an area of its own; a network where no name has __ has no areas.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required

Returns:

Type Description
list of str

The area names; empty for a single-area network.

plot_raster(run, begin=0.0, end=None, *, populations=None, area=None, max_neurons_per_population=UNSET, style=None, config=None, save_path=None, show=True)

Plot the spikes of each population (a raster plot).

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
max_neurons_per_population int | None

Show at most this many neurons per population (None for all). By default from config: neuron_fraction if set, else max_neurons_per_population.

UNSET
style PlotStyle | None

The shared plot style (:class:~microcircuit_lab.config.PlotStyle).

None
config RasterPlotConfig | None

This plot's settings from the analysis file; its defaults otherwise.

None
save_path str | Path | None

Where to save the figure; not saved if None.

None
show bool

Open the figure in a window.

True

Returns:

Type Description
tuple

The matplotlib (figure, axes).

Notes

config.begin and config.end, if set, replace begin and end for this plot only.

plot_firing_rates(run, begin=0.0, end=None, *, populations=None, area=None, show_reference=False, style=None, config=None, save_path=None, show=True, rng_seed=0)

Plot the distribution of single-neuron firing rates of each population.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
show_reference bool

Overlay the reference rates (reference.yaml) as markers.

False
style PlotStyle | None

The shared plot style (:class:~microcircuit_lab.config.PlotStyle).

None
config FiringRatePlotConfig | None

This plot's settings from the analysis file; its defaults otherwise.

None
save_path str | Path | None

Where to save the figure; not saved if None.

None
show bool

Open the figure in a window.

True
rng_seed int

Seed for choosing which points to show (when there are many) and for their horizontal jitter.

0

Returns:

Type Description
tuple

The matplotlib (figure, axes).

plot_isi_cv(run, begin=0.0, end=None, *, populations=None, area=None, min_spikes=UNSET, style=None, config=None, save_path=None, show=True)

Plot the distribution of single-neuron ISI CVs of each population.

A dashed line at CV = 1 marks Poisson-like firing, the "asynchronous irregular" state cortical models are usually compared with.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
min_spikes int

The fewest spikes a neuron needs; by default as set in config.

UNSET
style PlotStyle | None

The shared plot style (:class:~microcircuit_lab.config.PlotStyle).

None
config IsiCvPlotConfig | None

This plot's settings from the analysis file; its defaults otherwise.

None
save_path str | Path | None

Where to save the figure; not saved if None.

None
show bool

Open the figure in a window.

True

Returns:

Type Description
tuple

The matplotlib (figure, axes).

plot_power_spectrum(run, begin=0.0, end=None, *, populations=None, area=None, bin_size=1.0, method=UNSET, method_kwargs=UNSET, xlim=UNSET, style=None, config=None, save_path=None, show=True)

Plot the power spectrum of each population, in a grid: one row per layer, one column per cell type (L23_E next to L23_I, L4_E below).

The zero-frequency bin is never plotted: after removing the mean it carries no information, and it would break a log frequency axis.

Parameters:

Name Type Description Default
run

A finished run, from :func:~microcircuit_lab.read_run.

required
begin float

The time window in ms; end defaults to the end of the run.

0.0
end float

The time window in ms; end defaults to the end of the run.

0.0
populations Sequence[str] | None

Population names to use; by default all of them (or those of area).

None
area str | None

For a multi-area network, use only the populations of this area.

None
bin_size float

The bin width of the rate signal, in ms.

1.0
method str

The estimator, as in :func:compute_power_spectrum; by default as set in config.

UNSET
method_kwargs str

The estimator, as in :func:compute_power_spectrum; by default as set in config.

UNSET
xlim tuple[float, float] | None

The frequency range to show, e.g. (1, 150); by default as set in config (the full range). Keep 0 out of it with config.log_freq.

UNSET
style PlotStyle | None

The shared plot style (:class:~microcircuit_lab.config.PlotStyle).

None
config PowerSpectrumPlotConfig | None

This plot's settings from the analysis file; its defaults otherwise.

None
save_path str | Path | None

Where to save the figure; not saved if None.

None
show bool

Open the figure in a window.

True

Returns:

Type Description
tuple

The matplotlib (figure, axes).

register_plot(name, plot_fn, *, config_cls=None, filename=None)

Add a plot to microcircuit-lab run.

Parameters:

Name Type Description Default
name str

The plot's name: its --<name> flag and its section in the analysis file.

required
plot_fn Callable[..., object]

The plot function. It takes the run first (from read_run), then any of PLOT_ARGUMENTS by name (save_path, area, begin, ...); a parameter with any other name needs a default value.

required
config_cls type[FrozenConfig] | None

Optional pydantic model for the plot's settings, with an enabled field. Without it, config is the plain dict from the plot's section, and the plot is off unless that section sets enabled: true or the flag is passed.

None
filename str | None

The figure's file name; <name>.png by default.

None

Raises:

Type Description
ValueError

If the name is already taken, so a project's plot can't replace a bundled one, or if plot_fn asks for a parameter it can't be given.