def setUp(self): self.mapper = LinearMapper() self.mapper.low_data = 2 self.mapper.high_data = 6 self.mapper.low_step = 0 self.mapper.high_step = 9500
def load_additional_args(self, config): """ """ args = [('Motion', 'steps', 'int'), ('Motion', 'min_steps', 'int'), ('Motion', 'sign'), ('Motion', 'velocity'), ('Motion', 'acceleration'), ('Homing', 'home_delay'), ('Homing', 'home_velocity'), ('Homing', 'home_acceleration'), ('Homing', 'home_at_startup', 'boolean'), ('General', 'min'), ('General', 'max'), ('General', 'nominal_position'), ('General', 'units')] for args in args: if len(args) == 3: section, key, cast = args else: cast = 'float' section, key = args self.set_attribute(config, key, section, key, cast=cast) if config.has_option('Motion', 'hysteresis'): ''' if hysteresis is <0 correction is done when moving in the negative direction if hysteresis is >0 correction is done when moving in the positive direction ''' self.hysteresis_value = self.config_get(config, 'Motion', 'hysteresis', cast='int') # self.use_hysteresis = True # else: # self.use_hysteresis = False if config.has_option('General', 'initialize'): self.use_initialize = self.config_get(config, 'General', 'initialize', cast='boolean') mi = self.min ma = self.max if self.sign == -1: tm = mi mi = ma ma = tm self.linear_mapper = LinearMapper(low_data=mi, high_data=ma, low_step=int(self.min_steps), high_step=int(self.steps))
def linear_mapper_factory(self): mi = self.min ma = self.max if self.sign == -1: mi, ma = ma, mi self.linear_mapper = LinearMapper(low_data=mi, high_data=ma, low_step=int(self.min_steps), high_step=int(self.steps))