bmtk.simulator.core package

Submodules

bmtk.simulator.core.edge_population module

class bmtk.simulator.core.edge_population.EdgePopulation[source]

Bases: object

initialize(network)[source]
source_nodes
target_nodes
class bmtk.simulator.core.edge_population.SimEdge[source]

Bases: object

gid
node_id

bmtk.simulator.core.graph module

class bmtk.simulator.core.graph.SimGraph[source]

Bases: object

add_component(key, value)[source]

Add a component key-value pair

Parameters:
  • key – name of component
  • value – value
add_edges(sonata_file, populations=None, source_pop=None, target_pop=None)[source]
Parameters:
  • sonata_file
  • populations
  • source_pop
  • target_pop
Returns:

add_nodes(sonata_file, populations=None)[source]

Add nodes from a network to the graph.

Parameters:
  • sonata_file – A NodesFormat type object containing list of nodes.
  • populations – name/identifier of network. If none will attempt to retrieve from nodes object
build_nodes()[source]
build_recurrent_edges()[source]
external_edge_populations(src_pop, trg_pop)[source]
classmethod from_config(conf, **properties)[source]

Generates a graph structure from a json config file or dictionary.

Parameters:
  • conf – name of json config file, or a dictionary with config parameters
  • properties – optional properties.
Returns:

A graph object of type cls

get_component(key)[source]

Get the value of item in the components dictionary.

Parameters:key – name of component
Returns:value assigned to component
get_node_population(population_name)[source]
get_node_populations()[source]
get_node_set(node_set)[source]
io
model_type_col = 'model_type'
node_populations

bmtk.simulator.core.io_tools module

class bmtk.simulator.core.io_tools.IOUtils[source]

Bases: object

For logging/mkdir commands we sometimes need to use different MPI classes depending on the simulator being used (NEST and NEURON have their own barrier functions that don’t work well with mpi). We also need to be able to adjust the logging levels/format at run-time depending on the simulator/configuration options.

Thus the bulk of the io and logging functions are put into their own class and can be overwritten by specific simulator modules

barrier()[source]

MPI Barrier call

log_error(message)[source]
log_exception(message, raise_exception=True)[source]
log_info(message, all_ranks=False)[source]
log_to_console
log_warning(message, all_ranks=False, display_once=False)[source]
logger
quiet_simulator()[source]

Turns off logging/messages of the native simulator

set_log_format(format_str)[source]
set_log_level(loglevel)[source]
setup_output_dir(output_dir, log_file, overwrite=True)[source]

bmtk.simulator.core.network_reader module

class bmtk.simulator.core.network_reader.EdgesReader[source]

Bases: object

initialize(network)[source]
mixed = 2
mixed_connections
recurrent = 0
recurrent_connections
set_connection_type(src_pop, trg_pop)[source]
source_nodes
target_nodes
unknown = 0
virtual = 1
virtual_connections
class bmtk.simulator.core.network_reader.NodesReader[source]

Bases: object

initialize(network)[source]
internal_nodes_only
classmethod load(**properties)[source]
mixed_nodes
name
virtual_nodes_only

bmtk.simulator.core.node_population module

class bmtk.simulator.core.node_population.NodePopulation[source]

Bases: object

initialize(network)[source]
internal_nodes_only
classmethod load(**properties)[source]
mixed_nodes
name
virtual_nodes_only
class bmtk.simulator.core.node_population.SimNode[source]

Bases: object

gid
node_id

bmtk.simulator.core.node_sets module

class bmtk.simulator.core.node_sets.NodeSet(filter_params, network)[source]

Bases: object

gids()[source]
nodes()[source]
population_names()[source]
populations()[source]
class bmtk.simulator.core.node_sets.NodeSetAll(network)[source]

Bases: bmtk.simulator.core.node_sets.NodeSet

bmtk.simulator.core.node_sets.to_list(val)[source]

bmtk.simulator.core.pyfunction_cache module

