"Control of a piezo-based atomic force microscope."
+import time as _time
+
import numpy as _numpy
try:
import matplotlib as _matplotlib
import matplotlib.pyplot as _matplotlib_pyplot
- import time as _time # for timestamping lines on plots
except (ImportError, RuntimeError), e:
_matplotlib = None
_matplotlib_import_error = e
return self._deflection_channel().subdevice.get_dtype()
def move_to_pos_or_def(self, axis_name, position=None, deflection=None,
- step=1, return_data=False, pre_move_steps=0):
+ step=1, return_data=False, pre_move_steps=0,
+ frequency=None):
"""TODO
pre_move_steps : int
number of 'null' steps to take before moving (confirming a
stable input deflection).
+ frequency : float
+ The target step frequency in hertz. If `Null`, go as fast
+ as possible. Note that this is software timing, so it
+ should not be relied upon for precise results.
"""
if position is None and deflection is None:
raise ValueError('must specify position, deflection, or both')
if aquire_data:
def_array.append(current_deflection)
pos_array.append(self.last_output[axis_name])
+ if frequency is not None:
+ time_step = 1./frequency
+ next_time = _time.time() + time_step
# step in until we hit our target position or exceed our target deflection
while (self.last_output[axis_name] != position and
current_deflection < deflection):
if aquire_data:
def_array.append(current_deflection)
pos_array.append(self.last_output[axis_name])
+ if frequency is not None:
+ now = _time.time()
+ if now < next_time:
+ _time.sleep(next_time - now)
+ next_time += time_step
log_string = (
'move to position %d or deflection %g on axis %s complete'