-#-*-coding:iso-8859-1-*-
+# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008-2013 EDF R&D
+# Copyright (C) 2008-2017 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
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
import math, numpy
from daCore import BasicObjects, Persistence
def _formula(self, V1, V2):
"""
- Fait un écart RMS entre deux vecteurs V1 et V2
+ Fait un écart RMS entre deux vecteurs V1 et V2
"""
rms = math.sqrt( ((V2 - V1)**2).sum() / float(V1.size) )
#
def calculate(self, vector1 = None, vector2 = None, step = None):
"""
- Teste les arguments, active la formule de calcul et stocke le résultat
+ Teste les arguments, active la formule de calcul et stocke le résultat
"""
if vector1 is None or vector2 is None:
raise ValueError("Two vectors must be given to calculate their RMS")
# ==============================================================================
if __name__ == "__main__":
- print '\n AUTODIAGNOSTIC \n'
+ print('\n AUTODIAGNOSTIC \n')
D = ElementaryDiagnostic("Ma RMS")
vect1 = [-0.23262176, 1.36065207, 0.32988102, 0.24400551, -0.66765848, -0.19088483, -0.31082575, 0.56849814, 1.21453443, 0.99657516]
vect2 = [0,0,0,0,0,0,0,0,0,0]
D.calculate(vect1,vect2)
- print " Les valeurs de RMS attendues sont les suivantes : [1.0, 1.0, 1.0, 3.0, 0.53162016515553656, 0.73784217096601323]"
- print " Les RMS obtenues................................:", D.valueserie()
- print " La moyenne......................................:", D.mean()
- print
+ print(" Les valeurs de RMS attendues sont les suivantes : [1.0, 1.0, 1.0, 3.0, 0.53162016515553656, 0.73784217096601323]")
+ print(" Les RMS obtenues................................: %s"%(D[:],))
+ print(" La moyenne......................................: %s"%(D.mean(),))
+ print("")