3 # Copyright (C) 2019 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Anthony Geay, anthony.geay@edf.fr, EDF R&D
23 # ***** <class 'numpy.matrixlib.defmatrix.matrix'>
24 # ***** <class 'numpy.ndarray'>
25 # ***** <class 'numpy.ndarray'>
26 # ***** <class 'numpy.ndarray'>
28 def BuildCase(cppFunc):
29 def evaluator( xserie ):
31 yserie = [np.array(elt) for elt in cppFunc(xserie)]
34 from adao import adaoBuilder
37 observations = [2, 6, 12, 20]
38 alphamin, alphamax = 0., 10.
39 betamin, betamax = 3, 13
40 gammamin, gammamax = 1.5, 15.5
48 case = adaoBuilder.New()
49 case.set( 'AlgorithmParameters',
50 Algorithm = '3DVAR', # Mots-clé réservé
51 Parameters = { # Dictionnaire
52 "Bounds":Bounds, # Liste de paires de Real ou de None
53 "MaximumNumberOfSteps":100, # Int >= 0
54 "CostDecrementTolerance":1.e-7, # Real > 0
55 "StoreSupplementaryCalculations":[# Liste de mots-clés réservés
56 "CostFunctionJAtCurrentOptimum",
57 "CostFunctionJoAtCurrentOptimum",
59 "SimulatedObservationAtCurrentOptimum",
60 "SimulatedObservationAtOptimum",
64 case.set( 'Background',
65 Vector = Xb, # array, list, tuple, matrix
68 case.set( 'Observation',
69 Vector = observations, # array, list, tuple, matrix
70 Stored = False, # Bool
72 case.set( 'BackgroundError',
73 Matrix = None, # None ou matrice carrée
74 ScalarSparseMatrix = 1.0e10, # None ou Real > 0
75 DiagonalSparseMatrix = None, # None ou vecteur
77 case.set( 'ObservationError',
78 Matrix = None, # None ou matrice carrée
79 ScalarSparseMatrix = 1.0, # None ou Real > 0
80 DiagonalSparseMatrix = None, # None ou vecteur
82 case.set( 'ObservationOperator',
83 OneFunction = evaluator, # MultiFonction [Y] = F([X]) multisimulation
84 Parameters = { # Dictionnaire
85 "DifferentialIncrement":0.0001, # Real > 0
86 "CenteredFiniteDifference":False, # Bool
88 InputFunctionAsMulti = True, # Bool
91 Variable = "CurrentState", # Mot-clé
92 Template = "ValuePrinter", # Mot-clé
93 String = None, # None ou code Python
94 Info = None, # None ou string