From: W. Trevor King Date: Thu, 8 Sep 2011 18:17:17 +0000 (-0400) Subject: Use select_config in AFMPiezo's doctests. X-Git-Tag: 0.6~35 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=54deade22e1ff9c2b4958c5fcc16f8a913ea73cb;p=pypiezo.git Use select_config in AFMPiezo's doctests. --- diff --git a/pypiezo/afm.py b/pypiezo/afm.py index fc74e1f..049d4a8 100644 --- a/pypiezo/afm.py +++ b/pypiezo/afm.py @@ -96,7 +96,8 @@ class AFMPiezo (_base.Piezo): We need to know where we are before we can move somewhere smoothly. - >>> pos = _base.convert_volts_to_bits(p.config['axes'][0]['channel'], 0) + >>> pos = _base.convert_volts_to_bits(p.config.select_config( + ... 'axes', 'z')['channel'], 0) >>> p.jump('z', pos) Usually `.move_to_pos_or_def` is used to approach the surface, but @@ -104,9 +105,10 @@ class AFMPiezo (_base.Piezo): into the deflection input channel. >>> target_pos = _base.convert_volts_to_bits( - ... p.config['axes'][0]['channel'], 2) + ... p.config.select_config('axes', 'channel'), 2) >>> step = int((target_pos - pos)/5) - >>> target_def = _base.convert_volts_to_bits(p.config['inputs'][0], 3) + >>> target_def = _base.convert_volts_to_bits( + ... p.config.select_config('inputs', 'deflection'), 3) >>> data = p.move_to_pos_or_def('z', target_pos, target_def, step=step, ... return_data=True) >>> p.last_output == {'z': int(target_pos)} @@ -122,7 +124,7 @@ class AFMPiezo (_base.Piezo): >>> p.jump('z', pos) >>> target_def = _base.convert_volts_to_bits( - ... p.config['inputs'][0], 1) + ... p.config.select_config('inputs', 'deflection'), 1) >>> data = p.move_to_pos_or_def('z', target_pos, target_def, step=step, ... return_data=True) >>> print (p.last_output['z'] < int(target_pos))