text stringlengths 0 828 |
|---|
Calculate $x$-position according to: |
__ | C | |
β²β± a β
| - - c_f | |
| a | |
x = ββββββββββββββ |
c_d - c_f |
where: |
- $C$ is the measured capacitance. |
- $c_f$ is the capacitance of the filler medium per unit area |
_(e.g., air)_. |
- $c_d$ is the capacitance of an electrode completely covered in |
liquid per unit area. |
- $a$ is the area of the actuated electrode(s). |
Note that this equation for $x$ assumes a single drop moving across an |
electrode with a length along the x-axis of Lx. If no value is provided |
for Lx, the electrode is assumed to be square, i.e., |
Lx=Ly=sqrt(area) |
''' |
if self.calibration._c_drop: |
c_drop = self.calibration.c_drop(self.frequency) |
else: |
c_drop = self.capacitance()[-1] / self.area |
if self.calibration._c_filler: |
c_filler = self.calibration.c_filler(self.frequency) |
else: |
c_filler = 0 |
if Lx is None: |
Lx = np.sqrt(self.area) |
return (self.capacitance(filter_order=filter_order, |
window_size=window_size, tol=tol) / self.area \ |
- c_filler) / (c_drop - c_filler) * Lx" |
952,"def mean_velocity(self, tol=0.05, Lx=None): |
''' |
Calculate the mean velocity for a step (mm/ms which is equivalent to |
m/s). Fit a line to the capacitance data and get the slope. |
''' |
dx = None |
dt = None |
p = None |
ind = None |
t_end = None |
if self.area == 0: |
return dict(dx=dx, dt=dt, p=p, ind=ind, t_end=t_end) |
x = self.x_position(Lx=Lx) |
# find the first and last valid indices |
ind_start = mlab.find(x.mask==False)[0] |
ind_last = mlab.find(x.mask==False)[-1] |
# if the original x value is within tol % of the final x value, include |
# all samples |
if x[ind_start] > (1 - tol) * x[ind_last] or x[ind_last] < 0: |
ind_stop = ind_last |
else: # otherwise, stop when x reaches (1 - tol) % of it's final value |
ind_stop = mlab.find(x > (1 - tol) * x[ind_last])[0] |
ind = [ind_start, ind_stop] |
# if we have at least 2 valid samples |
if len(ind) >=2: |
dx = np.diff(x[ind])[0] |
dt = np.diff(self.time[ind])[0] # ms |
# suppress polyfit warnings |
with warnings.catch_warnings(): |
warnings.simplefilter(""ignore"") |
# fit a line to the data |
p = np.polyfit(self.time[ind[0]:ind[1]], x[ind[0]:ind[1]], 1) |
# find time when the the line intercepts x[ind_last] |
ind_stop = mlab.find(self.time > \ |
(x[ind_last] - p[1]) / p[0]) |
if len(ind_stop): |
t_end = self.time[ind_stop[0]] |
else: |
t_end = self.time[-1] |
return dict(dx=dx, dt=dt, p=p, ind=ind, t_end=t_end)" |
953,"def to_frame(self, filter_order=3): |
"""""" |
Convert data to a `pandas.DataFrame`. |
Parameters |
---------- |
filter_order : int |
Filter order to use when filtering Z_device, capacitance, x_position, and dxdt. |
Data is filtered using a Savitzky-Golay filter with a window size that is adjusted |
based on the mean velocity of the drop (see _get_window_size). |
Returns |
------- |
pandas.DataFrame |
This DataFrame is indexed by a utc_timestamp and contains the following columns: |
frequency: actuation frequency (Hz) |
target_voltage: target voltage (V) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.