GenericCaseViewer.__init__(self, __name, __objname, __content, __object)
self._addLine("# -*- coding: utf-8 -*-")
self._addLine("#\n# Python script using ADAO TUI\n#")
+ self._addLine("import numpy as np")
self._addLine("from numpy import array, matrix")
self._addLine("from adao import adaoBuilder")
self._addLine("%s = adaoBuilder.New('%s')"%(self._objname, self._name))
self._observerIndex = 0
self._addLine("# -*- coding: utf-8 -*-")
self._addLine("#\n# Python script using ADAO COMM\n#")
+ self._addLine("import numpy as np")
self._addLine("from numpy import array, matrix")
self._addLine("#")
self._addLine("%s = {}"%__objname)
__usecols = (0, 1, 2, 3)
def __replaceNoneN( s ):
- if s.strip() == b'None':
- return numpy.NINF
+ if s.strip() in (b'None', 'None'):
+ return -numpy.inf
else:
return s
def __replaceNoneP( s ):
- if s.strip() == b'None':
- return numpy.PINF
+ if s.strip() in (b'None', 'None'):
+ return numpy.inf
else:
return s
__converters = {2: __replaceNoneN, 3: __replaceNoneP}
__usecols = tuple(range(len(HeaderNames)))
def __replaceNone( s ):
- if s.strip() == b'None':
- return numpy.NAN
+ if s.strip() in (b'None', 'None'):
+ return numpy.nan
else:
return s
__converters = dict()
élémentaires numpy.
"""
try:
- return [numpy.mean(item, dtype=mfp).astype('float') for item in self.__values]
+ __sr = [numpy.mean(item, dtype=mfp).astype('float') for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def stds(self, ddof=0):
"""
"""
try:
if numpy.version.version >= '1.1.0':
- return [numpy.array(item).std(ddof=ddof, dtype=mfp).astype('float') for item in self.__values]
+ __sr = [numpy.array(item).std(ddof=ddof, dtype=mfp).astype('float') for item in self.__values]
else:
return [numpy.array(item).std(dtype=mfp).astype('float') for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def sums(self):
"""
numpy.
"""
try:
- return [numpy.array(item).sum() for item in self.__values]
+ __sr = [numpy.array(item).sum() for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def mins(self):
"""
numpy.
"""
try:
- return [numpy.array(item).min() for item in self.__values]
+ __sr = [numpy.array(item).min() for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def maxs(self):
"""
numpy.
"""
try:
- return [numpy.array(item).max() for item in self.__values]
+ __sr = [numpy.array(item).max() for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def powers(self, x2):
"""
numpy.
"""
try:
- return [numpy.power(item, x2) for item in self.__values]
+ __sr = [numpy.power(item, x2) for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def norms(self, _ord=None):
"""
numpy.
"""
try:
- return [numpy.linalg.norm(item, _ord) for item in self.__values]
+ __sr = [numpy.linalg.norm(item, _ord) for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def traces(self, offset=0):
"""
types élémentaires numpy.
"""
try:
- return [numpy.trace(item, offset, dtype=mfp) for item in self.__values]
+ __sr = [numpy.trace(item, offset, dtype=mfp).astype('float') for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def maes(self, _predictor=None):
"""
"""
if _predictor is None:
try:
- return [numpy.mean(numpy.abs(item)) for item in self.__values]
+ __sr = [numpy.mean(numpy.abs(item)) for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
else:
if numpy.asarray(_predictor[i]).size != numpy.asarray(item).size:
raise ValueError("Predictor size at step %i is incompatible with the values"%i)
try:
- return [numpy.mean(numpy.abs(numpy.ravel(item) - numpy.ravel(_predictor[i]))) for i, item in enumerate(self.__values)]
+ __sr = [numpy.mean(numpy.abs(numpy.ravel(item) - numpy.ravel(_predictor[i]))) for i, item in enumerate(self.__values)]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
def mses(self, _predictor=None):
"""
if _predictor is None:
try:
__n = self.shape()[0]
- return [(numpy.linalg.norm(item)**2 / __n) for item in self.__values]
+ __sr = [(numpy.linalg.norm(item)**2 / __n) for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
else:
raise ValueError("Predictor size at step %i is incompatible with the values"%i)
try:
__n = self.shape()[0]
- return [(numpy.linalg.norm(numpy.ravel(item) - numpy.ravel(_predictor[i]))**2 / __n) for i, item in enumerate(self.__values)]
+ __sr = [(numpy.linalg.norm(numpy.ravel(item) - numpy.ravel(_predictor[i]))**2 / __n) for i, item in enumerate(self.__values)]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
msds = mses # Mean-Square Deviation (MSD=MSE)
if _predictor is None:
try:
__n = self.shape()[0]
- return [(numpy.linalg.norm(item) / math.sqrt(__n)) for item in self.__values]
+ __sr = [(numpy.linalg.norm(item) / math.sqrt(__n)) for item in self.__values]
except Exception:
raise TypeError("Base type is incompatible with numpy")
else:
raise ValueError("Predictor size at step %i is incompatible with the values"%i)
try:
__n = self.shape()[0]
- return [(numpy.linalg.norm(numpy.ravel(item) - numpy.ravel(_predictor[i])) / math.sqrt(__n)) for i, item in enumerate(self.__values)]
+ __sr = [(numpy.linalg.norm(numpy.ravel(item) - numpy.ravel(_predictor[i])) / math.sqrt(__n)) for i, item in enumerate(self.__values)]
except Exception:
raise TypeError("Base type is incompatible with numpy")
+ return( numpy.array(__sr).tolist() )
rmsds = rmses # Root-Mean-Square Deviation (RMSD=RMSE)