elif pt is float:
algo_parameters += """ %s = SIMP(statut="f", typ="R"%s%s, min=1, max=1, defaut=%s, fr="%s"),\n"""%(pn,vi,vs,float(pd),pm)
elif pt is bool:
- algo_parameters += """ %s = SIMP(statut="f", typ="I", min=1, max=1, defaut=%s, fr="%s"),\n"""%(pn,int(pd),pm)
+ algo_parameters += """ %s = SIMP(statut="f", typ="I", into=(0, 1), min=1, max=1, defaut=%s, fr="%s"),\n"""%(pn,int(pd),pm)
elif pt is str and "listval" in par_dict[pn]:
algo_parameters += """ %s = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="%s", into=%s, fr="%s"),\n"""%(pn,pd,par_dict[pn]["listval"],pm)
elif pt is tuple and "listval" in par_dict[pn]:
]
)
self.requireInputArguments(
- mandatory= ("Y", "HO", "R"),
+ mandatory= ("Y", "HO"),
+ optional = ("R"),
)
self.setAttributes(tags=(
"Optimization",
Ha = HO["Adjoint"].asMatrix(Xb)
Ha = Ha.reshape(-1,Y.size) # ADAO & check shape
#
- RI = R.getI()
+ if R is None:
+ RI = 1.
+ else:
+ RI = R.getI()
#
# Calcul de la matrice de gain et de l'analyse
# --------------------------------------------
K = (Ha * RI * Hm).I * Ha * RI
Xa = K * Y
- self.StoredVariables["Analysis"].store( Xa.A1 )
+ self.StoredVariables["Analysis"].store( Xa )
#
# Calcul de la fonction coût
# --------------------------
# Calculs et/ou stockages supplémentaires
# ---------------------------------------
if self._parameters["StoreInternalVariables"] or self._toStore("CurrentState"):
- self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
+ self.StoredVariables["CurrentState"].store( Xa )
if self._toStore("CurrentOptimum"):
- self.StoredVariables["CurrentOptimum"].store( numpy.ravel(Xa) )
+ self.StoredVariables["CurrentOptimum"].store( Xa )
if self._toStore("OMA"):
- self.StoredVariables["OMA"].store( numpy.ravel(oma) )
+ self.StoredVariables["OMA"].store( oma )
if self._toStore("SimulatedObservationAtBackground"):
- self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ self.StoredVariables["SimulatedObservationAtBackground"].store( HXb )
if self._toStore("SimulatedObservationAtCurrentState"):
- self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( HXa )
if self._toStore("SimulatedObservationAtCurrentOptimum"):
- self.StoredVariables["SimulatedObservationAtCurrentOptimum"].store( numpy.ravel(HXa) )
+ self.StoredVariables["SimulatedObservationAtCurrentOptimum"].store( HXa )
if self._toStore("SimulatedObservationAtOptimum"):
- self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
+ self.StoredVariables["SimulatedObservationAtOptimum"].store( HXa )
#
self._post_run(HO)
return 0
message = "État initial imposé (par défaut, c'est l'ébauche si None)",
)
self.requireInputArguments(
- mandatory= ("Xb", "Y", "HO", "R"),
+ mandatory= ("Xb", "Y", "HO"),
+ optional = ("R"),
)
self.setAttributes(tags=(
"Optimization",
if max(Y.shape) != max(HXb.shape):
raise ValueError("The shapes %s of observations Y and %s of observed calculation H(X) are different, they have to be identical."%(Y.shape,HXb.shape))
#
- # Précalcul des inversions de B et R
- # ----------------------------------
- RI = R.getI()
- if self._parameters["Minimizer"] == "LM":
- RdemiI = R.choleskyI()
+ if R is None:
+ RI = 1.
+ RdemiI = 1.
+ else:
+ RI = R.getI()
+ if self._parameters["Minimizer"] == "LM":
+ RdemiI = R.choleskyI()
#
# Définition de la fonction-coût
# ------------------------------
# ----------------------
Xa = numpy.asmatrix(numpy.ravel( Minimum )).T
#
- self.StoredVariables["Analysis"].store( Xa.A1 )
+ self.StoredVariables["Analysis"].store( Xa )
#
if self._toStore("OMA") or \
self._toStore("SimulatedObservationAtOptimum"):
self._toStore("OMB"):
d = Y - HXb
if self._toStore("Innovation"):
- self.StoredVariables["Innovation"].store( numpy.ravel(d) )
+ self.StoredVariables["Innovation"].store( d )
if self._toStore("BMA"):
self.StoredVariables["BMA"].store( numpy.ravel(Xb) - numpy.ravel(Xa) )
if self._toStore("OMA"):
self.StoredVariables["OMA"].store( numpy.ravel(Y) - numpy.ravel(HXa) )
if self._toStore("OMB"):
- self.StoredVariables["OMB"].store( numpy.ravel(d) )
+ self.StoredVariables["OMB"].store( d )
if self._toStore("SimulatedObservationAtBackground"):
- self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ self.StoredVariables["SimulatedObservationAtBackground"].store( HXb )
if self._toStore("SimulatedObservationAtOptimum"):
- self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
+ self.StoredVariables["SimulatedObservationAtOptimum"].store( HXa )
#
self._post_run(HO)
return 0
"Transformation d'enregistrement(s) en commande(s) individuelle(s)"
__suppparameters = {}
if __multilines is not None:
+ if 'adaoBuilder' in __multilines:
+ raise ValueError("Impossible to load given content as an ADAO COMM one (Hint: it's perhaps not a COMM input, but a TUI one).")
if "ASSIMILATION_STUDY" in __multilines:
__suppparameters.update({'StudyType':"ASSIMILATION_STUDY"})
__multilines = __multilines.replace("ASSIMILATION_STUDY","dict")
a = sgPyQt.createAction( UI_ELT_IDS.NEW_ADAOCASE_ID, "New case", "New case", "Create a new ADAO case", "eficas_new.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.OPEN_ADAOCASE_ID, "Open case", "Open case", "Open an ADAO case", "eficas_open.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.OPEN_ADAOCASE_ID, "Open a case", "Open a case", "Open an ADAO case", "eficas_open.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.SAVE_ADAOCASE_ID, "Save case", "Save case", "Save an ADAO case", "eficas_save.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.SAVE_ADAOCASE_ID, "Save the case", "Save the case", "Save the ADAO case", "eficas_save.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.SAVE_AS_ADAOCASE_ID, "Save as case", "Save as case", "Save an ADAO case as", "eficas_saveas.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.SAVE_AS_ADAOCASE_ID, "Save the case as", "Save the case as", "Save the ADAO case as", "eficas_saveas.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.VALIDATE_ADAOCASE_ID, "Validate case", "Validate case", "Validate an ADAO case", "eficas_valid.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.VALIDATE_ADAOCASE_ID, "Validate the case", "Validate the case", "Validate the ADAO case", "eficas_valid.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
a = sgPyQt.createAction( UI_ELT_IDS.SHOWTREE_ADAOCASE_ID, "Show tree", "Show tree", "Show the commands tree", "eficas_tree.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.TUI_EXPORT_ID, "Export to TUI", "Export to TUI", "Generate an ADAO TUI version of this case", "eficas_totui.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.TUI_EXPORT_ID, "Export the case to TUI", "Export the case to TUI", "Generate the ADAO TUI version of this case", "eficas_totui.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close case", "Close case", "Close an ADAO case", "eficas_close.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close the case", "Close the case", "Close the ADAO case", "eficas_close.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
- a = sgPyQt.createAction( UI_ELT_IDS.YACS_EXPORT_ID, "Export to YACS", "Export to YACS", "Generate a YACS graph executing this case", "eficas_yacs.png" )
+ a = sgPyQt.createAction( UI_ELT_IDS.YACS_EXPORT_ID, "Export the case to YACS", "Export the case to YACS", "Generate the YACS graph to execute this case", "eficas_yacs.png" )
sgPyQt.createMenu(a, mid)
sgPyQt.createTool(a, tid)
# the following action are used in context popup
- a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close case", "Close case", "Close the selected case", "" )
- a = sgPyQt.createAction( UI_ELT_IDS.YACS_EXPORT_ID, "Export to YACS", "Export to YACS", "Generate a YACS graph executing this case", "" )
+ a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close the case", "Close the case", "Close the ADAO case", "" )
+ a = sgPyQt.createAction( UI_ELT_IDS.YACS_EXPORT_ID, "Export the case to YACS", "Export the case to YACS", "Generate the YACS graph to execute this case", "" )
def createPopupMenuOnItem(self,popup,item): # salomeSudyId, item):
if adaoStudyEditor.isValidAdaoCaseItem(item): # Attention : appel ancien avec un coquille (StudyId) : (salomeSudyId, item):