AlexShkarin / pyLabLib

Python package for device control and experiment automation
http://pylablib.readthedocs.io
GNU General Public License v3.0
130 stars 30 forks source link

Incorrect position scaling for Thorlabs Elliptec linear stages #90

Open malc0 opened 1 month ago

malc0 commented 1 month ago

The scaling factor calculated at line 97 for elliptec.py ( https://github.com/AlexShkarin/pyLabLib/blob/000e5ddd59e22f7f9fe6a9ce318c0721a176b601/pylablib/devices/Thorlabs/elliptec.py#L97 ) doesn't work for an ELL20 stage, and I suspect not for any Elliptec linear stage. The documentation indicates for linear stages that the device's 'pulses' information field gives pulses /per millimetre/, independent of the available travel length, for linear stages.

Unfortunately I can't see an explicit way of telling linear and rotation stages apart from the device info response; you could have a model number look-up table (like https://gitlab.com/ptapping/thorlabs-elliptec/-/blob/main/thorlabs_elliptec/__init__.py?ref_type=heads#L127 ), but since the 'pulses' value is very different for all current linear and rotation stages (see page 8 of https://www.thorlabs.com/Software/Elliptec/Communications_Protocol/ELLx%20modules%20protocol%20manual_Issue7.pdf ), I'm currently using a crude heuristic: self._stage_scale[a]=dev_info.pulse/dev_info.travel if dev_info.pulse > 100000 else dev_info.pulse if dev_info.pulse>0 else 1