text
stringlengths
0
828
.. versionchanged:: 0.11.3
Clear temporary routes by setting ``df_routes`` property of
:attr:`canvas_slave`.
'''
if self.plugin is None:
return
# XXX Negative `route_i` corresponds to temporary route being
# drawn. Since electrode selection terminates route drawing, clear any
# rows corresponding to negative `route_i` values from the routes
# table.
slave.df_routes = slave.df_routes.loc[slave.df_routes.route_i >=
0].copy()
state = self.canvas_slave.electrode_states.get(data['electrode_id'], 0)
self.plugin.execute_async('microdrop.electrode_controller_plugin',
'set_electrode_states',
electrode_states=pd
.Series([not state],
index=[data['electrode_id']]))"
3988,"def on_canvas_slave__electrode_pair_selected(self, slave, data):
'''
Process pair of selected electrodes.
For now, this consists of finding the shortest path between the two
electrodes and appending it to the list of droplet routes for the
current step.
Note that the droplet routes for a step are stored in a frame/table in
the `DmfDeviceController` step options.
.. versionchanged:: 0.11
Clear any temporary routes (drawn while mouse is down) from routes
list.
.. versionchanged:: 0.11.3
Clear temporary routes by setting ``df_routes`` property of
:attr:`canvas_slave`.
'''
import networkx as nx
source_id = data['source_id']
target_id = data['target_id']
if self.canvas_slave.device is None or self.plugin is None:
return
# XXX Negative `route_i` corresponds to temporary route being
# drawn. Since electrode pair selection terminates route drawing,
# clear any rows corresponding to negative `route_i` values from the
# routes table.
slave.df_routes = slave.df_routes.loc[slave.df_routes.route_i >=
0].copy()
try:
shortest_path = self.canvas_slave.device.find_path(source_id,
target_id)
self.plugin.execute_async('droplet_planning_plugin',
'add_route', drop_route=shortest_path)
except nx.NetworkXNoPath:
logger.error('No path found between %s and %s.', source_id,
target_id)"
3989,"def on_canvas_slave__route_electrode_added(self, slave, electrode_id):
'''
.. versionchanged:: 0.11
Draw temporary route currently being formed.
.. versionchanged:: 0.11.3
Update routes table by setting ``df_routes`` property of
:attr:`canvas_slave`.
'''
logger.debug('Route electrode added: %s', electrode_id)
if slave._route.electrode_ids is None:
return
df_route = pd.DataFrame([[-1, e, i] for i, e in
enumerate(slave._route.electrode_ids)],
columns=['route_i', 'electrode_i',
'transition_i'])
# XXX Negative `route_i` corresponds to temporary route being
# drawn. Append row entries for temporary route to existing routes
# table.
df_routes = slave.df_routes.loc[slave.df_routes.route_i >= 0].copy()
self.canvas_slave.df_routes = pd.concat([df_routes, df_route])"
3990,"def ping_hub(self):
'''
Attempt to ping the ZeroMQ plugin hub to verify connection is alive.
If ping is successful, record timestamp.
If ping is unsuccessful, call `on_heartbeat_error` method.
'''
if self.plugin is not None:
try:
self.plugin.execute(self.plugin.hub_name, 'ping', timeout_s=1,
silent=True)
except IOError:
self.on_heartbeat_error()
else:
self.heartbeat_alive_timestamp = datetime.now()
logger.debug('Hub connection alive as of %s',
self.heartbeat_alive_timestamp)
return True"
3991,"def on_electrode_states_updated(self, states):