From 269c1d819f3b7dd7c8c5fb9e2da837bbdc8f8646 Mon Sep 17 00:00:00 2001 From: Daniel Brown <ddb@star.sr.bham.ac.uk> Date: Mon, 1 Feb 2016 12:23:24 +0000 Subject: [PATCH] fixing mod again --- pykat/__init__.py | 2 +- pykat/components.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pykat/__init__.py b/pykat/__init__.py index 49cfe37..8bcc249 100644 --- a/pykat/__init__.py +++ b/pykat/__init__.py @@ -3,7 +3,7 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -__version__ = "0.8.4" +__version__ = "0.8.5" # This flag is used to switch on the gui features in pkat at import time USE_GUI = False diff --git a/pykat/components.py b/pykat/components.py index 90254f9..f629162 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -1088,13 +1088,21 @@ class modulator(Component): def phase(self, value): self.__phase.value = SIfloat(value) @property - def order(self): return int(self.__order) + def order(self): return self.__order @order.setter def order(self, value): - if value != 's' or (isinstance(value, int) and value <= 1 and value > 6): - raise pkex.BasePyKatException("modulator order must be between 1 and 6 or 's' for single sideband") + + try: + value = int(value) + print(value) + if value <= 1 and value > 6: + raise pkex.BasePyKatException("modulator order must be between 1 and 6 or 's' for single sideband") + + except ValueError: + if value != 's' or (isinstance(value, int) and value <= 1 and value > 6): + raise pkex.BasePyKatException("modulator order must be between 1 and 6 or 's' for single sideband") - self.__midx.value = value + self.__order = value @property -- GitLab