]> SALOME platform Git repositories - modules/adao.git/blob - src/daSalome/daYacsIntegration/daStudy.py
Salome HOME
Patch pour passage de daStudy dans le canal de l'Optimizer Loop
[modules/adao.git] / src / daSalome / daYacsIntegration / daStudy.py
1 #-*-coding:iso-8859-1-*-
2
3 from daCore.AssimilationStudy import AssimilationStudy
4
5 class daError(Exception):
6   def __init__(self, value):
7     self.value = value
8   def __str__(self):
9     return repr(self.value)
10
11 class daStudy:
12
13   def __init__(self, name, algorithm):
14
15     self.ADD = AssimilationStudy(name)
16     self.ADD.setControls()
17     self.algorithm = algorithm
18
19   def initAlgorithm():
20     self.ADD.setAlgorithm(choice=self.algorithm)
21
22   def getAssimilationStudy(self):
23
24     return self.ADD
25
26   # Methods to initialize AssimilationStudy
27
28   def setBackgroundType(self, Type):
29
30     if Type == "Vector":
31       self.BackgroundType = Type
32     else:
33       raise daError("[daStudy::setBackgroundType] Type is unkown : " + Type + " Types are : Vector")
34
35   def setBackground(self, Background):
36
37     try:
38       self.BackgroundType
39     except AttributeError:
40       raise daError("[daStudy::setBackground] Type is not defined !")
41
42     if self.BackgroundType == "Vector":
43       self.ADD.setBackground(asVector = Background)
44
45   def setBackgroundError(self, BackgroundError):
46
47     self.ADD.setBackgroundError(asCovariance = BackgroundError)
48
49   def setObservationType(self, Type):
50
51     if Type == "Vector":
52       self.ObservationType = Type
53     else:
54       raise daError("[daStudy::setObservationType] Type is unkown : " + Type + " Types are : Vector")
55
56   def setObservation(self, Observation):
57
58     try:
59       self.ObservationType
60     except AttributeError:
61       raise daError("[daStudy::setObservation] Type is not defined !")
62
63     if self.ObservationType == "Vector":
64       self.ADD.setObservation(asVector = Observation)
65
66   def setObservationError(self, ObservationError):
67
68     self.ADD.setObservationError(asCovariance = ObservationError)
69
70   def setObservationOperatorType(self, Type):
71
72     if Type == "Matrix":
73       self.ObservationOperatorType = Type
74     else:
75       raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix")
76
77   def setObservationOperator(self, ObservationOperator):
78
79     try:
80       self.ObservationOperatorType
81     except AttributeError:
82       raise daError("[daStudy::setObservationOperator] Type is not defined !")
83
84     if self.ObservationOperatorType == "Matrix":
85       self.ADD.setObservationOperator(asMatrix = ObservationOperator)
86