Salome HOME
Get classification
[modules/adao.git] / src / daComposant / daCore / Persistence.py
index ec1f2806fdd7752f65c79c7ea9c3dbf3aae12e8e..ecaa30405a19dfea13b726bcce618b72b75c94c0 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2008-2019 EDF R&D
+# Copyright (C) 2008-2020 EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,8 @@ import os, sys, numpy, copy
 import gzip, bz2
 
 from daCore.PlatformInfo import PathManagement ; PathManagement()
-from daCore.PlatformInfo import has_gnuplot
+from daCore.PlatformInfo import has_gnuplot, PlatformInfo
+mfp = PlatformInfo().MaximumPrecision()
 if has_gnuplot:
     import Gnuplot
 
@@ -146,6 +147,9 @@ class Persistence(object):
         "x.__len__() <==> len(x)"
         return len(self.__values)
 
+    def name(self):
+        return self.__name
+
     def __getitem__(self, index=None ):
         "x.__getitem__(y) <==> x[y]"
         return copy.copy(self.__values[index])
@@ -276,7 +280,7 @@ class Persistence(object):
         élémentaires numpy.
         """
         try:
-            return [numpy.array(item).mean() for item in self.__values]
+            return [numpy.mean(item, dtype=mfp) for item in self.__values]
         except:
             raise TypeError("Base type is incompatible with numpy")
 
@@ -469,9 +473,9 @@ class Persistence(object):
         """
         try:
             if self.__basetype in [int, float]:
-                return float( numpy.array(self.__values).mean() )
+                return float( numpy.mean(self.__values, dtype=mfp) )
             else:
-                return numpy.array(self.__values).mean(axis=0)
+                return numpy.mean(self.__values, axis=0, dtype=mfp)
         except:
             raise TypeError("Base type is incompatible with numpy")