eoscircuits package

Submodules

eoscircuits.basecircuit module

Base Circuit Class for EOS Circuits

class eoscircuits.basecircuit.Circuit(graph, config, extra_comps=<factory>)[source]

Bases: object

A Dataclass of Base EOS Circuit

Parameters
  • graph (networkx.classes.multidigraph.MultiDiGraph) –

  • config (eoscircuits.basecircuit.Config) –

  • extra_comps (List[neurokernel.LPU.NDComponents.NDComponent]) –

Return type

None

classmethod add_nodes_to_graph(G, cfg, node_type, ndcomp_clsname, ndcomp_module)[source]

Add Node to Graph

This method adds nodes to Circuit.graph with the appropriate ids and attributes based on the Circuit.Config specifications.

Parameters
  • G (networkx.classes.multidigraph.MultiDiGraph) – The networkx graph that the node should be added to

  • cfg (eoscircuits.basecircuit.Config) – The configuration instance

  • node_type (Config.node_types) – The node types permissible according to the configuration

  • ndcomp_clsname (str) – The class name of the NeuroDriver component

  • ndcomp_module (Module) – The name of the ndcomp_module in the associated model.py file for each circuit module. This name is used to pull the params from the correct class from the model.py file to add to the graph.

Return type

None

config: eoscircuits.basecircuit.Config

Configuration of Circuit. Fully Specifies the Circuit

abstract classmethod create_from_config(config)[source]

class method that creates an instance of circuit from configuration

Parameters

config (eoscircuits.basecircuit.Config) –

Return type

eoscircuits.basecircuit.Circuit

classmethod create_graph(config)[source]

class method that creates an instance of networkx graph from configuration

Parameters

config (eoscircuits.basecircuit.Config) –

Return type

networkx.classes.multidigraph.MultiDiGraph

extra_comps: List[neurokernel.LPU.NDComponents.NDComponent]

Extra Components to be aded to NeuroKernel at Run Time

graph: networkx.classes.multidigraph.MultiDiGraph

Specification of Executable Graph Compatible with NeuroDriver

abstract property inputs

input variable and uids dictionary

abstract property outputs

output variable and uids dictionary

simulate(t, inputs, record_var_list=None, sample_interval=1)[source]

Simulate The Circuit Update Affinities and Change Circuit Accordingly

Parameters
  • t (numpy.ndarray) – input time array

  • inputs (Any) –

    input data

    • if is BaseInputProcessor instance, passed to LPU directly

    • if is dictionary, passed to ArrayInputProcessor if is compatible

  • record_var_list (Iterable[Tuple[str, Iterable]]) – [(var, uids)] list of tuples of variables to be recorded during simulation

  • sample_interval (int) – interval at which output is recorded

Returns

  • fi: BaseInputProcessor

  • fo: OutputRecorder

  • lpu: LPU

Return type

A tuple with the follow 3 components

update_graph_attributes(data_dict, node_predictive=None)[source]

Update Attributes of the graph

Parameters
  • data_dict (dict) – a dictionary of {attr: value} to be set for all filtered nodes

  • node_predictive (Optional[Callable[networkx.classes.reportviews.NodeView, bool]]) – a function that filtering of nodes from networkx.nodes(data=True)() call

Return type

None

Example

>>> circuit.update_graph_attributes(
        {'sigma':1.},
        node_predictive=lambda key, val: val['class'] == 'NoisyConnorStevens'
    )
class eoscircuits.basecircuit.Config[source]

Bases: object

A Base Dataclass of EOS Configuration

Config objects are full specifications of the executable circuit modules in the EOSCircuits module. It is consumed by the Circuit.create_from_config() function to create instances of EOS Executable Circuits.

Among others, Config objects provide 3 types attributes:

  1. Number of Nodes: N{x}

    • These are attributes that specify, for example, the number of receptor types in the circuit is specified as NR

  2. Node Ids:

    • These are attributes that specify the unique node ids for every neuron type in the circuit. For example, osns defines all unique node ids of the osns.

  3. Routing Table: {source_node_type}_to_{target_node_type}

    • These are attributes that specify how node types are connected together. Routing tables are typically numpy.ndarray of either numpy.ndarray of (int, int) or (int, int), where each entry is the integer indices of the source and target nodes in the corresponding Node Ids list.

    • For example, if the routing table osn_to_pn[0][1] = (1,2) means that the in the 0-th receptor type, the 1st OSN is connected to the 2nd PN expressing this particular receptor type.

Return type

None

abstract property node_types

List of Recognized Node Types

exception eoscircuits.basecircuit.EOSCircuitException[source]

Bases: Exception

Base EOS Circuit Exception

eoscircuits.plot module

Plotting Modules for EOSCircuits

This module uses olftrans.plot as basis and adds additional features to handle data formats that are returned by NeuroDriver

exception eoscircuits.plot.EOSPlotterException[source]

Bases: Exception

Base EOS plotter exception

eoscircuits.plot.plot_data(data, markersize=None, color='k', **kwargs)[source]

Plot Continuous Valued Data

Plots data returned by NeuroDriver’s OutputRecorder where each the data is a dictionary of dictionaries, where the first dictionary is keyed by node_id and the second dictionary is keyed by ‘data’ and ‘time’

Parameters
  • data (dict) –

  • markersize (Optional[int]) –

Return type

matplotlib.axes._axes.Axes

eoscircuits.plot.plot_spikes(spikes, ax=None, markersize=None, color='k')[source]

Plot Spikes returned by NeuroDriver’s OutputRecorder

Parameters
  • spikes (dict) –

  • ax (Optional[matplotlib.axes._axes.Axes]) –

  • markersize (Optional[int]) –

  • color (Union[str, Any]) –

Return type

matplotlib.axes._axes.Axes

Module contents

Top-level package for EOScircuits.