This is useful if you're not around to monitor a long run. If the
laser is disrupted (e.g. via a bubble in the fluid cell), the
photodiode voltage can flatlign, even if you aren't off the surface.
A confused UnfoldScanner with *think* it's off the surface, and charge
blindly in, crushing the cantilever into itsy bits ;).
Laser disruption detection is a great reason to measure the total
photodiode voltage. Unfortunately, that signal is not carried on the
cable between the MultiMode and the NanoScope. I tried jumping it out
of the MultiMode by hand, but after a few weeks like that, the board
died. I'm not sure it was related, but I think it's safer to just
disable stepper tweaks when you're not around to monitor the signal.
parser.add_argument(
'-s', '--song',
help='Path to a song to play when the experiment is complete')
+ parser.add_argument(
+ '-S', '--no-stepper-tweaks', dest='stepper_tweaks',
+ action='store_const', const=False, default=True,
+ help=("Don't move the stepper except for the initial approach "
+ "and final retraction"))
args = parser.parse_args()
afm.piezo.zero()
unfolder = Unfolder(config=unfold_config, afm=afm)
scanner = UnfoldScanner(config=scan_config, unfolder=unfolder)
- scanner.run()
+ scanner.run(stepper_tweaks=args.stepper_tweaks)
finally:
afm.move_away_from_surface()
afm.piezo.zero()
self.unfolder = unfolder
self._state = {'x direction': 1}
- def run(self):
+ def run(self, stepper_tweaks=True):
self._stop = False
_signal.signal(_signal.SIGTERM, self._handle_stop_signal)
self.unfolder.afm.move_away_from_surface()
try:
self.unfolder.run()
except _ExceptionTooFar:
- self.stepper_approach()
+ if stepper_tweaks:
+ self.stepper_approach()
+ else:
+ raise
except _ExceptionTooClose:
- self.afm.move_far_from_surface()
- self.stepper_approach()
+ if stepper_tweaks:
+ self.afm.move_away_from_surface()
+ self.stepper_approach()
+ else:
+ raise
else:
self.position_scan_step()