]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Compatibility updates and documentation corrections
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Wed, 3 Oct 2018 19:10:30 +0000 (21:10 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Wed, 3 Oct 2018 19:10:30 +0000 (21:10 +0200)
doc/en/snippets/Minimizer_DE.rst
doc/fr/snippets/Minimizer_DE.rst
resources/ADAOSchemaCatalog.xml
src/daComposant/daAlgorithms/DifferentialEvolution.py
src/daComposant/daCore/Aidsm.py
src/daComposant/daCore/BasicObjects.py
src/daComposant/daCore/Interfaces.py

index 69a46d7cdaacadc3427fd5e19ca174ead14dcc9d..1947080f5b6451f02319358becfdb393ad8e95c4 100644 (file)
@@ -8,11 +8,9 @@ Minimizer
   "BEST1EXP",
   "RAND1EXP",
   "RANDTOBEST1EXP",
-  "CURRENTTOBEST1EXP",
   "BEST2EXP",
   "RAND2EXP",
   "RANDTOBEST1BIN",
-  "CURRENTTOBEST1BIN",
   "BEST2BIN",
   "RAND2BIN",
   "RAND1BIN".
index 616ca5d272faf5e3add5723b1529f77cc3b022a0..4c96c14c70416b82affbfe3831ffa26808e1df86 100644 (file)
@@ -9,11 +9,9 @@ Minimizer
   "BEST1EXP",
   "RAND1EXP",
   "RANDTOBEST1EXP",
-  "CURRENTTOBEST1EXP",
   "BEST2EXP",
   "RAND2EXP",
   "RANDTOBEST1BIN",
-  "CURRENTTOBEST1BIN",
   "BEST2BIN",
   "RAND2BIN",
   "RAND1BIN".
index b1a32ab91b424646433f941a3442750405fca280..4569aa13b076792b467f361f8b5af04e04649523 100644 (file)
@@ -67,6 +67,7 @@ print("Algorithm is set to...:", Algorithm)
 
 try:
     # Create Assimilation study
+    import adao
     from daYacsIntegration.daStudy import *
     assim_study = daStudy(Name, Algorithm, Debug)
 
index 381d4134e021e72d31287a333b937e7c15b41131..74cd606b501e8c586cd78cab7e617b13104693c7 100644 (file)
@@ -38,11 +38,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 "BEST1EXP",
                 "RAND1EXP",
                 "RANDTOBEST1EXP",
-                "CURRENTTOBEST1EXP",
+                "CURRENTTOBEST1EXP",
                 "BEST2EXP",
                 "RAND2EXP",
                 "RANDTOBEST1BIN",
-                "CURRENTTOBEST1BIN",
+                "CURRENTTOBEST1BIN",
                 "BEST2BIN",
                 "RAND2BIN",
                 "RAND1BIN",
index dcd14f57b210cb6ad32f439fe9910a52e9f332ab..953ef8de5ce8be5dfc74025108066913dc9d4af0 100644 (file)
@@ -90,6 +90,9 @@ class Aidsm(object):
             AppliedInXb          = None,
             AvoidRC              = True,
             Checked              = False,
+            ColMajor             = False,
+            ColNames             = None,
+            DataFile             = None,
             DiagonalSparseMatrix = None,
             Info                 = None,
             Matrix               = None,
@@ -113,7 +116,7 @@ class Aidsm(object):
         try:
             if   Concept in ("Background", "CheckingPoint", "ControlInput", "Observation"):
                 commande = getattr(self,"set"+Concept)
-                commande(Vector, VectorSerie, Script, Stored, Scheduler, Checked )
+                commande(Vector, VectorSerie, Script, DataFile, ColNames, ColMajor, Stored, Scheduler, Checked )
             elif Concept in ("BackgroundError", "ObservationError", "EvolutionError"):
                 commande = getattr(self,"set"+Concept)
                 commande(Matrix, ScalarSparseMatrix, DiagonalSparseMatrix,
@@ -158,6 +161,9 @@ class Aidsm(object):
             Vector         = None,
             VectorSerie    = None,
             Script         = None,
+            DataFile       = None,
+            ColNames       = None,
+            ColMajor       = False,
             Stored         = False,
             Scheduler      = None,
             Checked        = False):
@@ -169,6 +175,9 @@ class Aidsm(object):
             asVector           = Vector,
             asPersistentVector = VectorSerie,
             asScript           = self.__with_directory(Script),
+            asDataFile         = DataFile,
+            colNames           = ColNames,
+            colMajor           = ColMajor,
             scheduledBy        = Scheduler,
             toBeChecked        = Checked,
             )
