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

## 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. 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]

## 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]
class microdrop.dmf_device.DmfDevice(svg_filepath, name=None, **kwargs)[source]

Bases: object

Attributes

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. Area of actuated electrodes in square millimeters. float
actuated_channels(actuated_electrodes_index)[source]
Parameters: actuated_electrodes_index (list or array-like) – Actuated electrode identifiers. Actuated channel index values, indexed by electrode identifier. pandas.Series
actuated_electrodes(actuated_channels_index)[source]
Parameters: actuated_channels_index (list or array-like) – Actuated channel indexes. Actuated electrode identifiers, indexed by channel index. 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. pandas.DataFrame
dirty
electrodes
find_path(source_id, target_id)[source]
Returns: A list of nodes on the shortest path from source to target. 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. Area of actuated electrodes in square millimeters. float
get_bounding_box()[source]
Returns: Tuple containing origin-x, origin-y, width and height, respectively. tuple
get_electrode_areas()[source]
Returns: Area of each electrode in square millimeters, indexed by electrode identifier. 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. 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. TypeError – file is not a DmfDevice. FutureVersionError – file was written by a future version of the software.
max_channel()[source]
Returns: Maximum channel index. 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. True if channel mappings have changed. bool
to_svg()[source]
Returns: SVG XML source with up-to-date electrode channel lists. 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). 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. 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()
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. 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. (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. 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. (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. List of scheduling requests (i.e., ScheduleRequest instances) for the function specified by function_name. 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: old_dmf_device (microdrop.dmf_device.DmfDevice) – Original device. dmf_device (microdrop.dmf_device.DmfDevice) – New device.
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 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: old_protocol (microdrop.protocol.Protocol) – Original protocol. protocol (microdrop.protocol.Protocol) – New protocol.
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) 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) 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

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()
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. 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. 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. 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. If ostream parameter is None, return output as string. None or str

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

Bases: object

Attributes

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