From: Jean-Philippe ARGAUD Date: Fri, 10 Nov 2023 10:44:35 +0000 (+0100) Subject: Documentation update and method improvement X-Git-Tag: V9_12_0b1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fc36a57471cf70ead02c1a9982b2b9aa05e2eca3;p=modules%2Fadao.git Documentation update and method improvement --- diff --git a/doc/en/images/sampling_05_SampleAsIndependantRandomVariables_normal.png b/doc/en/images/sampling_05_SampleAsIndependantRandomVariables_normal.png deleted file mode 100644 index af69551..0000000 Binary files a/doc/en/images/sampling_05_SampleAsIndependantRandomVariables_normal.png and /dev/null differ diff --git a/doc/en/images/sampling_05_SampleAsMinMaxSobolSequence.png b/doc/en/images/sampling_05_SampleAsMinMaxSobolSequence.png new file mode 100644 index 0000000..98a8d30 Binary files /dev/null and b/doc/en/images/sampling_05_SampleAsMinMaxSobolSequence.png differ diff --git a/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_normal.png b/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_normal.png new file mode 100644 index 0000000..af69551 Binary files /dev/null and b/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_normal.png differ diff --git a/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png b/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png deleted file mode 100644 index 3ed60a4..0000000 Binary files a/doc/en/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png and /dev/null differ diff --git a/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png b/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png new file mode 100644 index 0000000..3ed60a4 Binary files /dev/null and b/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png differ diff --git a/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png b/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png deleted file mode 100644 index 7f656aa..0000000 Binary files a/doc/en/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png and /dev/null differ diff --git a/doc/en/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png b/doc/en/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png new file mode 100644 index 0000000..7f656aa Binary files /dev/null and b/doc/en/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png differ diff --git a/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst index 20f3a22..fac1289 100644 --- a/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst +++ b/doc/en/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -82,6 +82,8 @@ observations :math:`\mathbf{y}^o`. .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst index ce58671..d1f1231 100644 --- a/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/en/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -122,6 +122,8 @@ constrained positioning search. .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/en/ref_algorithm_SamplingTest.rst b/doc/en/ref_algorithm_SamplingTest.rst index 1da38a2..7984938 100644 --- a/doc/en/ref_algorithm_SamplingTest.rst +++ b/doc/en/ref_algorithm_SamplingTest.rst @@ -89,6 +89,8 @@ treatment during the calculation by well suited "*observer*". .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/en/ref_sampling_requirements.rst b/doc/en/ref_sampling_requirements.rst index fa7cb9a..bd89d19 100644 --- a/doc/en/ref_sampling_requirements.rst +++ b/doc/en/ref_sampling_requirements.rst @@ -49,9 +49,9 @@ Explicit or implicit description of the state sampling collection The state sampling collection can be described using dedicated keywords in the command set of an algorithm that requires it. -State sampling :math:`\mathbf{x}` can be provided explicitly or in the form of -hypercubes, explicit or sampled according to common distributions, or using -Latin Hypercube Sampling (LHS). +The sampling of the states :math:`\mathbf{x}` can be provided explicitly or in +the form of hypercubes, explicit or sampled according to common distributions, +or using Latin Hypercube Sampling (LHS). These possible keywords are: @@ -61,6 +61,8 @@ These possible keywords are: .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst @@ -153,6 +155,24 @@ The distribution of states thus described corresponds to the illustration: .. image:: images/sampling_04_SampleAsMinMaxLatinHyperCube.png :align: center +Implicit state distribution by keyword "*SampleAsMinMaxSobolSequence*" +....................................................................... + +Implicit sample generation command by "*SampleAsMinMaxSobolSequence*" is as +follows: + +.. code-block:: python + + [...] + "SampleAsMinMaxSobolSequence":[[0, 4], [0, 4], [2, 25]] + [...] + +The distribution of states (there will be 36 here by construction principle of +the Sobol sequence) thus described corresponds to the illustration: + + .. image:: images/sampling_05_SampleAsMinMaxSobolSequence.png + :align: center + Implicit state distribution by keyword "*SampleAsIndependantRandomVariables*" with normal law ............................................................................................. @@ -167,7 +187,7 @@ follows, using a normal distribution (0,1) by coordinate: The distribution of states thus described corresponds to the illustration: - .. image:: images/sampling_05_SampleAsIndependantRandomVariables_normal.png + .. image:: images/sampling_06_SampleAsIndependantRandomVariables_normal.png :align: center Implicit state distribution by keyword "*SampleAsIndependantRandomVariables*" with uniform law @@ -185,7 +205,7 @@ distribution: The distribution of states thus described corresponds to the illustration: - .. image:: images/sampling_06_SampleAsIndependantRandomVariables_uniform.png + .. image:: images/sampling_07_SampleAsIndependantRandomVariables_uniform.png :align: center Implicit state distribution by keyword "*SampleAsIndependantRandomVariables*" with Weibull law @@ -203,5 +223,5 @@ distribution: The distribution of states thus described corresponds to the illustration: - .. image:: images/sampling_07_SampleAsIndependantRandomVariables_weibull.png + .. image:: images/sampling_08_SampleAsIndependantRandomVariables_weibull.png :align: center diff --git a/doc/en/snippets/SampleAsMinMaxLatinHyperCube.rst b/doc/en/snippets/SampleAsMinMaxLatinHyperCube.rst index 4907dab..0bb007f 100644 --- a/doc/en/snippets/SampleAsMinMaxLatinHyperCube.rst +++ b/doc/en/snippets/SampleAsMinMaxLatinHyperCube.rst @@ -1,11 +1,12 @@ .. index:: single: SampleAsMinMaxLatinHyperCube +.. index:: single: Latin hypercube SampleAsMinMaxLatinHyperCube *List of triplets of pair values*. This key describes the bounded domain in which the calculations points will be placed, from a *[min,max]* pair for each state component. The lower bounds are included. This list of pairs, identical in number to the size of the state space, is augmented by a pair of - integers *[dim,nb]* containing the dimension of the state space and the + integers *[dim,nbr]* containing the dimension of the state space and the desired number of sample points. Sampling is then automatically constructed using the Latin hypercube method (LHS). diff --git a/doc/en/snippets/SampleAsMinMaxSobolSequence.rst b/doc/en/snippets/SampleAsMinMaxSobolSequence.rst new file mode 100644 index 0000000..1afab0e --- /dev/null +++ b/doc/en/snippets/SampleAsMinMaxSobolSequence.rst @@ -0,0 +1,16 @@ +.. index:: single: SampleAsMinMaxSobolSequence +.. index:: single: Sobol Sequence + +SampleAsMinMaxSobolSequence + *List of triplets of pair values*. This key describes the bounded domain in + which the calculations points will be placed, from a *[min,max]* pair for + each state component. The lower bounds are included. This list of pairs, + identical in number to the size of the state space, is augmented by a pair of + integers *[dim,nbr]* containing the dimension of the state space and the + minimum desired number of sample points (by construction, the number of + points generated in the Sobol sequence will be the power of 2 immediately + above this minimum number). Sampling is then automatically constructed using + the Latin hypercube method (LHS). + + Example : + ``{"SampleAsMinMaxSobolSequence":[[0.,1.],[-1,3]]+[[2,11]]}`` for a state space of dimension 2 and 11 sampling points (there will be 16 points in practice). diff --git a/doc/fr/images/sampling_05_SampleAsIndependantRandomVariables_normal.png b/doc/fr/images/sampling_05_SampleAsIndependantRandomVariables_normal.png deleted file mode 100644 index 5ede766..0000000 Binary files a/doc/fr/images/sampling_05_SampleAsIndependantRandomVariables_normal.png and /dev/null differ diff --git a/doc/fr/images/sampling_05_SampleAsMinMaxSobolSequence.png b/doc/fr/images/sampling_05_SampleAsMinMaxSobolSequence.png new file mode 100644 index 0000000..2c98de8 Binary files /dev/null and b/doc/fr/images/sampling_05_SampleAsMinMaxSobolSequence.png differ diff --git a/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_normal.png b/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_normal.png new file mode 100644 index 0000000..5ede766 Binary files /dev/null and b/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_normal.png differ diff --git a/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png b/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png deleted file mode 100644 index 964fb44..0000000 Binary files a/doc/fr/images/sampling_06_SampleAsIndependantRandomVariables_uniform.png and /dev/null differ diff --git a/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png b/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png new file mode 100644 index 0000000..964fb44 Binary files /dev/null and b/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_uniform.png differ diff --git a/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png b/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png deleted file mode 100644 index 7a9a5e8..0000000 Binary files a/doc/fr/images/sampling_07_SampleAsIndependantRandomVariables_weibull.png and /dev/null differ diff --git a/doc/fr/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png b/doc/fr/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png new file mode 100644 index 0000000..7a9a5e8 Binary files /dev/null and b/doc/fr/images/sampling_08_SampleAsIndependantRandomVariables_weibull.png differ diff --git a/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst index ea1f77d..72a6688 100644 --- a/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst +++ b/doc/fr/ref_algorithm_EnsembleOfSimulationGenerationTask.rst @@ -85,6 +85,8 @@ d'échantillonnage pour établir un ensemble de valeurs de fonctionnelle d'erreu .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst index 8f8adda..c939d7c 100644 --- a/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst +++ b/doc/fr/ref_algorithm_MeasurementsOptimalPositioningTask.rst @@ -126,6 +126,8 @@ d'analyse pour une recherche de positionnement contraint. .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/fr/ref_algorithm_SamplingTest.rst b/doc/fr/ref_algorithm_SamplingTest.rst index d5c6bb0..12912c8 100644 --- a/doc/fr/ref_algorithm_SamplingTest.rst +++ b/doc/fr/ref_algorithm_SamplingTest.rst @@ -93,6 +93,8 @@ calcul à l'aide des "*observer*" adaptés. .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst diff --git a/doc/fr/ref_sampling_requirements.rst b/doc/fr/ref_sampling_requirements.rst index 09c5047..e3bb716 100644 --- a/doc/fr/ref_sampling_requirements.rst +++ b/doc/fr/ref_sampling_requirements.rst @@ -64,6 +64,8 @@ Ces mots-clés possibles sont les suivants : .. include:: snippets/SampleAsMinMaxLatinHyperCube.rst +.. include:: snippets/SampleAsMinMaxSobolSequence.rst + .. include:: snippets/SampleAsMinMaxStepHyperCube.rst .. include:: snippets/SampleAsnUplet.rst @@ -158,6 +160,24 @@ La répartition des états ainsi décrite correspond à l'illustration : .. image:: images/sampling_04_SampleAsMinMaxLatinHyperCube.png :align: center +Répartition implicite d'états par le mot-clé "*SampleAsMinMaxSobolSequence*" +............................................................................ + +La commande de génération implicite d'échantillons par +"*SampleAsMinMaxSobolSequence*" est la suivante : + +.. code-block:: python + + [...] + "SampleAsMinMaxSobolSequence":[[0, 4, 1], [0, 4, 1], [2, 25]] + [...] + +La répartition des états (il y en a ici 36 par principe de construction de la +séquence de Sobol) ainsi décrite correspond à l'illustration : + + .. image:: images/sampling_05_SampleAsMinMaxSobolSequence.png + :align: center + Répartition implicite d'états par le mot-clé "*SampleAsIndependantRandomVariables*" avec loi normale .................................................................................................... @@ -173,7 +193,7 @@ normale (0,1) de répartition par coordonnée : La répartition des états ainsi décrite correspond à l'illustration : - .. image:: images/sampling_05_SampleAsIndependantRandomVariables_normal.png + .. image:: images/sampling_06_SampleAsIndependantRandomVariables_normal.png :align: center Répartition implicite d'états par le mot-clé "*SampleAsIndependantRandomVariables*" avec loi uniforme @@ -191,7 +211,7 @@ uniforme entre 0 et 5 de répartition par coordonnée : La répartition des états ainsi décrite correspond à l'illustration : - .. image:: images/sampling_06_SampleAsIndependantRandomVariables_uniform.png + .. image:: images/sampling_07_SampleAsIndependantRandomVariables_uniform.png :align: center Répartition implicite par le mot-clé "*SampleAsIndependantRandomVariables*" avec loi de Weibull @@ -209,5 +229,5 @@ Weibull à un paramètre de valeur 5 de répartition par coordonnée : La répartition des états ainsi décrite correspond à l'illustration : - .. image:: images/sampling_07_SampleAsIndependantRandomVariables_weibull.png + .. image:: images/sampling_08_SampleAsIndependantRandomVariables_weibull.png :align: center diff --git a/doc/fr/snippets/SampleAsMinMaxLatinHyperCube.rst b/doc/fr/snippets/SampleAsMinMaxLatinHyperCube.rst index ce2bf8e..46101f0 100644 --- a/doc/fr/snippets/SampleAsMinMaxLatinHyperCube.rst +++ b/doc/fr/snippets/SampleAsMinMaxLatinHyperCube.rst @@ -1,11 +1,13 @@ .. index:: single: SampleAsMinMaxLatinHyperCube +.. index:: single: Latin hypercube +.. index:: single: Hypercube Latin SampleAsMinMaxLatinHyperCube *Liste de triplets de paires réelles*. Cette clé décrit le domaine borné dans lequel les points de calcul seront placés, sous la forme d'une paire *[min,max]* pour chaque composante de l'état. Les bornes inférieures sont incluses. Cette liste de paires, en nombre identique à la taille de l'espace - des états, est complétée par une paire d'entier *[dim,nb]* comportant la + des états, est complétée par une paire d'entier *[dim,nbr]* comportant la dimension de l'espace des états et le nombre souhaité de points d'échantillonnage. L'échantillonnage est ensuite construit automatiquement selon la méthode de l'hypercube Latin (LHS). diff --git a/doc/fr/snippets/SampleAsMinMaxSobolSequence.rst b/doc/fr/snippets/SampleAsMinMaxSobolSequence.rst new file mode 100644 index 0000000..2d72dc6 --- /dev/null +++ b/doc/fr/snippets/SampleAsMinMaxSobolSequence.rst @@ -0,0 +1,18 @@ +.. index:: single: SampleAsMinMaxSobolSequence +.. index:: single: Sobol Sequence +.. index:: single: Séquence de Sobol + +SampleAsMinMaxSobolSequence + *Liste de triplets de paires réelles*. Cette clé décrit le domaine borné dans + lequel les points de calcul seront placés, sous la forme d'une paire + *[min,max]* pour chaque composante de l'état. Les bornes inférieures sont + incluses. Cette liste de paires, en nombre identique à la taille de l'espace + des états, est complétée par une paire d'entier *[dim,nbr]* comportant la + dimension de l'espace des états et le nombre minimum souhaité de points + d'échantillonnage (par construction, le nombre de points générés dans la + séquence de Sobol sera la puissance de 2 immédiatement supérieure à ce nombre + minimum). L'échantillonnage est ensuite construit automatiquement selon la + méthode de séquences de Sobol. + + Exemple : + ``{"SampleAsMinMaxSobolSequence":[[0.,1.],[-1,3]]+[[2,11]]}`` pour un espace d'état de dimension 2 et au moins 11 points d'échantillonnage (il y aura 16 points en pratique). diff --git a/src/daComposant/daAlgorithms/Atoms/eosg.py b/src/daComposant/daAlgorithms/Atoms/eosg.py index 2204cd1..801a440 100644 --- a/src/daComposant/daAlgorithms/Atoms/eosg.py +++ b/src/daComposant/daAlgorithms/Atoms/eosg.py @@ -39,6 +39,7 @@ def eosg(selfA, Xb, HO, outputEOX = False, assumeNoFailure = True): selfA._parameters["SampleAsExplicitHyperCube"], selfA._parameters["SampleAsMinMaxStepHyperCube"], selfA._parameters["SampleAsMinMaxLatinHyperCube"], + selfA._parameters["SampleAsMinMaxSobolSequence"], selfA._parameters["SampleAsIndependantRandomVariables"], Xb, selfA._parameters["SetSeed"], diff --git a/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py b/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py index d22a5f3..1cd3eaa 100644 --- a/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py +++ b/src/daComposant/daAlgorithms/EnsembleOfSimulationGenerationTask.py @@ -52,6 +52,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): typecast = tuple, message = "Points de calcul définis par un hyper-cube Latin dont on donne les bornes de chaque variable par une paire [min,max], suivi du nombre de points demandés", ) + self.defineRequiredParameter( + name = "SampleAsMinMaxSobolSequence", + default = [], + typecast = tuple, + message = "Points de calcul définis par une séquence de Sobol dont on donne les bornes de chaque variable par une paire [min,max], suivi de la paire [dimension, nombre minimal de points demandés]", + ) self.defineRequiredParameter( name = "SampleAsIndependantRandomVariables", default = [], diff --git a/src/daComposant/daAlgorithms/MeasurementsOptimalPositioningTask.py b/src/daComposant/daAlgorithms/MeasurementsOptimalPositioningTask.py index 2cae2a6..71989bc 100644 --- a/src/daComposant/daAlgorithms/MeasurementsOptimalPositioningTask.py +++ b/src/daComposant/daAlgorithms/MeasurementsOptimalPositioningTask.py @@ -103,6 +103,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): typecast = tuple, message = "Points de calcul définis par un hyper-cube Latin dont on donne les bornes de chaque variable par une paire [min,max], suivi du nombre de points demandés", ) + self.defineRequiredParameter( + name = "SampleAsMinMaxSobolSequence", + default = [], + typecast = tuple, + message = "Points de calcul définis par une séquence de Sobol dont on donne les bornes de chaque variable par une paire [min,max], suivi de la paire [dimension, nombre minimal de points demandés]", + ) self.defineRequiredParameter( name = "SampleAsIndependantRandomVariables", default = [], diff --git a/src/daComposant/daAlgorithms/SamplingTest.py b/src/daComposant/daAlgorithms/SamplingTest.py index ecc9646..c006e3a 100644 --- a/src/daComposant/daAlgorithms/SamplingTest.py +++ b/src/daComposant/daAlgorithms/SamplingTest.py @@ -60,6 +60,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): typecast = tuple, message = "Points de calcul définis par un hyper-cube Latin dont on donne les bornes de chaque variable par une paire [min,max], suivi de la paire [dimension, nombre de points demandés]", ) + self.defineRequiredParameter( + name = "SampleAsMinMaxSobolSequence", + default = [], + typecast = tuple, + message = "Points de calcul définis par une séquence de Sobol dont on donne les bornes de chaque variable par une paire [min,max], suivi de la paire [dimension, nombre minimal de points demandés]", + ) self.defineRequiredParameter( name = "SampleAsIndependantRandomVariables", default = [], @@ -181,6 +187,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): self._parameters["SampleAsExplicitHyperCube"], self._parameters["SampleAsMinMaxStepHyperCube"], self._parameters["SampleAsMinMaxLatinHyperCube"], + self._parameters["SampleAsMinMaxSobolSequence"], self._parameters["SampleAsIndependantRandomVariables"], Xb, self._parameters["SetSeed"], diff --git a/src/daComposant/daCore/NumericObjects.py b/src/daComposant/daCore/NumericObjects.py index ab2cee4..e6e2277 100644 --- a/src/daComposant/daCore/NumericObjects.py +++ b/src/daComposant/daCore/NumericObjects.py @@ -544,7 +544,12 @@ def EnsembleOfCenteredPerturbations( __bgCenter, __bgCovariance, __nbMembers ): return _Perturbations # ============================================================================== -def EnsembleOfBackgroundPerturbations( __bgCenter, __bgCovariance, __nbMembers, __withSVD = True ): +def EnsembleOfBackgroundPerturbations( + __bgCenter, + __bgCovariance, + __nbMembers, + __withSVD = True, + ): "Génération d'un ensemble de taille __nbMembers-1 d'états aléatoires centrés" def __CenteredRandomAnomalies(Zr, N): """ @@ -1037,6 +1042,7 @@ def BuildComplexSampleList( __SampleAsExplicitHyperCube, __SampleAsMinMaxStepHyperCube, __SampleAsMinMaxLatinHyperCube, + __SampleAsMinMaxSobolSequence, __SampleAsIndependantRandomVariables, __X0, __Seed = None, @@ -1065,20 +1071,40 @@ def BuildComplexSampleList( if vt(scipy.version.version) <= vt("1.7.0"): __msg = "In order to use Latin Hypercube sampling, you must at least use Scipy version 1.7.0 (and you are presently using Scipy %s). A void sample is then generated."%scipy.version.version warnings.warn(__msg, FutureWarning, stacklevel=50) - coordinatesList = [] + sampleList = [] else: __spDesc = list(__SampleAsMinMaxLatinHyperCube) - __nbSamp = int(__spDesc.pop()[1]) + __nbDime,__nbSamp = map(int, __spDesc.pop()) # Réduction du dernier __sample = scipy.stats.qmc.LatinHypercube( d = len(__spDesc), seed = numpy.random.default_rng(__Seed), ) __sample = __sample.random(n = __nbSamp) __bounds = numpy.array(__spDesc)[:,0:2] - l_bounds = __bounds[:,0] - u_bounds = __bounds[:,1] - coordinatesList = scipy.stats.qmc.scale(__sample, l_bounds, u_bounds) - sampleList = coordinatesList + __l_bounds = __bounds[:,0] + __u_bounds = __bounds[:,1] + sampleList = scipy.stats.qmc.scale(__sample, __l_bounds, __u_bounds) + # --------------------------- + elif len(__SampleAsMinMaxSobolSequence) > 0: + import scipy, warnings + if vt(scipy.version.version) <= vt("1.7.0"): + __msg = "In order to use Latin Hypercube sampling, you must at least use Scipy version 1.7.0 (and you are presently using Scipy %s). A void sample is then generated."%scipy.version.version + warnings.warn(__msg, FutureWarning, stacklevel=50) + sampleList = [] + else: + __spDesc = list(__SampleAsMinMaxSobolSequence) + __nbDime,__nbSamp = map(int, __spDesc.pop()) # Réduction du dernier + if __nbDime != len(__spDesc): + warnings.warn("Declared space dimension (%i) is not equal to number of bounds (%i), the last one will be used."%(__nbDime, len(__spDesc)), FutureWarning, stacklevel=50) + __sample = scipy.stats.qmc.Sobol( + d = len(__spDesc), + seed = numpy.random.default_rng(__Seed), + ) + __sample = __sample.random_base2(m = int(math.log2(__nbSamp))+1) + __bounds = numpy.array(__spDesc)[:,0:2] + __l_bounds = __bounds[:,0] + __u_bounds = __bounds[:,1] + sampleList = scipy.stats.qmc.scale(__sample, __l_bounds, __u_bounds) # --------------------------- elif len(__SampleAsIndependantRandomVariables) > 0: coordinatesList = [] diff --git a/src/daComposant/daCore/Reporting.py b/src/daComposant/daCore/Reporting.py index 22cd12b..d3d7ac3 100644 --- a/src/daComposant/daCore/Reporting.py +++ b/src/daComposant/daCore/Reporting.py @@ -252,6 +252,8 @@ class ReportViewInPlainTxt(__ReportV__): Report in plain TXT """ # + __slots__ = () + # default_filename="report.txt" tags = { "p":["\n",""],