smoothly.
>>> pos = _base.convert_volts_to_bits(p.config.select_config(
- ... 'axes', 'z')['channel'], 0)
+ ... 'axes', 'z', get_attribute=_base.get_axis_name)['channel'], 0)
>>> p.jump('z', pos)
Usually `.move_to_pos_or_def` is used to approach the surface, but
into the deflection input channel.
>>> target_pos = _base.convert_volts_to_bits(
- ... p.config.select_config('axes', 'channel'), 2)
+ ... p.config.select_config('axes', 'channel',
+ get_attribute=_base.get_axis_name), 2)
>>> step = int((target_pos - pos)/5)
>>> target_def = _base.convert_volts_to_bits(
... p.config.select_config('inputs', 'deflection'), 3)
data = convert_meters_to_volts(axis_config, data)
return convert_volts_to_bits(axis_config['channel'], data)
+def get_axis_name(axis_config):
+ """Return the name of an axis from the `AxisConfig`
+
+ This is useful, for example, with
+ `Config.select_config(get_attribute=get_axis_name)`.
+ """
+ channel_config = axis_config['channel']
+ return channel_config['name']
+
def _setup_channel_config(config, channel):
"""Initialize the `ChannelConfig` `config` using the
`AnalogChannel` `channel`.
pypiezo.
"""
+from .base import get_axis_name as _get_axis_name
from .config import AxisConfig as _AxisConfig
from .config import InputChannelConfig as _InputChannelConfig
from .config import OutputChannelConfig as _OutputChannelConfig
conversion-origin: 0
inverse-conversion-coefficients: 0, 1
inverse-conversion-origin: 0
- >>> d = p.select_config('inputs', 'deflection')
- >>> d['name']
+ >>> get_axis_name
+ >>> d = p.select_config('inputs', 'deflection',
+ ... get_attribute=_get_axis_name)
+ >>> d['channel']['name']
'deflection'
"""
piezo_config = _PiezoConfig(storage=storage)