import signal as _signal
-from calibcant.calibrate import move_far_from_surface as _move_far_from_surface
import pypiezo.base as _pypiezo_base
from . import LOG as _LOG
except _ExceptionTooFar:
self.stepper_approach()
except _ExceptionTooClose:
- self.move_far_from_surface()
+ self.afm.move_far_from_surface()
self.stepper_approach()
else:
self.position_scan_step()
def _handle_stop_signal(self, signal, frame):
self._stop = True
- def move_far_from_surface(self):
- _LOG.info('retract with the stepper motor by {} m'.format(
- self.unfolder.config['approach']['far']))
- _move_far_from_surface(
- stepper=self.unfolder.afm.stepper,
- distance=self.unfolder.config['approach']['far'])
-
def stepper_approach(self):
config = self.unfolder.config['approach']
deflection = self.unfolder.read_deflection()
axis_name = 'x'
config = self.config['position']
axis_config = self.unfolder.afm.piezo.config.select_config(
- 'axes', self.unfolder.afm.axis_name,
+ 'axes', self.unfolder.afm.config['main-axis'],
get_attribute=_pypiezo_base.get_axis_name
)
pos = self.unfolder.afm.piezo.last_output[axis_name]
pos_m = _pypiezo_base.convert_bits_to_meters(axis_config, pos)
- next_pos_m = pos_m + self._state['x direction']*config['x step']
+ # HACK
+ try:
+ step = float(open('/home/wking/x-step', 'r').read())
+ _LOG.info('read step from file: {}'.format(step))
+ except Exception, e:
+ _LOG.warn('could not read step from file: {}'.format(e))
+ step = config['x step']
+ next_pos_m = pos_m + self._state['x direction']*step
if next_pos_m > config['x max']:
self._state['x direction'] = -1
- next_pos_m = pos_m + self._state['x direction']*config['x step']
+ next_pos_m = pos_m + self._state['x direction']*step
elif next_pos_m < config['x min']:
self._state['x direction'] = 1
- next_pos_m = pos_m + self._state['x direction']*config['x step']
+ next_pos_m = pos_m + self._state['x direction']*step
next_pos = _pypiezo_base.convert_meters_to_bits(
axis_config, next_pos_m)
_LOG.info('move {} from {:g} to {:g} bits'.format(