@@ -180,6 +189,9 @@ class Aidsm(object):
             Vector         = None,
             VectorSerie    = None,
             Script         = None,
+            DataFile       = None,
+            ColNames       = None,
+            ColMajor       = False,
             Stored         = False,
             Scheduler      = None,
             Checked        = False):
@@ -191,6 +203,9 @@ class Aidsm(object):
             asVector           = Vector,
             asPersistentVector = VectorSerie,
             asScript           = self.__with_directory(Script),
+            asDataFile         = DataFile,
+            colNames           = ColNames,
+            colMajor           = ColMajor,
             scheduledBy        = Scheduler,
             toBeChecked        = Checked,
             )
@@ -202,6 +217,9 @@ class Aidsm(object):
             Vector         = None,
             VectorSerie    = None,
             Script         = None,
+            DataFile       = None,
+            ColNames       = None,
+            ColMajor       = False,
             Stored         = False,
             Scheduler      = None,
             Checked        = False):
@@ -213,6 +231,9 @@ class Aidsm(object):
             asVector           = Vector,
             asPersistentVector = VectorSerie,
             asScript           = self.__with_directory(Script),
+            asDataFile         = DataFile,
+            colNames           = ColNames,
+            colMajor           = ColMajor,
             scheduledBy        = Scheduler,
             toBeChecked        = Checked,
             )
@@ -224,6 +245,9 @@ class Aidsm(object):
             Vector         = None,
             VectorSerie    = None,
             Script         = None,
+            DataFile       = None,
+            ColNames       = None,
+            ColMajor       = False,
             Stored         = False,
             Scheduler      = None,
             Checked        = False):
@@ -235,6 +259,9 @@ class Aidsm(object):
             asVector           = Vector,
             asPersistentVector = VectorSerie,
             asScript           = self.__with_directory(Script),
+            asDataFile         = DataFile,
+            colNames           = ColNames,
+            colMajor           = ColMajor,
             scheduledBy        = Scheduler,
             toBeChecked        = Checked,
             )
index 7de386ea829ad0637e9b3deb9f1025c8033e0209..f45eda809e86869ceca96cc404390c02063e43da 100644 (file)
@@ -35,7 +35,7 @@ from daCore import Persistence
 from daCore import PlatformInfo
 from daCore import Interfaces
 from daCore import Templates
-from daCore.Interfaces import ImportFromScript
+from daCore.Interfaces import ImportFromScript, ImportFromFile
 
 # ==============================================================================
 class CacheManager(object):
@@ -1216,6 +1216,9 @@ class State(object):
                  asVector           = None,
                  asPersistentVector = None,
                  asScript           = None,
+                 asDataFile         = None,
+                 colNames           = None,
+                 colMajor           = False,
                  scheduledBy        = None,
                  toBeChecked        = False,
                 ):
@@ -1230,6 +1233,14 @@ class State(object):
           nommée "name", la variable est de type "asVector" (par défaut) ou
           "asPersistentVector" selon que l'une de ces variables est placée à
           "True".
