text
stringlengths
0
828
method.
Returns
-------
pandas.DataFrame
Table containing one actuation RMS measurement and one device load
impedance measurement per row and the columns ``frequency``,
``voltage``, ``channel_i``, ``V_actuation``, ``capacitance``, and
``impedance``.
Rows are indexed by time since first measurement in frame.
'''
channel_count = len(channel_mask)
scan_count = sum(channel_mask)
frames = []
print ''
scan_count_i = 0
# Iterate through channel mask, measuring impedance for each selected
# channel in the mask.
for channel_i, state_i in enumerate(channel_mask):
if state_i:
scan_count_i += 1
print '\rMeasure impedance: {} ({}/{})'.format(channel_i,
scan_count_i,
scan_count),
channel_states_i = [0] * channel_count
channel_states_i[channel_i] = 1
start_time_i = datetime.utcnow()
feedback_results_i = \
self.measure_impedance(sampling_window_ms,
n_sampling_windows,
delay_between_windows_ms,
interleave_samples, use_rms,
channel_states_i)
# Convert custom feedback results object into a
# `pandas.DataFrame`.
df_result_i =\
feedback_results_to_impedance_frame(feedback_results_i)
df_result_i.insert(2, 'channel_i', channel_i)
df_result_i.insert(0, 'utc_start', start_time_i)
frames.append(df_result_i)
print ''
if not frames:
df_result = pd.DataFrame(None, columns=['utc_start', 'seconds',
'channel_i', 'frequency',
'V_actuation',
'capacitance',
'impedance'])
else:
df_result = pd.concat(frames)
return df_result"
970,"def i2c_write(self, address, data):
'''
Parameters
----------
address : int
Address of I2C device.
data : array-like
Array of bytes to send to device.
'''
data_ = uint8_tVector()
for i in range(0, len(data)):
data_.append(int(data[i]))
Base.i2c_write(self, address, data_)"
971,"def read_all_series_channel_values(self, f, channel):
'''
Return all values for the specified channel of the type corresponding
to the function `f`, where `f` is either `self.series_resistance` or
`self.series_capacitance`.
'''
values = []
channel_max_param_count = [3, 5]
for i in range(channel_max_param_count[channel]):
try:
values.append(f(channel, i))
except RuntimeError:
break
return values"
972,"def write_all_series_channel_values(self, read_f, write_f, channel,
values):
'''
Return all values for the specified channel of the type corresponding
to the function `f`, where `f` is either `self.series_resistance` or
`self.series_capacitance`.
'''
# Create a copy of the new values we intend to write. Otherwise, if
# `values` is a reference to the calibration object owned by the
# control board, it can be overwritten in the following step which will
# prevent the update.
#
# See http://microfluidics.utoronto.ca/trac/dropbot/ticket/81
values = copy.deepcopy(values)
# Read the current values, and only update the values that are
# different.
original_values = self.read_all_series_channel_values(read_f, channel)