Commits

Pam Harris authored e62c959ec06 Merge
Merge branch 'master' into CAS-14276

casa5/gcwrap/python/scripts/flaghelper.py

Modified
2091 2091 Cast it to the corresponding Python type
2092 2092 and return the casted value'''
2093 2093
2094 2094 import numpy as np
2095 2095
2096 2096 val = None
2097 2097
2098 2098 if(isinstance(elem,np.int) or isinstance(elem,np.int8) or
2099 2099 isinstance(elem,np.int16) or isinstance(elem,np.int32) or
2100 2100 isinstance(elem,np.int64)):
2101 - val = int(elem)
2101 + val = int(elem)
2102 2102
2103 2103 elif(isinstance(elem,np.float) or isinstance(elem,np.float16) or
2104 - isinstance(elem,np.float32) or isinstance(elem,np.float64) or
2105 - isinstance(elem,np.float128)):
2106 - val = float(elem)
2107 -
2104 + isinstance(elem,np.float32) or isinstance(elem,np.float64)):
2105 + val = float(elem)
2106 +
2107 + # float128 is not available on all platforms
2108 + elif (hasattr(np, "float128")) and isinstance(elem,np.float128):
2109 + val = float(elem)
2110 +
2108 2111 elif(isinstance(elem,np.double)):
2109 2112 val = float(elem)
2110 2113
2111 2114 else:
2112 2115 # it is none of the above numpy types
2113 2116 val = elem
2114 2117
2115 2118 # return the casted element
2116 2119 return val
2117 2120

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut