3 # Copyright (C) 2011 W. Trevor King <wking@drexel.edu>
5 # This file is part of unfold_protein.
7 # Unfold_protein is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation, either
10 # version 3 of the License, or (at your option) any later version.
12 # Unfold_protein is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with unfold_protein. If not, see
19 # <http://www.gnu.org/licenses/>.
21 """Run a mechanical protein unfolding experiment."""
26 from calibcant.config import Kelvin as _Kelvin
27 from unfold_protein import __version__ as version
28 from unfold_protein.afm import get_afm
29 from unfold_protein.unfolder import Unfolder
30 from unfold_protein.scan import UnfoldScanner
31 import unfold_protein.config as _config
34 if __name__ == '__main__':
35 from argparse import ArgumentParser
37 parser = ArgumentParser(
38 description='Play a pure tone', version=version)
41 help='Path to a song to play when the experiment is complete')
43 args = parser.parse_args()
45 unfold_config = _config.UnfoldCycleConfig()
46 unfold_config['temperature'] = _config.TemperatureConfig()
47 unfold_config['temperature']['units'] = _Kelvin
48 unfold_config['approach'] = _config.ApproachConfig()
49 unfold_config['unfold'] = _config.UnfoldConfig()
50 unfold_config['save'] = _config.SaveConfig()
51 scan_config = _config.ScanConfig()
52 scan_config['velocity'] = _config.VelocityScanConfig()
53 scan_config['position'] = _config.PositionScanConfig()
55 afm,comedi_device = get_afm(with_temperature=False)
56 unfolder = Unfolder(config=unfold_config, afm=afm)
57 scanner = UnfoldScanner(config=scan_config, unfolder=unfolder)
61 scanner.move_far_from_surface()
64 song = os.path.abspath(os.path.expanduser(args.song))
65 os.system("aplay '%s'" % song)