+        - asDataFile : si un ou plusieurs fichiers valides sont donnés
+          contenant des valeurs en colonnes, elles-mêmes nommées "colNames"
+          (s'il n'y a pas de nom de colonne indiquée, on cherche une colonne
+          nommée "name"), on récupère les colonnes et on les range ligne après
+          ligne (colMajor=False) ou colonne après colonne (colMajor=True). La
+          variable résultante est de type "asVector" (par défaut) ou
+          "asPersistentVector" selon que l'une de ces variables est placée à
+          "True".
         """
         self.__name       = str(name)
         self.__check      = bool(toBeChecked)
@@ -1245,6 +1256,26 @@ class State(object):
                 __Series = ImportFromScript(asScript).getvalue( self.__name )
             else:
                 __Vector = ImportFromScript(asScript).getvalue( self.__name )
+        elif asDataFile is not None:
+            __Vector, __Series = None, None
+            if asPersistentVector:
+                if colNames is not None:
+                    __Series = ImportFromFile(asDataFile).getvalue( colNames )[1]
+                else:
+                    __Series = ImportFromFile(asDataFile).getvalue( [self.__name,] )[1]
+                if bool(colMajor) and not ImportFromFile(asDataFile).getformat() == "application/numpy.npz":
+                    __Series = numpy.transpose(__Series)
+                elif not bool(colMajor) and ImportFromFile(asDataFile).getformat() == "application/numpy.npz":
+                    __Series = numpy.transpose(__Series)
+            else:
+                if colNames is not None:
+                    __Vector = ImportFromFile(asDataFile).getvalue( colNames )[1]
+                else:
+                    __Vector = ImportFromFile(asDataFile).getvalue( [self.__name,] )[1]
+                if bool(colMajor):
+                    __Vector = numpy.ravel(__Vector, order = "F")
+                else:
+                    __Vector = numpy.ravel(__Vector, order = "C")
         else:
             __Vector, __Series = asVector, asPersistentVector
         #
index 7737fa05ad006d889f1c3e2e1e2a45346e8c0773..01a3001c4ebae377ea77f4e7ea2f5dfe91a8fcb0 100644 (file)
@@ -118,9 +118,10 @@ class _TUIViewer(GenericCaseViewer):
             for k in __keys:
                 __v = __local[k]
                 if __v is None: continue
-                if   k == "Checked" and not __v: continue
-                if   k == "Stored"  and not __v: continue
-                if   k == "AvoidRC" and __v: continue
+                if   k == "Checked"  and not __v: continue
+                if   k == "Stored"   and not __v: continue
+                if   k == "ColMajor" and not __v: continue
+                if   k == "AvoidRC"  and __v: continue
                 if   k == "noDetails": continue
                 if isinstance(__v,Persistence.Persistence): __v = __v.values()
                 if callable(__v): __text = self._missing%__v.__name__+__text
@@ -391,7 +392,7 @@ class _SCDViewer(GenericCaseViewer):
                     __text += "%s_config['From'] = '%s'\n"%(__command,__f)
                     __text += "%s_config['Data'] = %s\n"%(__command,__v)
                     __text = __text.replace("''","'")
-                elif __k in ('Stored', 'Checked'):
+                elif __k in ('Stored', 'Checked', 'ColMajor'):
                     if bool(__v):
                         __text += "%s_config['%s'] = '%s'\n"%(__command,__k,int(bool(__v)))
                 elif __k in ('AvoidRC', 'noDetails'):
@@ -666,12 +667,14 @@ class ImportFromFile(object):
         self.__header, self._varsline, self._skiprows = self.__getentete()
         #
         if self._format == "text/csv" or Format.upper() == "CSV":
+            self._format = "text/csv"
             self.__filestring = "".join(self.__header)
             if self.__filestring.count(",") > 1:
                 self._delimiter = ","
             elif self.__filestring.count(";") > 1:
                 self._delimiter = ";"
         elif self._format == "text/tab-separated-values" or Format.upper() == "TSV":
+            self._format = "text/tab-separated-values"
             self._delimiter = "\t"
         else:
             self._delimiter = None
@@ -776,6 +779,7 @@ class ImportFromFile(object):
                 __index = numpy.loadtxt(self._filename, dtype = bytes, usecols = (__useindex,), delimiter = self._delimiter, skiprows=self._skiprows)
         else:
             raise ValueError("Unkown file format \"%s\""%self._format)
+        if __columns is None: __columns = ()
         #
         def toString(value):
             try:
@@ -792,6 +796,9 @@ class ImportFromFile(object):
         with open(self._filename,'r') as fid:
             return fid.read()
 
+    def getformat(self):
+        return self._format
+
 # ==============================================================================
 class ImportScalarLinesFromFile(ImportFromFile):
     """