Welcome to microdrop’s documentation!


Contents:

Project Modules

microdrop Package

microdrop Package

microdrop.__init__.base_path()[source]
microdrop.__init__.glade_path()[source]

Return path to .glade files used by gtk to construct views.

__main__ Module

app Module

app_context Module

Copyright 2011 Ryan Fobel

This file is part of MicroDrop.

MicroDrop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Foundation, either version 3 of the License, or (at your option) any later version.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

microdrop.app_context.get_app()[source]
microdrop.app_context.get_hub_uri()[source]

config Module

Copyright 2011 Ryan Fobel

This file is part of MicroDrop.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

class microdrop.config.Config(filename=None)[source]

Bases: object

Methods

load([filename]) Load a Config object from a file.
save([filename])
default_config_directory = path('/home/docs/.microdrop')
default_config_path = path('/home/docs/.microdrop/microdrop.ini')
load(filename=None)[source]

Load a Config object from a file.

Parameters:

filename – path to file. If None, try loading from the default location, and if there’s no file, create a Config object with the default options.

Raises:
  • IOError – The file does not exist.
  • ConfigObjError – There was a problem parsing the config file.
  • ValidationError – There was a problem validating one or more fields.
save(filename=None)[source]
spec = '\n [dmf_device]\n # name of the most recently used DMF device\n name = string(default=None)\n\n [protocol]\n # name of the most recently used protocol\n name = string(default=None)\n\n [plugins]\n # directory containing microdrop plugins\n directory = string(default=None)\n\n # list of enabled plugins\n enabled = string_list(default=list())\n '
exception microdrop.config.ValidationError[source]

Bases: exceptions.Exception

dmf_device Module

Copyright 2011-2015 Ryan Fobel and Christian Fobel

This file is part of MicroDrop.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

exception microdrop.dmf_device.DeviceScaleNotSet[source]

Bases: exceptions.Exception

class microdrop.dmf_device.DmfDevice(svg_filepath, name=None, **kwargs)[source]

Bases: object

Attributes

df_electrode_channels
dirty
electrodes

Methods

actuated_area(state_of_all_channels) Compute area of all actuated electrodes.
actuated_channels(actuated_electrodes_index)
param actuated_electrodes_index:
 Actuated electrode identifiers.
actuated_electrodes(actuated_channels_index)
param actuated_channels_index:
 Actuated channel indexes.
diff_electrode_channels() Identify electrodes with modified channel lists.
find_path(source_id, target_id)
returns:A list of nodes on the shortest path from source to target.
get_actuated_electrodes_area(electrode_states) Compute area of actuated electrodes.
get_bounding_box()
returns:Tuple containing origin-x, origin-y, width and height,
get_electrode_areas()
returns:Area of each electrode in square millimeters, indexed by electrode
get_electrode_channels() Load the channels associated with each electrode from the device layer of an SVG source.
get_svg_frame() Return a pandas.DataFrame containing the vertices for electrode paths.
load(svg_filepath, **kwargs) Load a DmfDevice from a file.
max_channel()
returns:Maximum channel index.
set_electrode_channels(electrode_id, channels) Set channels for electrode electrode_id to channels.
to_svg()
returns:SVG XML source with up-to-date electrode channel lists.
actuated_area(state_of_all_channels)[source]

Compute area of all actuated electrodes.

Parameters:state_of_all_channels (np.array) – An array-like instance containing an actuation level for each respective channel.
Returns:Area of actuated electrodes in square millimeters.
Return type:float
actuated_channels(actuated_electrodes_index)[source]
Parameters:actuated_electrodes_index (list or array-like) – Actuated electrode identifiers.
Returns:Actuated channel index values, indexed by electrode identifier.
Return type:pandas.Series
actuated_electrodes(actuated_channels_index)[source]
Parameters:actuated_channels_index (list or array-like) – Actuated channel indexes.
Returns:Actuated electrode identifiers, indexed by channel index.
Return type:pandas.Series
df_electrode_channels
diff_electrode_channels()[source]

Identify electrodes with modified channel lists.

