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:
objectBuild 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 examinedsingular_word (str, optional) – Word whose plural form has to searched in
singular_plural_dictallow_constants (bool, optional) – Whether to assume non iterable as singular, if set as
True, theiterableargument must be an iterableis_int (int, optional) – Check whether number
1is passed, if > 1 return plural, by default set asFalse. Note:allow_constantsshould beTrue
- create_md_string(net_dict, template_name)[source]¶
Create markdown text by checking the standard dictionary and call required expand functions and arrange the descriptions
- 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_group(group, template_name)[source]¶
Expand group() header
- Parameters:
group (groupname) – ex : - neurongrp,poisongrp ….
template_name (string) – full template name along with the group and template_type
- 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 preparethreshold (int, optional) – Threshold value to print all members
precision (int, optional) – Floating point precision
- 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