cleo.registry module#
Code for orchestrating inter-device interactions.
This should only be relevant for developers, not users, as this code is used under the hood when interacting devices are injected (e.g., light and opsin).
- class cleo.registry.DeviceInteractionRegistry(sim: CLSimulator)[source]#
Bases:
object
Facilitates the creation and maintenance of ‘neurons’ and ‘synapses’ implementing many-to-many light-opsin/indicator relationships
Method generated by attrs for class DeviceInteractionRegistry.
- connect_light_to_ldd_for_ng(light: Light, ldd: LightDependent, ng: NeuronGroup) None [source]#
Connects a light to a light-dependent device for a given neuron group.
- Parameters
light (Light) – Light being injected
ldd (LightDependent) – Light-dependent device the light will affect
ng (NeuronGroup) – Neurons affected by the light-dependent device
- Raises
ValueError – if the connection has already been made
- connections: set[Tuple['Light', 'LightDependent', NeuronGroup]]#
Set of (light, light-dependent device, neuron group) tuples representing previously created connections.
- init_register_light(light: Light) Subgroup [source]#
Creates neurons for the light source, if they don’t already exist
- ldds_for_ng: dict[NeuronGroup, set['LightDependent']]#
Maps neuron group to the light-dependent devices injected into it
- light_prop_model = '\n T : 1\n epsilon : 1\n Ephoton : joule\n Irr_post = epsilon * T * Irr0_pre : watt/meter**2 (summed)\n phi_post = Irr_post / Ephoton : 1/second/meter**2 (summed)\n '#
Model used in light propagation synapses
- light_prop_syns: dict[Tuple['LightDependent', NeuronGroup], Synapses]#
Maps (light-dependent device, neuron group) to the synapses implementing light propagation
- light_source_ng: NeuronGroup#
Represents ALL light sources (multiple devices)
- lights_for_ng: dict[NeuronGroup, set['Light']]#
Maps neuron group to the lights injected into it
- register(device: InterfaceDevice, ng: NeuronGroup) None [source]#
Registers a device injection with the registry.
- Parameters
device (InterfaceDevice) – Device being injected
ng (NeuronGroup) – Neurons being injected into
- register_ldd(ldd: LightDependent, ng: NeuronGroup)[source]#
Connects lights previously injected into this neuron group to this light-dependent device
- register_light(light: Light, ng: NeuronGroup)[source]#
Connects light to light-dependent devices already injected into this neuron group
- sim: CLSimulator#
- source_for_light(light: Light) Subgroup [source]#
Returns the subgroup representing the given light source
- subgroup_idx_for_light: dict['Light', slice]#
Maps light to its indices in the
light_source_ng
- cleo.registry.registries: dict['CLSimulator', cleo.registry.DeviceInteractionRegistry] = {}#
Maps simulator to its registry
- cleo.registry.registry_for_sim(sim: CLSimulator) DeviceInteractionRegistry [source]#
Returns the registry for the given simulator