diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-02-20 15:02:42 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-02-20 15:02:42 +0000 |
commit | 10c52f5eda45b412ca8859a04950df62745acbe8 (patch) | |
tree | 3f1eb5c0c876377a37ce00dbe7fd55cd0ce6f0e9 /Wrappers | |
parent | 8e80fd44796073ebf716110c220a03b63028968e (diff) | |
download | framework-10c52f5eda45b412ca8859a04950df62745acbe8.tar.gz framework-10c52f5eda45b412ca8859a04950df62745acbe8.tar.bz2 framework-10c52f5eda45b412ca8859a04950df62745acbe8.tar.xz framework-10c52f5eda45b412ca8859a04950df62745acbe8.zip |
check numerical types from numpy
Diffstat (limited to 'Wrappers')
-rw-r--r-- | Wrappers/Python/ccpi/framework.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Wrappers/Python/ccpi/framework.py b/Wrappers/Python/ccpi/framework.py index 6af7a97..d1ad26b 100644 --- a/Wrappers/Python/ccpi/framework.py +++ b/Wrappers/Python/ccpi/framework.py @@ -472,7 +472,10 @@ class DataContainer(object): else: raise ValueError('*:Wrong shape: {0} and {1}'.format(self.shape, other.shape)) - elif isinstance(other, (int, float, complex)): + elif isinstance(other, (int, float, complex,\ + numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.int64,\ + numpy.float, numpy.float16, numpy.float32, numpy.float64, \ + numpy.complex)): return type(self)(self.as_array() * other, deep_copy=True, dimension_labels=self.dimension_labels, @@ -633,6 +636,10 @@ class DataContainer(object): if out is None: if isinstance(x2, (int, float, complex)): out = pwop(self.as_array() , x2 , *args, **kwargs ) + elif isinstance(x2, (numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.int64,\ + numpy.float, numpy.float16, numpy.float32, numpy.float64, \ + numpy.complex)): + out = pwop(self.as_array() , x2 , *args, **kwargs ) elif issubclass(type(x2) , DataContainer): out = pwop(self.as_array() , x2.as_array() , *args, **kwargs ) return type(self)(out, |