electrode_controller_plugin Package¶
electrode_controller_plugin
Package¶
Copyright 2015 Christian Fobel
This file is part of electrode_controller_plugin.
electrode_controller_plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
electrode_controller_plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with electrode_controller_plugin. If not, see <http://www.gnu.org/licenses/>.
-
class
microdrop.core_plugins.electrode_controller_plugin.
ElectrodeControllerPlugin
[source]¶ Bases:
pyutilib.component.core.core.SingletonPlugin
,microdrop.plugin_helpers.StepOptionsController
This class is automatically registered with the PluginManager.
Methods
activate
()Add this service to the global environment, and environments that manage the service’s interfaces. alias
(name[, doc, subclass])This function is used to declare aliases that can be used by a factory for constructing plugin instances. cleanup
()deactivate
()Remove this service from the global environment, and environments that manage the service’s interfaces. disable
()Disable this plugin. enable
()Enable this plugin. enabled
()Can be overriden to control whether a plugin is enabled. get_default_step_options
()get_plugin_step_values
(plugin_name[, ...])get_step
(step_number)get_step_fields
()get_step_form_class
()get_step_number
(default)get_step_options
([step_number])get_step_value
(name[, step_number])get_step_values
([step_number])implements
(interface[, namespace, inherit, ...])Can be used in the class definition of Plugin subclasses to declare the extension points that are implemented by this interface class. on_app_exit
()Handler called just before the MicroDrop application exits. on_plugin_disable
()Handler called once the plugin instance is disabled. on_plugin_enable
()Handler called once the plugin instance is enabled. on_step_swapped
(old_step_number, step_number)set_step_values
(values_dict[, step_number])Consider a scenario where most step options are simple types that are supported by flatland and can be listed in StepOptions (e.g., Integer, Boolean, etc.), but there is at least one step option that is a type not supported by flatland, such as a numpy.array. -
on_plugin_enable
()[source]¶ Handler called once the plugin instance is enabled.
Note: if you inherit your plugin from AppDataController and don’t implement this handler, by default, it will automatically load all app options from the config file. If you decide to overide the default handler, you should call:
AppDataController.on_plugin_enable(self)to retain this functionality.
-
plugin_name
= 'wheelerlab.electrode_controller_plugin'¶
-
-
class
microdrop.core_plugins.electrode_controller_plugin.
ElectrodeControllerZmqPlugin
(parent, *args, **kwargs)[source]¶ Bases:
zmq_plugin.plugin.Plugin
API for turning electrode(s) on/off.
- Must handle:
- Updating state of hardware channels (if connected).
- Updating device user interface.
Attributes
electrode_states
logger
Return logger configured with a name in the following form – <module_name>.<class_name>.<method_name>->”<self.name>” Methods
close
()Close all sockets. execute
(target_name, command[, timeout_s, ...])Send request to execute the specified command to the identified target and return decoded result object. execute_async
(target_name, command[, ...])Send request to execute the specified command to the identified target. get_actuated_area
(electrode_states)Get area of actuated electrodes. get_channel_states
()returns: State of channels, indexed by channel. get_state
(electrode_states)on_command_recv
(frames)Process multi-part message from command socket. on_execute__get_channel_states
(request)on_execute__ping
(request)on_execute__set_electrode_state
(request)on_execute__set_electrode_states
(request)on_subscribe_recv
(msg_frames)Process multi-part message from subscribe socket. query
(request, **kwargs)Send request message to hub, receive response, and return decoded reply message. register
()Register as a plugin with the central hub. reset
()Reset the plugin state. reset_command_socket
()Create and configure command_socket
socket (existing socket is destroyed if it exists).reset_query_socket
()Create and configure query_socket
socket (existing socket is destroyed if it exists).reset_subscribe_socket
()Create and configure subscribe_socket
socket (existing socket is destroyed if it exists).send_command
(request)Send command message request through hub. set_electrode_state
(electrode_id, state)Set the state of a single electrode. set_electrode_states
(electrode_states[, save])Set the state of multiple electrodes. -
electrode_states
¶
-
get_channel_states
()[source]¶ Returns: State of channels, indexed by channel. Return type: (pandas.Series)
-
set_electrode_states
(electrode_states, save=True)[source]¶ Set the state of multiple electrodes.
Parameters: - electrode_states (pandas.Series) – State of electrodes, indexed by electrode identifier (e.g., “electrode001”).
- save (bool) – Trigger save request for protocol step.
Returns: - States of modified channels and electrodes, as well as the
total area of all actuated electrodes.
Return type: (dict)
-
microdrop.core_plugins.electrode_controller_plugin.
drop_duplicates_by_index
(series)[source]¶ Drop all but first entry for each set of entries with the same index value.
Parameters: series (pandas.Series) – Input series. Returns: - Input series with first value in series for each
- distinct index value (i.e., duplicate entries dropped for same index value).
Return type: (pandas.Series)