Load and process the data from the calibration filedump.
Parameters:
Name |
Type |
Description |
Default |
filename |
path
|
Path to the file containing the calibration dump
|
required
|
reset_start |
len 2 tuple or None
|
If not None, shift calibration data to supplied starting point.
|
None
|
Returns:
Name | Type |
Description |
cal_data |
Nx3 array
|
The array containing calibration deltas.
|
Source code in mecode/profilometer_parse.py
| def load_and_curate(filename, reset_start=None):
""" Load and process the data from the calibration filedump.
Parameters
----------
filename : path
Path to the file containing the calibration dump
reset_start : len 2 tuple or None
If not None, shift calibration data to supplied starting point.
Returns
-------
cal_data : Nx3 array
The array containing calibration deltas.
"""
all_data, points = load_from_file(filename)
cleaned = clean_values(all_data[points[0]])
cleaned_again = clean_values(cleaned, window=0.02)
reference_mean = np.mean(cleaned_again)
total_mean = np.array([np.mean(vals) for vals in all_data.values()]).mean()
for point, values in all_data.iteritems():
cleaned = clean_values(values, 0.3, total_mean)
cleaned_again = clean_values(cleaned, 0.05)
cleaned_again = clean_values(cleaned_again, 0.02)
all_data[point] = reference_mean - np.mean(cleaned_again)
values = np.array([all_data[pt] for pt in points])
points = np.array(points)
x = points[:, 0]
y = points[:, 1]
z = values
cal_data = np.array([x, y, z]).T
if reset_start is not None:
cal_data[:, :2] -= cal_data[0, :2]
cal_data[:, :2] += reset_start
return cal_data
|