brian2tools.mdexport.expander module¶
Standard markdown expander class to expand Brian objects to markdown text using standard dictionary representation of baseexport
-
class
brian2tools.mdexport.expander.
MdExpander
(brian_verbose=False, include_monitors=False, keep_initializer_order=False, author=None, add_meta=False, github_md=False)[source]¶ Bases:
object
Build Markdown texts from run dictionary. The class contain various expand functions for corresponding Brian objects and get standard dictionary as argument to expand them with sentences in markdown format.
Note
If suppose the user would like to change the format or wordings in the exported model descriptions, one can derive from this standard markdown expander class to override the required changes in expand functions.
-
check_plural
(iterable, singular_word=None, allow_constants=True, is_int=False)[source]¶ Function to attach plural form of the word by examining the following iterable
Parameters: - iterable (object with
__iter__
attribute) – Object that has to be examined - singular_word (str, optional) – Word whose plural form has to searched in
singular_plural_dict
- allow_constants (bool, optional) – Whether to assume non iterable as singular, if set as
True
, theiterable
argument must be an iterable - is_int (int, optional) – Check whether number
1
is passed, if > 1 return plural, by default set asFalse
. Note:allow_constants
should beTrue
- iterable (object with
-
create_md_string
(net_dict)[source]¶ Create markdown text by checking the standard dictionary and call required expand functions and arrange the descriptions
-
expand_EventMonitor
(eventmon)[source]¶ Expand EventMonitor from standard representation
Parameters: eventmon (dict) – Standard dictionary of EventMonitor
-
expand_NeuronGroup
(neurongrp)[source]¶ Expand NeuronGroup from standard dictionary
Parameters: neurongrp (dict) – Standard dictionary of NeuronGroup
-
expand_PoissonGroup
(poisngrp)[source]¶ Expand PoissonGroup from standard dictionary
Parameters: poisngrp (dict) – Standard dictionary of PoissonGroup
-
expand_PoissonInput
(poinp)[source]¶ Expand PoissonInput
Parameters: poinp (dict) – Standard dictionary representation for PoissonInput
-
expand_PopulationRateMonitor
(popratemon)[source]¶ Expand PopulationRateMonitor
Parameters: popratemon (dict) – PopulationRateMonitor’s baseexport dictionary
-
expand_SpikeGeneratorGroup
(spkgen)[source]¶ Expand SpikeGeneratorGroup from standard dictionary
Parameters: spkgen (dict) – Standard dictionary of SpikeGeneratorGroup
-
expand_SpikeMonitor
(spikemon)[source]¶ Expand SpikeMonitor from standard representation
Parameters: spikemon (dict) – Standard dictionary of SpikeMonitor
-
expand_SpikeSource
(source)[source]¶ Check whether subgroup dict and expand accordingly
Parameters: source (str, dict) – Source group name or subgroup dictionary
-
expand_StateMonitor
(statemon)[source]¶ Expand StateMonitor from standard dictionary
Parameters: statemon (dict) – Standard dictionary of StateMonitor
-
expand_Synapses
(synapse)[source]¶ Expand
Synapses
details from Baseexporter dictionaryParameters: synapse (dict) – Dictionary representation of Synapses
object
-
expand_connector
(connector)[source]¶ Expand synaptic connector from connector dictionary
Parameters: connector (dict) – Dictionary representation of connector
-
expand_events
(events)[source]¶ Expand function to loop through all events and call
expand_event
-
expand_identifiers
(identifiers)[source]¶ Expand function to loop through identifiers and call
expand_identifier
-
expand_initializer
(initializer)[source]¶ Expand initializer from initializer dictionary
Parameters: initializer (dict) – Dictionary representation of initializer
-
expand_pathway
(pathway)[source]¶ Expand
SynapticPathway
Parameters: pathway (dict) – SynapticPathway’s baseexport dictionary
-
expand_pathways
(pathways)[source]¶ Loop through pathways and call
expand_pathway
-
expand_runregularly
(run_reg)[source]¶ Expand run_regularly from standard dictionary
Parameters: run_reg (dict) – Standard dictionary representation for run_regularly()
-
expand_summed_variable
(sum_variable)[source]¶ Expand Summed variable
Parameters: sum_variabe (dict) – SummedVariable’s baseexport dictionary
-
expand_summed_variables
(sum_variables)[source]¶ Loop through summed variables and call
expand_summed_variable
-
prepare_array
(arr, threshold=10, precision=2)[source]¶ Prepare arrays using
numpy.array2string
Parameters: - arr (
numpy.ndarray
) – Numpy array to prepare - threshold (int, optional) – Threshold value to print all members
- precision (int, optional) – Floating point precision
- arr (
-
prepare_math_statements
(statements, differential=False, separate=False, equals='←')[source]¶ Prepare statements to render in markdown format
Parameters: - statements (str) – String containing mathematical equations and statements
- differential (bool, optional) – Whether should be treated as variable in differential equation
- separate (bool, optional) – Whether lhs and rhs of the statement should be separated and rendered
- equals (str, optional) – Equals operator, by default arrow from right to left
-