Otherwise log the configuration and raise a ValueError.
It's unlikely that a user misconfigures their ranges, but it is
possible. It is also possible that a bug in pycomedi---like the one
fixed by
27562b0 (channel: Fix to-physical setup in
AnalogChannel._get_converter, 2013-01-17)---leads to a broken
inverse-conversion-coefficients configuration. That bug is now fixed,
but if it happened once, it might happen again ;).
max_position = _base.convert_volts_to_bits(
output_axis.config['channel'],
output_axis.config['maximum'])
max_position = _base.convert_volts_to_bits(
output_axis.config['channel'],
output_axis.config['maximum'])
+ if min_position >= max_position:
+ for k,v in output_axis.config['channel'].items():
+ _LOG.error((k,v))
+ raise ValueError(
+ ('invalid range {} - {} for {} axis {} (configured with {} - {})'
+ ).format(
+ min_position, max_position, piezo.config.get('name', piezo),
+ axis_name, output_axis.config['minimum'],
+ output_axis.config['maximum']))
return (min_position, max_position)
def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000,
return (min_position, max_position)
def get_surface_position_data(piezo, axis_name, max_deflection, steps=2000,