#!/usr/bin/env python
#
-# Copyright (C) 2011 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2009-2012 W. Trevor King <wking@tremily.us>
#
# This file is part of unfold_protein.
#
-# Unfold_protein is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# unfold_protein is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
#
-# Unfold_protein is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
+# unfold_protein is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with unfold_protein. If not, see
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU General Public License along with
+# unfold_protein. If not, see <http://www.gnu.org/licenses/>.
"""Run a mechanical protein unfolding experiment."""
import os
import os.path
-from unfold_protein import __version__ as version
-from unfold_protein.afm import get_afm
+import numpy as _numpy
+
+from pyafm.storage import load_afm as _load_afm
+from pyafm.config import Kelvin as _Kelvin
+from unfold_protein import __version__
from unfold_protein.unfolder import Unfolder
from unfold_protein.scan import UnfoldScanner
import unfold_protein.config as _config
from argparse import ArgumentParser
parser = ArgumentParser(
- description='Play a pure tone', version=version)
+ description=__doc__, version=__version__)
parser.add_argument(
'-s', '--song',
help='Path to a song to play when the experiment is complete')
args = parser.parse_args()
unfold_config = _config.UnfoldCycleConfig()
- unfold_config['temperature'] = _config.TemperatureConfig()
unfold_config['approach'] = _config.ApproachConfig()
unfold_config['unfold'] = _config.UnfoldConfig()
+ unfold_config['unfold']['distance'] = 900e-9
unfold_config['save'] = _config.SaveConfig()
scan_config = _config.ScanConfig()
scan_config['velocity'] = _config.VelocityScanConfig()
+ #scan_config['velocity']['unfolding velocities'] = _numpy.array([1e-6])
+ scan_config['velocity']['num loops'] = 500
scan_config['position'] = _config.PositionScanConfig()
- afm,comedi_device = get_afm(with_temperature=False)
- unfolder = Unfolder(config=unfold_config, afm=afm)
- scanner = UnfoldScanner(config=scan_config, unfolder=unfolder)
+ devices = []
try:
+ afm = _load_afm()
+ afm.load_from_config(devices=devices)
+ afm.piezo.zero()
+ unfolder = Unfolder(config=unfold_config, afm=afm)
+ scanner = UnfoldScanner(config=scan_config, unfolder=unfolder)
scanner.run()
finally:
- scanner.move_far_from_surface()
- comedi_device.close()
+ afm.move_away_from_surface()
+ afm.piezo.zero()
+ for device in devices:
+ device.close()
if args.song:
song = os.path.abspath(os.path.expanduser(args.song))
os.system("aplay '%s'" % song)