3 # Copyright (C) 2009-2012 W. Trevor King <wking@tremily.us>
5 # This file is part of unfold_protein.
7 # unfold_protein is free software: you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation, either version 3 of the License, or (at your option) any
12 # unfold_protein is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 # You should have received a copy of the GNU General Public License along with
18 # unfold_protein. If not, see <http://www.gnu.org/licenses/>.
20 """Run a mechanical protein unfolding experiment."""
25 import numpy as _numpy
27 from unfold_protein import __version__
28 import unfold_protein.storage as _storage
31 if __name__ == '__main__':
32 from argparse import ArgumentParser
34 parser = ArgumentParser(
35 description=__doc__, version=__version__)
38 help='Path to a song to play when the experiment is complete')
40 '-S', '--no-stepper-tweaks', dest='stepper_tweaks',
41 action='store_const', const=False, default=True,
42 help=("Don't move the stepper except for the initial approach "
43 "and final retraction"))
45 args = parser.parse_args()
49 scanner = _storage.load_scanner()
50 scanner.load_from_config(devices=devices)
51 scanner.unfolder.afm.piezo.zero()
52 scanner.run(stepper_tweaks=args.stepper_tweaks)
54 scanner.unfolder.afm.move_away_from_surface()
55 scanner.unfolder.afm.piezo.zero()
56 for device in devices:
59 song = os.path.abspath(os.path.expanduser(args.song))
60 os.system("aplay '%s'" % song)