From 60c49a8331430fdc3875c2b95cbfa44660d94922 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 28 May 2019 09:28:08 +0100 Subject: [PATCH] Fixed setting Iterable vs Int backlash --- openflexure_microscope/stage/sanga.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/stage/sanga.py b/openflexure_microscope/stage/sanga.py index 59d70d76..fbccb9f4 100644 --- a/openflexure_microscope/stage/sanga.py +++ b/openflexure_microscope/stage/sanga.py @@ -1,5 +1,7 @@ import numpy as np import time +import logging +from collections.abc import Iterable from .sangaboard import Sangaboard from openflexure_microscope.stage.base import BaseStage @@ -69,10 +71,14 @@ class SangaStage(BaseStage): @backlash.setter def backlash(self, blsh): + logging.debug("Setting backlash to {}".format(blsh)) if blsh is None: self._backlash = None - assert len(blsh) == self.n_axes - self._backlash = np.array([int(blsh)]*self.n_axes, dtype=np.int) + elif isinstance(blsh, Iterable): + assert len(blsh) == self.n_axes + self._backlash = np.array(blsh) + else: + self._backlash = np.array([int(blsh)]*self.n_axes, dtype=np.int) def move_rel(self, displacement, axis=None, backlash=True): """Make a relative move, optionally correcting for backlash.