bmtk.simulator.core.pyfunction_cache.add_cell_model(func, directive, model_type='*', overwrite=True)[source]
bmtk.simulator.core.pyfunction_cache.add_cell_processor(func, name=None, overwrite=True)[source]
bmtk.simulator.core.pyfunction_cache.add_synapse_model(func, name=None, overwrite=True)[source]
bmtk.simulator.core.pyfunction_cache.add_weight_function(func, name=None, overwrite=True)[source]
bmtk.simulator.core.pyfunction_cache.cell_model(*wargs, **wkwargs)[source]

A decorator for registering NEURON cell loader functions.

bmtk.simulator.core.pyfunction_cache.load_py_modules(cell_models=None, syn_models=None, syn_weights=None, cell_processors=None)[source]
bmtk.simulator.core.pyfunction_cache.synapse_model(*wargs, **wkwargs)[source]

A decorator for registering NEURON synapse loader functions.

bmtk.simulator.core.pyfunction_cache.synaptic_weight(*wargs, **wkwargs)[source]

A decorator for registering a function as a synaptic weight function. To use either:

@synaptic_weight
def weight_function():
    ...

or:

@synaptic_weight(name='name_in_edge_types')
def weight_function():
    ...

Once the decorator has been attached and imported the functions will automatically be added to py_modules and BMTK will when assigning synaptic/gap junction weights for edges with matching “weight_function” attribute

bmtk.simulator.core.simulation_config module

class bmtk.simulator.core.simulation_config.SimulationConfig(*args, **kwargs)[source]

Bases: bmtk.utils.sonata.config.sonata_config.SonataConfig

A special version of SonataConfig that contains some methods that can be used by the simulators. Mainly it contains the build_env() method which can be called to setup logging plus initialize the ‘output_dir’ folder.

Functionality that is specific to SONATA should go in SonataConfig

build_env(force=False)[source]

Creates the folder(s) set in ‘output’ section, sets up logging and copies over the configuration

copy_to_output()[source]
io
validate()[source]
validator
bmtk.simulator.core.simulation_config.from_dict(config_dict, validator=None, **opts)[source]
bmtk.simulator.core.simulation_config.from_json(config_file, validator=None, **opts)[source]

bmtk.simulator.core.simulation_config_validator module

class bmtk.simulator.core.simulation_config_validator.SimulationConfigValidator(schema, types=(), resolver=None, format_checker=None, file_formats=())[source]

Bases: jsonschema.validators.Draft4Validator

A JSON Schema validator class that will store a schema (passed into the constructor) and validate a json file. It has all the functionality of the JSONSchema format, plus includes special types and parameters like making sure a value is a file or directory type, checking csv files, etc.

To Use:
validator = SimConfigValidator(json_schema.json) validator.validate(file.json)
is_type(instance, dtype)[source]

bmtk.simulator.core.simulator module

class bmtk.simulator.core.simulator.Simulator[source]

Bases: object

add_mod(module)[source]
run()[source]

bmtk.simulator.core.simulator_network module

class bmtk.simulator.core.simulator_network.SimNetwork[source]

Bases: object

add_component(name, path)[source]
add_edges(edge_population)[source]
add_node_set(name, node_set)[source]
add_nodes(node_population)[source]
build()[source]
build_nodes()[source]
build_recurrent_edges(**opts)[source]
build_virtual_connections()[source]
classmethod from_builder(network)[source]
classmethod from_config(conf, **properties)[source]

Generates a graph structure from a json config file or dictionary.

Parameters:
  • conf – name of json config file, or a dictionary with config parameters
  • properties – optional properties.
Returns:

A graph object of type cls

classmethod from_manifest(manifest_json)[source]
get_component(name)[source]
get_edge_adaptor(name)[source]
get_node_adaptor(name)[source]
get_node_groups(populations=None)[source]
get_node_population(name)[source]
get_node_populations()[source]
get_node_set(node_set)[source]
get_node_sets(populations=None, groupby=None, **filterby)[source]
has_component(name)[source]
io
load_gap_junc_files(gj_dic)[source]
node_populations
node_properties(populations=None)[source]
py_function_caches
recurrent_edges

Module contents