Returns:Frame containing modified electrode channel lists. The two columns contain a list for the original and new assigned channels, respectively, indexed by electrode_id.
Return type:pandas.DataFrame
dirty
electrodes
find_path(source_id, target_id)[source]
Returns:A list of nodes on the shortest path from source to target.
Return type:list
get_actuated_electrodes_area(electrode_states)[source]

Compute area of actuated electrodes.

Parameters:electrode_states (pandas.Series) – Electrode states, indexed by electrode identifier. Any state greater than zero is considered actuated.
Returns:Area of actuated electrodes in square millimeters.
Return type:float
get_bounding_box()[source]
Returns:Tuple containing origin-x, origin-y, width and height, respectively.
Return type:tuple
get_electrode_areas()[source]
Returns:Area of each electrode in square millimeters, indexed by electrode identifier.
Return type:pandas.Series
get_electrode_channels()[source]

Load the channels associated with each electrode from the device layer of an SVG source.

For each electrode polygon, the channels are read as a comma-separated list from the “data-channels” attribute.

Returns:Each row corresponds to a channel connected to an electrode, where the "electrode_id" column corresponds to the "id" attribute of the corresponding SVG polygon.
Return type:pandas.DataFrame

Notes

  • Each electrode corresponds to a closed path in the device drawing.
  • Each channel index corresponds to a DMF device channel that may be actuated independently.
get_svg_frame()[source]

Return a pandas.DataFrame containing the vertices for electrode paths.

Each row of the frame corresponds to a single path vertex. The groupby() method may be used, for example, to apply operations to vertices on a per-path basis, such as calculating the bounding box.

classmethod load(svg_filepath, **kwargs)[source]

Load a DmfDevice from a file.

Parameters:

filename – path to file.

Raises:
  • TypeError – file is not a DmfDevice.
  • FutureVersionError – file was written by a future version of the software.
max_channel()[source]
Returns:Maximum channel index.
Return type:int
set_electrode_channels(electrode_id, channels)[source]

Set channels for electrode electrode_id to channels.

This includes updating self.df_electrode_channels.

Note

Existing channels assigned to electrode are overwritten.

Parameters:
  • electrode_id (str) – Electrode identifier.
  • channels (list) – List of channel identifiers assigned to the electrode.
Returns:

True if channel mappings have changed.

Return type:

bool

to_svg()[source]
Returns:SVG XML source with up-to-date electrode channel lists.
Return type:unicode
microdrop.dmf_device.extract_channels(df_shapes)[source]

Load the channels associated with each electrode from the device layer of an SVG source.

For each electrode polygon, the channels are read as a comma-separated list from the “data-channels” attribute.

Parameters:
  • svg_source (filepath) – Input SVG file containing connection lines.
  • shapes_canvas (shapes_canvas.ShapesCanvas) – Shapes canvas containing shapes to compare against connection endpoints.
  • electrode_layer (str) – Name of layer in SVG containing electrodes.
  • electrode_xpath (str) – XPath string to iterate throught electrodes.
  • namespaces (dict) – SVG namespaces (compatible with etree.parse).
Returns:

Each row corresponds to a channel connected to an electrode, where the "electrode_id" column corresponds to the "id" attribute of the corresponding SVG polygon.

Return type:

pandas.DataFrame

experiment_log Module

Copyright 2011 Ryan Fobel

This file is part of MicroDrop.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

class microdrop.experiment_log.ExperimentLog(directory=None)[source]

Methods

add_data(data[, plugin_name])
add_step(step_number[, attempt])
get(name[, plugin_name])
get_log_path()
load(filename) Load an experiment log from a file.
save([filename, format])
start_time()
to_frame()
returns:
add_data(data, plugin_name='core')[source]
add_step(step_number, attempt=0)[source]
class_version = '0.3.0'
get(name, plugin_name='core')[source]
get_log_path()[source]
classmethod load(filename)[source]

Load an experiment log from a file.

Parameters:

filename – path to file.

Raises:
  • TypeError – file is not an experiment log.
  • FutureVersionError – file was written by a future version of the software.
save(filename=None, format='pickle')[source]
start_time()[source]
to_frame()[source]
Returns:
Tuple containing:
  • Experiment information, including UTC start time, MicroDrop software version, list of plugin versions, etc.
  • Data frame with multi-index columns, indexed first by plugin name, then by plugin field name.

