# calibcant - tools for thermally calibrating AFM cantilevers
#
-# Copyright (C) 2008-2011 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2008-2012 W. Trevor King <wking@drexel.edu>
#
# This file is part of calibcant.
#
-# calibcant is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# calibcant 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.
#
-# calibcant 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 Lesser General Public License for more details.
+# calibcant 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 Lesser General Public
-# License along with calibcant. If not, see
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU General Public License along with
+# calibcant. If not, see <http://www.gnu.org/licenses/>.
"""Calculate `k` from arrays of bumps, temperatures, and vibrations.
vib_axes.plot(vibrations, 'b.-')
vib_axes.set_ylabel('thermal deflection variance (V^2)')
- figure.show()
+ if hasattr(figure, 'show'):
+ figure.show()
def calib_load_all(filename, group='/'):
assert group.endswith('/'), group
bumps,temperatures,vibrations,calibration_config,k,k_s = calib_load(
filename, group+'calibration/')
+ if bumps is None:
+ bumps = _numpy.zeros(
+ (calibration_config['num-bumps'],), dtype=float)
+ if temperatures is None:
+ temperatures = _numpy.zeros(
+ (calibration_config['num-temperatures'],), dtype=float)
+ if vibrations is None:
+ vibrations = _numpy.zeros(
+ (calibration_config['num-vibrations'],), dtype=float)
changed_bump = changed_temperature = changed_vibration = False
for i in range(calibration_config['num-bumps']):
bump_group = '%sbump/%d/' % (group, i)
- (raw_bump,bump_config,z_channel_config,z_axis_config,
+ (raw_bump,bump_config,z_axis_config,
deflection_channel_config,processed_bump) = _bump_load(
filename=filename, group=bump_group)
sensitivity = _bump_analyze(
data=raw_bump, bump_config=bump_config,
- z_channel_config=z_channel_config,
z_axis_config=z_axis_config,
deflection_channel_config=deflection_channel_config)
bumps[i] = sensitivity
for i,bump in enumerate(bump_details):
sensitivity = _bump_analyze(
data=bump['raw_bump'], bump_config=bump['bump_config'],
- z_channel_config=bump['z_channel_config'],
z_axis_config=bump['z_axis_config'],
deflection_channel_config=bump['deflection_channel_config'],
plot=True)