Initialisation of real/calculation motors
There is an error when calc_to_real is called by a real_motor (like in sync_hard) but the initialisation of the calculation motor is not done yet. This is a problem when a calculation motors sets default values in initialize_axis and those values are used in calc_to_real/calc_from_real. Note that calculation_motor.position() call its initialize_axis, but real_motor.position() does not call the calc_motor initialize_axis. Example is the energy_wl calculation motor, which depends on mono(IcePAP) real motor:
def initialize_axis(self, axis):
...
axis.unit = axis.config.get('unit', str, default="keV")
def calc_to_real(self, positions_dict):
...
if axix.unit == ´eV´:
...
mono.position()
8.81151
mono.sync_hard()
AttributeError: 'Axis' object has no attribute 'unit'
energy.position()
12.9
mono.sync_hard() - all OK