From 9cc27a16d50b50096747a299ccdbb81dce89fd01 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Thu, 5 Apr 2012 10:48:06 +0200 Subject: [PATCH] Adding evolution modelisation in GUI --- bin/AdaoCatalogGenerator.py | 4 ++ src/daSalome/daYacsIntegration/daStudy.py | 60 +++++++++++++++---- .../daYacsSchemaCreator/infos_daComposant.py | 8 ++- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/bin/AdaoCatalogGenerator.py b/bin/AdaoCatalogGenerator.py index be2782a..c3f895f 100644 --- a/bin/AdaoCatalogGenerator.py +++ b/bin/AdaoCatalogGenerator.py @@ -68,6 +68,8 @@ def F_InitChoice() : return ("Background", "Observation", "ObservationError", "ObservationOperator", + "EvolutionModel", + "EvolutionError", "AlgorithmParameters", "UserPostAnalysis", ) @@ -134,6 +136,8 @@ ASSIMILATION_STUDY = PROC(nom="ASSIMILATION_STUDY", Observation = F_Observation("o"), ObservationError = F_ObservationError("o"), ObservationOperator = F_ObservationOperator("o"), + EvolutionModel = F_EvolutionModel("f"), + EvolutionError = F_EvolutionError("f"), AlgorithmParameters = F_AlgorithmParameters("f"), UserDataInit = F_Init("f"), UserPostAnalysis = F_UserPostAnalysis("f"), diff --git a/src/daSalome/daYacsIntegration/daStudy.py b/src/daSalome/daYacsIntegration/daStudy.py index 6dce516..cd708be 100644 --- a/src/daSalome/daYacsIntegration/daStudy.py +++ b/src/daSalome/daYacsIntegration/daStudy.py @@ -52,8 +52,11 @@ class daStudy: # Observation Management self.ObservationOperatorType = {} + self.EvolutionModelType = {} self.FunctionObservationOperator = {} + #-------------------------------------- + def setInputVariable(self, name, size): self.InputVariables[name] = size self.InputVariablesOrder.append(name) @@ -62,68 +65,72 @@ class daStudy: self.OutputVariables[name] = size self.OutputVariablesOrder.append(name) + #-------------------------------------- + def setAlgorithmParameters(self, parameters): self.algorithm_dict = parameters - def initAlgorithm(self): + #-------------------------------------- + def initAlgorithm(self): self.ADD.setAlgorithm(choice=self.algorithm) if self.algorithm_dict != None: logging.debug("ADD.setAlgorithm : "+str(self.algorithm_dict)) self.ADD.setAlgorithmParameters(asDico=self.algorithm_dict) - def getAssimilationStudy(self): + #-------------------------------------- + def getAssimilationStudy(self): return self.ADD + #-------------------------------------- # Methods to initialize AssimilationStudy def setBackgroundType(self, Type): - if Type == "Vector": self.BackgroundType = Type else: raise daError("[daStudy::setBackgroundType] Type is unkown : " + Type + " Types are : Vector") def setBackground(self, Background): - try: self.BackgroundType except AttributeError: raise daError("[daStudy::setBackground] Type is not defined !") - self.Background = Background - if self.BackgroundType == "Vector": self.ADD.setBackground(asVector = Background) def getBackground(self): return self.Background - def setBackgroundError(self, BackgroundError): + #-------------------------------------- + def setBackgroundError(self, BackgroundError): self.ADD.setBackgroundError(asCovariance = BackgroundError) - def setObservationType(self, Type): + #-------------------------------------- + def setObservationType(self, Type): if Type == "Vector": self.ObservationType = Type else: raise daError("[daStudy::setObservationType] Type is unkown : " + Type + " Types are : Vector") def setObservation(self, Observation): - try: self.ObservationType except AttributeError: raise daError("[daStudy::setObservation] Type is not defined !") - if self.ObservationType == "Vector": self.ADD.setObservation(asVector = Observation) + #-------------------------------------- + def setObservationError(self, ObservationError): self.ADD.setObservationError(asCovariance = ObservationError) + #-------------------------------------- def getObservationOperatorType(self, Name): rtn = None @@ -139,19 +146,48 @@ class daStudy: elif Type == "Function": self.ObservationOperatorType[Name] = Type else: - raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix") + raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix, Function") def setObservationOperator(self, Name, ObservationOperator): try: self.ObservationOperatorType[Name] except AttributeError: raise daError("[daStudy::setObservationOperator] Type is not defined !") - if self.ObservationOperatorType[Name] == "Matrix": self.ADD.setObservationOperator(asMatrix = ObservationOperator) elif self.ObservationOperatorType[Name] == "Function": self.FunctionObservationOperator[Name] = ObservationOperator + #-------------------------------------- + + def getEvolutionModelType(self, Name): + rtn = None + try: + rtn = self.EvolutionModelType[Name] + except: + pass + return rtn + + def setEvolutionModelType(self, Name, Type): + if Type == "Matrix": + self.EvolutionModelType[Name] = Type + elif Type == "Function": + self.EvolutionModelType[Name] = Type + else: + raise daError("[daStudy::setEvolutionModelType] Type is unkown : " + Type + " Types are : Matrix, Function") + + def setEvolutionModel(self, Name, EvolutionModel): + try: + self.EvolutionModelType[Name] + except AttributeError: + raise daError("[daStudy::setEvolutionModel] Type is not defined !") + if self.EvolutionModelType[Name] == "Matrix": + self.ADD.setEvolutionModel(asMatrix = EvolutionModel) + elif self.EvolutionModelType[Name] == "Function": + self.FunctionEvolutionModel[Name] = EvolutionModel + + #-------------------------------------- + def addObserver(self, name, scheduler, info, number): self.observers_dict[name] = {} self.observers_dict[name]["scheduler"] = scheduler diff --git a/src/daSalome/daYacsSchemaCreator/infos_daComposant.py b/src/daSalome/daYacsSchemaCreator/infos_daComposant.py index 1aa9c8c..a3d764d 100644 --- a/src/daSalome/daYacsSchemaCreator/infos_daComposant.py +++ b/src/daSalome/daYacsSchemaCreator/infos_daComposant.py @@ -28,8 +28,8 @@ AnalysisFromList = ["String", "Script"] # -- Infos from daCore -- AssimData = ["Background", "BackgroundError", "Observation", "ObservationError", - "EvolutionModel", "EvolutionError", "ObservationOperator", + "EvolutionModel", "EvolutionError", "AlgorithmParameters"] AssimType = {} @@ -38,6 +38,8 @@ AssimType["BackgroundError"] = ["Matrix"] AssimType["Observation"] = ["Vector"] AssimType["ObservationError"] = ["Matrix"] AssimType["ObservationOperator"] = ["Matrix", "Function"] +AssimType["EvolutionModel"] = ["Matrix", "Function"] +AssimType["EvolutionError"] = ["Matrix"] AssimType["AlgorithmParameters"] = ["Dict"] AssimType["UserDataInit"] = ["Dict"] @@ -124,6 +126,8 @@ AssimDataDict["BackgroundError"] = ["Matrix"] AssimDataDict["Observation"] = ["Vector"] AssimDataDict["ObservationError"] = ["Matrix"] AssimDataDict["ObservationOperator"] = ["Matrix", "Function"] +AssimDataDict["EvolutionModel"] = ["Matrix", "Function"] +AssimDataDict["EvolutionError"] = ["Matrix"] AssimDataDict["AlgorithmParameters"] = ["Dict"] AssimDataDict["UserDataInit"] = ["Dict"] @@ -133,6 +137,8 @@ AssimDataDefaultDict["BackgroundError"] = "Matrix" AssimDataDefaultDict["Observation"] = "Vector" AssimDataDefaultDict["ObservationError"] = "Matrix" AssimDataDefaultDict["ObservationOperator"] = "Function" +AssimDataDefaultDict["EvolutionModel"] = "Function" +AssimDataDefaultDict["EvolutionError"] = "Matrix" AssimDataDefaultDict["AlgorithmParameters"] = "Dict" AssimDataDefaultDict["UserDataInit"] = "Dict" -- 2.39.2