Remove unfold_protein.afm now that there is a configurable default AFM in pyafm.
authorW. Trevor King <wking@drexel.edu>
Mon, 26 Mar 2012 18:32:02 +0000 (14:32 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 26 Mar 2012 18:32:02 +0000 (14:32 -0400)
Now you can use pyafm.storage.load_afm() and instead of hardcoding your
configuration in the unfold_protein.afm module.

unfold_protein/afm.py [deleted file]

diff --git a/unfold_protein/afm.py b/unfold_protein/afm.py
deleted file mode 100644 (file)
index b2256ab..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright (C) 2011 W. Trevor King <wking@drexel.edu>
-#
-# 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 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.
-#
-# 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/>.
-
-from pyafm.afm import AFM as _AFM
-from pycomedi.channel import AnalogChannel as _AnalogChannel
-from pycomedi.channel import DigitalChannel as _DigitalChannel
-from pycomedi.device import Device as _Device
-from pycomedi.subdevice import StreamingSubdevice as _StreamingSubdevice
-from pypiezo.afm import AFMPiezo as _AFMPiezo
-from stepper import Stepper as _Stepper
-import pycomedi.constant as _pycomedi_constant
-import pypiezo.base as _pypiezo_base
-import pypiezo.config as _pypiezo_config
-
-try:
-    from .temperature import Temperature as _Temperature
-except ImportError, _temperature_import_error:
-    _Temperature = None
-
-
-def get_afm(with_temperature=True, logger=None):
-    d = _Device('/dev/comedi0')
-    d.open()
-    s_in = d.find_subdevice_by_type(
-        _pycomedi_constant.SUBDEVICE_TYPE.ai, factory=_StreamingSubdevice)
-    s_out = d.find_subdevice_by_type(
-        _pycomedi_constant.SUBDEVICE_TYPE.ao, factory=_StreamingSubdevice)
-    z_axis_channel = s_out.channel(
-        0, factory=_AnalogChannel,
-        aref=_pycomedi_constant.AREF.ground)
-    x_axis_channel = s_out.channel(
-        1, factory=_AnalogChannel,
-        aref=_pycomedi_constant.AREF.ground)
-    input_channel = s_in.channel(
-        0, factory=_AnalogChannel,
-        aref=_pycomedi_constant.AREF.diff)
-    for chan in [z_axis_channel, x_axis_channel, input_channel]:
-        chan.range = chan.find_range(
-            unit=_pycomedi_constant.UNIT.volt, min=-10, max=10)
-    z_axis_config = _pypiezo_config.AxisConfig()
-    z_axis_config.update({'gain':20, 'sensitivity':6.5e-9})
-    z_axis_channel_config = _pypiezo_config.ChannelConfig()
-    z_axis_config['channel'] = z_axis_channel_config
-    z_axis_channel_config['name'] = 'z'
-    x_axis_config = _pypiezo_config.AxisConfig()
-    x_axis_config.update({'gain':20, 'sensitivity':6.5e-9})  # TODO: GET FROM CALIBRATION
-    x_axis_channel_config = _pypiezo_config.ChannelConfig()
-    x_axis_config['channel'] = x_axis_channel_config
-    x_axis_channel_config['name'] = 'x'
-    input_channel_config = _pypiezo_config.ChannelConfig()
-    input_channel_config['name'] = 'deflection'
-    z = _pypiezo_base.PiezoAxis(
-        config=z_axis_config, axis_channel=z_axis_channel)
-    z.setup_config()
-    x = _pypiezo_base.PiezoAxis(
-        config=x_axis_config, axis_channel=x_axis_channel)
-    x.setup_config()
-    inp = _pypiezo_base.InputChannel(
-        config=input_channel_config, channel=input_channel)
-    inp.setup_config()
-    piezo = _AFMPiezo(axes=[x, z], inputs=[inp])
-
-    s_d = d.find_subdevice_by_type(
-        _pycomedi_constant.SUBDEVICE_TYPE.dio)
-    d_channels = [s_d.channel(i, factory=_DigitalChannel)
-                  for i in (0, 1, 2, 3)]
-    for chan in d_channels:
-        chan.dio_config(
-            _pycomedi_constant.IO_DIRECTION.output)
-    def write(value):
-        s_d.dio_bitfield(bits=value, write_mask=2**4-1)
-    stepper = _Stepper(write=write, delay=5e-2)
-
-    if with_temperature:
-        if _Temperature is None:
-            raise _temperature_import_error
-        temperature = _Temperature()
-    else:
-        temperature = None
-
-    afm = _AFM(piezo, stepper, temperature=temperature)
-    return (afm, d)