Note

Values may be Python objects. In future versions of MicroDrop, values may be restricted to json compatible types.

Return type:(pd.Series, pd.DataFrame)
microdrop.experiment_log.log_data_to_frame(log_data_i)[source]
Parameters:log_data_i (microdrop.experiment_log.ExperimentLog) – MicroDrop experiment log, as pickled in the data file in each experiment log directory.
Returns:Tuple containing: - Experiment information, including UTC start time, MicroDrop software version, list of plugin versions, etc. - Data frame with multi-index columns, indexed first by plugin name, then by plugin field name.

Note

Values may be Python objects. In future versions of MicroDrop, values may be restricted to json compatible types.

Return type:(pd.Series, pd.DataFrame)

interfaces Module

class microdrop.interfaces.IFoo[source]

Bases: pyutilib.component.core.core.Interface

class microdrop.interfaces.ILoggingPlugin[source]

Bases: pyutilib.component.core.core.Interface

Methods

on_critical(record)
on_debug(record)
on_error(record)
on_info(record)
on_warning(record)
on_critical(record)[source]
on_debug(record)[source]
on_error(record)[source]
on_info(record)[source]
on_warning(record)[source]
class microdrop.interfaces.IPlugin[source]

Bases: pyutilib.component.core.core.Interface

Methods

get_schedule_requests(function_name)
param function_name:
 Plugin callback function name.
