From: Jean-Philippe ARGAUD Date: Sat, 30 Dec 2023 20:40:23 +0000 (+0100) Subject: Code review corrections for special cases X-Git-Tag: V9_13_0a1~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c7b70bb2c2e43dd15621c3c3ec9b97c717020d01;p=modules%2Fadao.git Code review corrections for special cases --- diff --git a/src/daComposant/daAlgorithms/Atoms/eosg.py b/src/daComposant/daAlgorithms/Atoms/eosg.py index 801a440..d2e3945 100644 --- a/src/daComposant/daAlgorithms/Atoms/eosg.py +++ b/src/daComposant/daAlgorithms/Atoms/eosg.py @@ -89,6 +89,9 @@ def eosg(selfA, Xb, HO, outputEOX = False, assumeNoFailure = True): EOS[i] = numpy.nan*numpy.ones(__s) EOS = numpy.stack(EOS, axis=1) # + if len(EOS.shape) > 2 and EOS.shape[2]==1: # RaJ si transposition de Hm + EOS = EOS.squeeze( axis = 2 ) + # if selfA._parameters["SetDebug"]: print("\n %s\n"%("-"*75,)) print("===> End evaluation, deactivating debug if necessary\n") diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index 659e34d..064400c 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -779,9 +779,9 @@ class Algorithm(object): self.StoredVariables["CurrentOptimum"] = Persistence.OneVector(name = "CurrentOptimum") self.StoredVariables["CurrentState"] = Persistence.OneVector(name = "CurrentState") self.StoredVariables["CurrentStepNumber"] = Persistence.OneIndex(name = "CurrentStepNumber") - self.StoredVariables["EnsembleOfSimulations"] = Persistence.OneMatrix(name = "EnsembleOfSimulations") - self.StoredVariables["EnsembleOfSnapshots"] = Persistence.OneMatrix(name = "EnsembleOfSnapshots") - self.StoredVariables["EnsembleOfStates"] = Persistence.OneMatrix(name = "EnsembleOfStates") + self.StoredVariables["EnsembleOfSimulations"] = Persistence.OneMatrice(name = "EnsembleOfSimulations") + self.StoredVariables["EnsembleOfSnapshots"] = Persistence.OneMatrice(name = "EnsembleOfSnapshots") + self.StoredVariables["EnsembleOfStates"] = Persistence.OneMatrice(name = "EnsembleOfStates") self.StoredVariables["ExcludedPoints"] = Persistence.OneVector(name = "ExcludedPoints") self.StoredVariables["ForecastCovariance"] = Persistence.OneMatrix(name = "ForecastCovariance") self.StoredVariables["ForecastState"] = Persistence.OneVector(name = "ForecastState") diff --git a/src/daComposant/daCore/NumericObjects.py b/src/daComposant/daCore/NumericObjects.py index 7f56831..5adc641 100644 --- a/src/daComposant/daCore/NumericObjects.py +++ b/src/daComposant/daCore/NumericObjects.py @@ -1083,7 +1083,7 @@ def BuildComplexSampleList( sampleList = __SampleAsnUplet for i,Xx in enumerate(sampleList): if numpy.ravel(Xx).size != __X0.size: - raise ValueError("The size %i of the %ith state X in the sample and %i of the checking point Xb are different, they have to be identical."%(numpy.ravel(Xx).size,i+1,X0.size)) + raise ValueError("The size %i of the %ith state X in the sample and %i of the checking point Xb are different, they have to be identical."%(numpy.ravel(Xx).size,i+1,__X0.size)) # --------------------------- elif len(__SampleAsExplicitHyperCube) > 0: sampleList = itertools.product(*list(__SampleAsExplicitHyperCube)) diff --git a/src/daComposant/daCore/Persistence.py b/src/daComposant/daCore/Persistence.py index 9b5cd08..34bafb1 100644 --- a/src/daComposant/daCore/Persistence.py +++ b/src/daComposant/daCore/Persistence.py @@ -849,6 +849,15 @@ class OneVector(Persistence): def __init__(self, name="", unit="", basetype = numpy.ravel): Persistence.__init__(self, name, unit, basetype) +class OneMatrice(Persistence): + """ + Classe de stockage d'une matrice de valeurs homogènes par pas. + """ + __slots__ = () + # + def __init__(self, name="", unit="", basetype = numpy.array): + Persistence.__init__(self, name, unit, basetype) + class OneMatrix(Persistence): """ Classe de stockage d'une matrice de valeurs homogènes par pas.