get_step_form_class()
get_step_values([step_number])
on_app_exit() Handler called just before the MicroDrop application exits.
on_app_options_changed(plugin_name) Handler called when the app options are changed for a particular plugin.
on_dmf_device_changed(dmf_device) Handler called when a DMF device is modified (e.g., channel assignment, scaling, etc.).
on_dmf_device_saved(dmf_device) Handler called when a DMF device is saved.
on_dmf_device_swapped(old_dmf_device, dmf_device) Handler called when a different DMF device is swapped in (e.g., when a new device is loaded).
on_experiment_log_changed(experiment_log) Handler called when the current experiment log changes (e.g., when a protocol finishes running.
on_experiment_log_selection_changed(data) Handler called whenever the experiment log selection changes.
on_export_experiment_log_data(experiment_log) Handler called when the experiment log is exported.
on_metadata_changed(schema, ...) Handler called each time the experiment metadata has changed.
on_plugin_disable() Handler called once the plugin instance is disabled.
on_plugin_disabled(env, plugin) Handler called to notify that a plugin has been disabled.
on_plugin_enable() Handler called once the plugin instance is enabled.
on_plugin_enabled(env, plugin) Handler called to notify that a plugin has been enabled.
on_protocol_changed() Handler called when a protocol is modified.
on_protocol_pause() Handler called when a protocol is paused.
on_protocol_run() Handler called when a protocol starts running.
on_protocol_swapped(old_protocol, protocol) Handler called when a different protocol is swapped in (e.g., when a protocol is loaded or a new protocol is created).
on_step_complete(plugin_name[, return_value]) Handler called whenever a plugin completes a step.
on_step_created(step_number) Handler called whenever a new step is created.
on_step_options_changed(plugin, step_number) Handler called when the step options are changed for a particular plugin.
on_step_options_swapped(plugin, ...) Handler called when the step options are changed for a particular plugin.
on_step_run() Handler called whenever a step is executed.
on_step_swapped(old_step_number, step_number) Handler called when the current step is swapped.
get_schedule_requests(function_name)[source]
Parameters:function_name (str) – Plugin callback function name.
Returns:List of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name.
Return type:list
get_step_form_class()[source]
get_step_values(step_number=None)[source]
on_app_exit()[source]

Handler called just before the MicroDrop application exits.

on_app_options_changed(plugin_name)[source]

Handler called when the app options are changed for a particular plugin. This will, for example, allow for GUI elements to be updated.

Parameters:plugin (str) – Plugin name for which the app options changed
on_dmf_device_changed(dmf_device)[source]

Handler called when a DMF device is modified (e.g., channel assignment, scaling, etc.).

Parameters:dmf_device (microdrop.dmf_device.DmfDevice) –
on_dmf_device_saved(dmf_device)[source]

Handler called when a DMF device is saved.

Parameters:dmf_device (microdrop.dmf_device.DmfDevice) –
on_dmf_device_swapped(old_dmf_device, dmf_device)[source]

Handler called when a different DMF device is swapped in (e.g., when a new device is loaded).

Parameters:
on_experiment_log_changed(experiment_log)[source]

Handler called when the current experiment log changes (e.g., when a protocol finishes running.

Parameters:experiment_log (microdrop.experiment_log.ExperimentLog) – Reference to new experiment log instance.
on_experiment_log_selection_changed(data)[source]

Handler called whenever the experiment log selection changes.

Parameters:data – experiment log data (list of dictionaries, one per step) for the selected steps
on_export_experiment_log_data(experiment_log)[source]

Handler called when the experiment log is exported.

Parameters:log – experiment log data (list of dictionaries, one per step) for the selected steps
Returns:A dictionary of pandas.DataFrame objects containing any relevant data that should be exported by the plugin, each keyed by a unique name.
on_metadata_changed(schema, original_metadata, metadata)[source]

Handler called each time the experiment metadata has changed.

Parameters:
  • schema (dict) – jsonschema schema definition for metadata.
  • original_metadata – Original metadata.
  • metadata – New metadata matching schema
on_plugin_disable()[source]

Handler called once the plugin instance is disabled.

on_plugin_disabled(env, plugin)[source]

Handler called to notify that a plugin has been disabled.

Note that this signal is broadcast to all plugins implementing the IPlugin interface, whereas the on_plugin_disable() method is called directly on the plugin that is being disabled.

Parameters:
  • env (str) – pyutilib plugin environment.
  • plugin (str) – Plugin name.
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.

on_plugin_enabled(env, plugin)[source]

Handler called to notify that a plugin has been enabled.

Note that this signal is broadcast to all plugins implementing the IPlugin interface, whereas the on_plugin_enable() method is called directly on the plugin that is being enabled.

Parameters:
  • env (str) – pyutilib plugin environment.
  • plugin (str) – Plugin name.
on_protocol_changed()[source]

Handler called when a protocol is modified.

on_protocol_pause()[source]

Handler called when a protocol is paused.

on_protocol_run()[source]

Handler called when a protocol starts running.

on_protocol_swapped(old_protocol, protocol)[source]

Handler called when a different protocol is swapped in (e.g., when a protocol is loaded or a new protocol is created).

Parameters:
on_step_complete(plugin_name, return_value=None)[source]

Handler called whenever a plugin completes a step.

Returns:
  • 'Repeat': repeat the step
  • 'Fail': unrecoverable error (stop the protocol)
Return type:str or None
on_step_created(step_number)[source]

Handler called whenever a new step is created.

Parameters:step_number (int) – New step number.
on_step_options_changed(plugin, step_number)[source]

Handler called when the step options are changed for a particular plugin. This will, for example, allow for GUI elements to be updated based on step specified.

Parameters:
  • plugin (SingletonPlugin) – Plugin instance for which the step options changed.
  • step_number (int) – Step number that the options changed for.
on_step_options_swapped(plugin, old_step_number, step_number)[source]

Handler called when the step options are changed for a particular plugin. This will, for example, allow for GUI elements to be updated based on step specified.

Parameters:
  • plugin (SingletonPlugin) – Plugin instance for which the step options changed.
  • old_step_number (int) – Original step number.
  • step_number (int) – New step number.
on_step_run()[source]

Handler called whenever a step is executed. Note that this signal is only emitted in realtime mode or if a protocol is running.

Plugins that handle this signal must emit the on_step_complete() signal once they have completed the step. The protocol controller will wait until all plugins have completed the current step before proceeding.

Returns:
  • 'Repeat': repeat the step
  • 'Fail': unrecoverable error (stop the protocol)
Return type:str or None
on_step_swapped(old_step_number, step_number)[source]

Handler called when the current step is swapped.

Parameters:
  • old_step_number (int) – Original step number.
  • step_number (int) – New step number.
class microdrop.interfaces.IWaveformGenerator[source]

Bases: pyutilib.component.core.core.Interface

Methods

set_frequency(frequency) Set the waveform frequency.
set_voltage(voltage) Set the waveform voltage.
set_frequency(frequency)[source]

Set the waveform frequency.

Parameters:frequency – frequency in Hz
set_voltage(voltage)[source]

Set the waveform voltage.

Parameters:voltage – RMS voltage

logger Module

class microdrop.logger.CustomHandler[source]

Bases: logging.Handler

Attributes

name

Methods

acquire() Acquire the I/O thread lock.
addFilter(filter) Add the specified filter to this handler.
close() Tidy up any resources used by the handler.
createLock() Acquire a thread lock for serializing access to the underlying I/O.
emit(record)
filter(record) Determine if a record is loggable by consulting all the filters.
flush() Ensure all logging output has been flushed.
format(record) Format the specified record.
get_name()
handle(record) Conditionally emit the specified logging record.
handleError(record) Handle errors which occur during an emit() call.
release() Release the I/O thread lock.
removeFilter(filter) Remove the specified filter from this handler.
setFormatter(fmt) Set the formatter for this handler.
setLevel(level) Set the logging level of this handler.
set_name(name)
emit(record)[source]

microdrop Module

Copyright 2011 Ryan Fobel

This file is part of MicroDrop.

MicroDrop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by Foundation, either version 3 of the License, or (at your option) any later version.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

microdrop.microdrop.except_handler(*args, **kwargs)[source]
microdrop.microdrop.initialize_core_plugins()[source]
microdrop.microdrop.main()[source]

plugin_helpers Module

class microdrop.plugin_helpers.AppDataController[source]

Bases: object

Methods

get_app_fields()
get_app_form_class()
get_app_value(key)
get_app_values()
get_default_app_options()
get_plugin_app_values(plugin_name)
on_plugin_enable() Handler called once the plugin instance has been enabled.
set_app_values(values_dict)
get_app_fields()[source]
get_app_form_class()[source]
get_app_value(key)[source]
get_app_values()[source]
get_default_app_options()[source]
static get_plugin_app_values(plugin_name)[source]
on_plugin_enable()[source]

Handler called once the plugin instance has been enabled.

set_app_values(values_dict)[source]
class microdrop.plugin_helpers.PluginMetaData

Bases: tuple

Attributes

package_name Alias for field number 0
plugin_name Alias for field number 1
version Alias for field number 2

Methods

as_dict()
count(...)
from_dict(data)
index((value, [start, ...) Raises ValueError if the value is not present.
as_dict()
static from_dict(data)
package_name

Alias for field number 0

plugin_name

Alias for field number 1

version

Alias for field number 2

class microdrop.plugin_helpers.StepOptionsController[source]

Bases: object

Methods

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])
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.
get_default_step_options()[source]
static get_plugin_step_values(plugin_name, step_number=None)[source]
get_step(step_number)[source]
get_step_fields()[source]
get_step_form_class()[source]
get_step_number(default)[source]
get_step_options(step_number=None)[source]
get_step_value(name, step_number=None)[source]
get_step_values(step_number=None)[source]
set_step_values(values_dict, step_number=None)[source]

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.

Currently, this requires custom handling for all methods related to step options, as in the case of the DMF control board. Instead, during validation of step option values, we could simply exclude options that are not listed in the StepOptions definition from the validation, but pass along all values to be saved in the protocol.

This should maintain backwards compatibility while simplifying the addition of arbitrary Python data types as step options.

microdrop.plugin_helpers.from_dict(data)[source]
microdrop.plugin_helpers.get_plugin_info(plugin_root)[source]
Return a named tuple:
(package_name, plugin_name, version)

If plugin is not installed or invalid, returned tuple will be None.

microdrop.plugin_helpers.hub_execute(*args, **kwargs)[source]
microdrop.plugin_helpers.hub_execute_async(*args, **kwargs)[source]

plugin_manager Module

Copyright 2011 Ryan Fobel

This file is part of dmf_control_board.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

class microdrop.plugin_manager.ScheduleRequest

Bases: tuple

Attributes

after Alias for field number 1
before Alias for field number 0

Methods

count(...)
index((value, [start, ...) Raises ValueError if the value is not present.
after

Alias for field number 1

before

Alias for field number 0

microdrop.plugin_manager.disable(name, env='microdrop.managed')[source]
microdrop.plugin_manager.emit_signal(function, args=None, interface=<class 'microdrop.interfaces.IPlugin'>)[source]
microdrop.plugin_manager.enable(name, env='microdrop.managed')[source]
microdrop.plugin_manager.get_observers(function, interface=<class 'microdrop.interfaces.IPlugin'>)[source]
microdrop.plugin_manager.get_plugin_names(env=None)[source]
microdrop.plugin_manager.get_plugin_package_name(class_name)[source]
microdrop.plugin_manager.get_schedule(observers, function)[source]
microdrop.plugin_manager.get_service_class(name, env='microdrop.managed')[source]
microdrop.plugin_manager.get_service_instance(class_, env='microdrop.managed')[source]
microdrop.plugin_manager.get_service_instance_by_name(name, env='microdrop.managed')[source]
microdrop.plugin_manager.get_service_instance_by_package_name(name, env='microdrop.managed')[source]
microdrop.plugin_manager.get_service_names(env='microdrop.managed')[source]
microdrop.plugin_manager.load_plugins(plugins_dir='plugins')[source]
microdrop.plugin_manager.log_summary()[source]
microdrop.plugin_manager.post_install(install_path)[source]

protocol Module

Copyright 2011 Ryan Fobel and Christian Fobel

This file is part of MicroDrop.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

class microdrop.protocol.Protocol(name=None)[source]

Attributes

plugins

Methods

current_step()
delete_step(step_number)
delete_steps(step_ids)
first_step()
get_data(plugin_name)
get_step([step_number])
get_step_number(default)
get_step_values(plugin_name)
goto_step(step_number)
insert_step([step_number, value, notify])
insert_steps([step_number, count, values])
last_step()
load(filename) Load a Protocol from a file.
next_repetition()
next_step()
plugin_name_lookup(name[, re_pattern])
prev_step()
save(filename[, format])
set_data(plugin_name, data)
to_frame()
returns:Data frame with multi-index columns, indexed first by plugin name,
to_json()
returns:
to_ndjson([ostream]) Write protocol as newline delimted JSON (i.e., ndjson, see specification).
class_version = '0.2.0'
current_step()[source]
delete_step(step_number)[source]
delete_steps(step_ids)[source]
first_step()[source]
get_data(plugin_name)[source]
get_step(step_number=None)[source]
get_step_number(default)[source]
get_step_values(plugin_name)[source]
goto_step(step_number)[source]
insert_step(step_number=None, value=None, notify=True)[source]
insert_steps(step_number=None, count=None, values=None)[source]
last_step()[source]
classmethod load(filename)[source]

Load a Protocol from a file.

Parameters:

filename (str) – Path to file.

Raises:
  • TypeError – If file is not a Protocol.
  • FutureVersionError – If file was written by a future version of the software.
next_repetition()[source]
next_step()[source]
plugin_name_lookup(name, re_pattern=False)[source]
plugins
prev_step()[source]
save(filename, format='pickle')[source]
set_data(plugin_name, data)[source]
to_frame()[source]
Returns:Data frame with multi-index columns, indexed first by plugin name, then by plugin step field name.

Note

If an exception is encountered while processing a plugin value, the plugin causing the exception is skipped and protocol values related to the plugin are not included in the result.

Return type:pandas.DataFrame
to_json()[source]
Returns:
JSON-encoded dictionary, with two top-level keys:
  • keys:
    • Each key is a list containing a plugin name and a corresponding step field name.
  • values:
    • Maps to list of records (i.e., lists), one per protocol step.

Each record in the values list may be zipped together with keys to yield a plugin field name to value mapping for a single protocol step.

Return type:str
to_ndjson(ostream=None)[source]

Write protocol as newline delimted JSON (i.e., ndjson, see specification).

Each subsequent line in the output is a nested JSON record, list), one line per protocol step. The keys of the top-level object of each record correspond to plugin names. The second-level keys correspond to the step field name.

Parameters:ostream (file-like, optional) – Output stream to write to.
Returns:If ostream parameter is None, return output as string.
Return type:None or str

See also

to_frame(), to_json()

class microdrop.protocol.Step(plugin_data=None)[source]

Bases: object

Attributes

plugins

Methods

copy()
get_data(plugin_name)
plugin_name_lookup(name[, re_pattern])
set_data(plugin_name, data)
copy()[source]
get_data(plugin_name)[source]
plugin_name_lookup(name, re_pattern=False)[source]
plugins
set_data(plugin_name, data)[source]
microdrop.protocol.protocol_to_frame(protocol_i)[source]
Parameters:protocol_i (microdrop.protocol.Protocol) –

MicroDrop protocol.

Note

A MicroDrop protocol object is stored as pickled in the protocol file in each experiment log directory.

Returns:Data frame with rows indexed by 0-based step number and columns indexed (multi-index) first by plugin name, then by step field name.

Note

Values may be Python objects. In future versions of MicroDrop, values may be restricted to json compatible types.

Return type:pandas.DataFrame
microdrop.protocol.protocol_to_json(protocol)[source]
Parameters:protocol (microdrop.protocol.Protocol) –

MicroDrop protocol.

Note

A MicroDrop protocol object is stored as pickled in the protocol file in each experiment log directory.

Returns:
json-encoded dictionary, with two top-level keys:
  • keys:
    • Each key is a list containing a plugin name and a corresponding step field name.
  • values:
    • Maps to list of records (i.e., lists), one per protocol step.

Each record in the values list may be zipped together with keys to yield a plugin field name to value mapping for a single protocol step.

Return type:str

Subpackages

bin Package
create_portable_config Module
microdrop.bin.create_portable_config.main(output_dir)[source]
microdrop.bin.create_portable_config.parse_args(args=None)[source]

Parses arguments, returns (options, args).

latest_versions Module
microdrop.bin.latest_versions.get_latest_version_content(server_url='http://microfluidics.utoronto.ca/update')[source]
core_plugins Package
Subpackages
device_info_plugin Package
device_info_plugin Package

Copyright 2015 Christian Fobel

This file is part of device_info_plugin.

device_info_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.

dmf_control_board 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 device_info_plugin. If not, see <http://www.gnu.org/licenses/>.

class microdrop.core_plugins.device_info_plugin.DeviceInfoPlugin[source]

Bases: pyutilib.component.core.core.SingletonPlugin

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_schedule_requests(function_name) Returns a list of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name.
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_dmf_device_swapped(old_device, new_device)
on_plugin_disable() Handler called once the plugin instance is disabled.
on_plugin_enable() Handler called once the plugin instance is enabled.
cleanup()[source]
get_schedule_requests(function_name)[source]

Returns a list of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name.

on_app_exit()[source]

Handler called just before the MicroDrop application exits.

on_dmf_device_swapped(old_device, new_device)[source]
on_plugin_disable()[source]

Handler called once the plugin instance is disabled.

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.device_info_plugin'
class microdrop.core_plugins.device_info_plugin.DeviceInfoZmqPlugin(name, query_uri, subscribe_options=None)[source]

Bases: zmq_plugin.plugin.Plugin

Attributes

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.
on_command_recv(frames) Process multi-part message from command socket.
on_execute__dumps(request)
on_execute__get_device(request)
on_execute__get_electrode_channels(request)
on_execute__get_svg_frame(request)
on_execute__ping(request)
on_execute__set_electrode_channels(request) Set channels for electrode electrode_id to channels.
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.
on_execute__dumps(request)[source]
on_execute__get_device(request)[source]
on_execute__get_electrode_channels(request)[source]
on_execute__get_svg_frame(request)[source]
on_execute__set_electrode_channels(request)[source]

Set channels for electrode electrode_id to channels.

This includes updating self.df_electrode_channels.

Note

Existing channels assigned to electrode are overwritten.

Parameters:
  • electrode_id (str) – Electrode identifier.
  • channels (list) – List of channel identifiers assigned to the electrode.
on_plugin_install Module
release Module
rename Module
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.
cleanup()[source]
on_app_exit()[source]

Handler called just before the MicroDrop application exits.

on_plugin_disable()[source]

Handler called once the plugin instance is disabled.

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.

on_step_swapped(old_step_number, step_number)[source]
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_actuated_area(electrode_states)[source]

Get area of actuated electrodes.

get_channel_states()[source]
Returns:State of channels, indexed by channel.
Return type:(pandas.Series)
get_state(electrode_states)[source]
on_execute__get_channel_states(request)[source]
on_execute__set_electrode_state(request)[source]
on_execute__set_electrode_states(request)[source]
set_electrode_state(electrode_id, state)[source]

Set the state of a single electrode.

Parameters:
  • electrode_id (str) – Electrode identifier (e.g., “electrode001”)
  • state (int) – State of electrode
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)
on_plugin_install Module
release Module
rename Module
zmq_hub_plugin Package
zmq_hub_plugin Package

Copyright 2015 Christian Fobel

This file is part of zmq_hub_plugin.

zmq_hub_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.

dmf_control_board 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 zmq_hub_plugin. If not, see <http://www.gnu.org/licenses/>.

class microdrop.core_plugins.zmq_hub_plugin.MicroDropHub(query_uri, name='hub')[source]

Bases: zmq_plugin.hub.Hub

Attributes

logger logging.Logger – Class-specific logger.

Methods

on_command_recv(msg_frames)
on_execute__ping(request) Send “pong” response to requesting plugin.
on_execute__register(request) Add name of client to registry and respond with registry contents.
on_query_recv(msg_frames) Process multi-part message from query socket.
query_send(message) Send message to query socket.
reset() Reset the plugin state.
reset_command_socket() Create and configure command socket (existing socket is destroyed if it exists).
reset_publish_socket() Create and configure publish socket (existing socket is destroyed if it exists).
reset_query_socket() Create and configure query socket (existing socket is destroyed if it exists).
on_command_recv(msg_frames)[source]
class microdrop.core_plugins.zmq_hub_plugin.ZmqHubPlugin[source]

Bases: pyutilib.component.core.core.SingletonPlugin, microdrop.plugin_helpers.AppDataController

This class is automatically registered with the PluginManager.

Methods

AppFields alias of Form
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.
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_app_fields()
get_app_form_class()
get_app_value(key)
get_app_values()
get_default_app_options()
get_plugin_app_values(plugin_name)
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_plugin_disable() Handler called once the plugin instance is disabled.
on_plugin_enable() Handler called once the plugin instance is enabled.
set_app_values(values_dict)
AppFields

alias of Form

on_plugin_disable()[source]

Handler called once the plugin instance is disabled.

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.zmq_hub_plugin'
on_plugin_install Module
release Module
rename Module
gui Package
app_options_controller Module
cairo_view Module
channel_sweep Module
config_controller Module

Copyright 2011 Ryan Fobel

This file is part of MicroDrop.

MicroDrop 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.

MicroDrop 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 MicroDrop. If not, see <http://www.gnu.org/licenses/>.

class microdrop.gui.config_controller.ConfigController[source]

Bases: pyutilib.component.core.core.SingletonPlugin

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.
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_schedule_requests(function_name) Returns a list of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name.
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()
on_app_options_changed(plugin_name)
on_dmf_device_changed(dmf_device)
on_dmf_device_swapped(old_dmf_device, dmf_device)
on_plugin_enable()
on_protocol_changed()
on_protocol_swapped(old_protocol, protocol)
get_schedule_requests(function_name)[source]

Returns a list of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name.

on_app_exit()[source]
on_app_options_changed(plugin_name)[source]
on_dmf_device_changed(dmf_device)[source]
on_dmf_device_swapped(old_dmf_device, dmf_device)[source]
on_plugin_enable()[source]
on_protocol_changed()[source]
on_protocol_swapped(old_protocol, protocol)[source]
dmf_device_controller Module
dmf_device_controller.video Module
dmf_device_view.video Module
experiment_log_controller Module
field_filter_controller Module
main_window_controller Module
plugin_download_dialog Module
plugin_manager_controller Module
plugin_manager_dialog Module
protocol_controller Module
protocol_grid_controller Module
tests Package
test_dmf_device Module
test_experiment_log Module
test_protocol Module
update_dmf_control_board Module

Indices and tables