Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    christelle-git
    @christelle-git
    1) ok, if there is a way not showing warning it would be better. @jschueller
    2) I run in command line, and no Jupyter notebook too. It's ok with saving the graph !
    3) I don't use Jupyter notebook, I would rather save the figure.
    4) I have 19 parameters
    christelle-git
    @christelle-git

    Unfortunately I can't increase the size in the algorithm, maximum is 20 for a sample of 500 inputs, then I have the error:

    TypeError: InvalidArgumentException : Sobol experiment is too small (500 vs 1050)

    So my results might be very poor...

    josephmure
    @josephmure

    I really think you would be better off using FunctionalChaosSobolIndices, which works regardless of sample size (though of course, the bigger the sample, the better).

    Assuming your input sample is an OpenTURNS Sample called X and your output an OpenTURNS Sample called Y:

    algo = ot.FunctionalChaosAlgorithm(X, Y)
    algo.run()
    result = algo.getResult()
    sensitivityAnalysis = ot.FunctionalChaosSobolIndices(result)
    # draw Sobol' indices
    first_order = [sensitivityAnalysis.getSobolIndex(i) for i in range(X.getDimension())]
    total_order = [sensitivityAnalysis.getSobolTotalIndex(i) for i in range(X.getDimension())]
    graph = ot.SobolIndicesAlgorithm.DrawSobolIndices(X.getDescription(), first_order, total_order)
    # save graph
    from openturns.viewer import View
    view = View(graph)
    view.save('Sobol_indices.pdf')
    Régis LEBRUN
    @regislebrun
    Hi, to suppress all the warnings you just have to add ot.Log.Show(ot.Log.NONE) at the beginning of your script
    Using a statistical approach to estimate Sobol indices imposes some constraints on the sample structures used in the estimators, resulting into a constraint on the sample size given the input dimension. See http://openturns.github.io/openturns/latest/user_manual/_generated/openturns.SobolIndicesExperiment.html?highlight=sobolindices for the details.
    josephmure
    @josephmure
    With an input Sample of dimension 19, though, it might take several hours. You could perhaps first try it with, say, only 14 parameters and see how long it takes.
    christelle-git
    @christelle-git
    @regislebrun thank you, no more warning.
    @josephmure Yes I've already tried the Chaos method as above, but the result gives all the sobol index null, so I was septic.
    And I plan to increase my parameters to 50, so I would probably better change the method...
    34 replies
    vchabri
    @vchabri

    Hi All,
    I just compiled OpenTURNS (Debian 10 'buster') and I noticed this warning:

    /home/devel/GIT/openturns/build-hohenbichler/python/src/CMakeFiles/common.dir/common_modulePYTHON_wrap.cxx: In function ‘void SWIG_Python_addvarlink(PyObject*, char*, PyObject* (*)(), int (*)(PyObject*))’:
    /home/devel/GIT/openturns/build-hohenbichler/python/src/CMakeFiles/common.dir/common_modulePYTHON_wrap.cxx:35736:16: warning:char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
             strncpy(gv->name,name,size);
             ~~~~~~~^~~~~~~~~~~~~~~~~~~~
    /home/devel/GIT/openturns/build-hohenbichler/python/src/CMakeFiles/common.dir/common_modulePYTHON_wrap.cxx:35733:27: note: length computed here
           size_t size = strlen(name)+1;

    However, it's not a big deal since it does not stop the compiling process.
    Thanks for your help

    2 replies
    josephmure
    @josephmure

    Hi! I ran into this error during compilation of the library:

    [ 25%] Building CXX object lib/src/CMakeFiles/OT.dir/Base/Stat/Last.cxx.o
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixFactory.cxx: In member function ‘OT::HMatrix OT::HMatrixFactory::build(const OT::Sample&, OT::UnsignedInteger, OT::Bool, const OT::HMatrixParameters&)’:
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixFactory.cxx:83:12: error: ‘struct hmat_settings_t’ has no member named ‘assemblyEpsilon’; did you mean ‘acaEpsilon’?
       settings.assemblyEpsilon = parameters.getAssemblyEpsilon();
                ^~~~~~~~~~~~~~~
                acaEpsilon
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixFactory.cxx:84:12: error: ‘struct hmat_settings_t’ has no member named ‘recompressionEpsilon’; did you mean ‘compressionMethod’?
       settings.recompressionEpsilon = parameters.getRecompressionEpsilon();
                ^~~~~~~~~~~~~~~~~~~~
                compressionMethod
    make[2]: *** [lib/src/CMakeFiles/OT.dir/build.make:4158: lib/src/CMakeFiles/OT.dir/Base/Stat/HMatrixFactory.cxx.o] Error 1
    make[2]: *** Attente des tâches non terminées....
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixImplementation.cxx: In member function ‘OT::Bool OT::HMatrixImplementation::setKey(const String&, const String&)’:
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixImplementation.cxx:594:21: error: ‘struct hmat_settings_t’ has no member named ‘assemblyEpsilon’; did you mean ‘acaEpsilon’?
         iss >> settings.assemblyEpsilon;
                         ^~~~~~~~~~~~~~~
                         acaEpsilon
    /home/devel/GIT/openturns/lib/src/Base/Stat/HMatrixImplementation.cxx:599:21: error: ‘struct hmat_settings_t’ has no member named ‘recompressionEpsilon’; did you mean ‘compressionMethod’?
         iss >> settings.recompressionEpsilon;
                         ^~~~~~~~~~~~~~~~~~~~
                         compressionMethod
    make[2]: *** [lib/src/CMakeFiles/OT.dir/build.make:4184: lib/src/CMakeFiles/OT.dir/Base/Stat/HMatrixImplementation.cxx.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:823: lib/src/CMakeFiles/OT.dir/all] Error 2
    make: *** [Makefile:163: all] Error 2

    This error happened after I compiled hmat-oss from the Github sources (master branch). Do you know what causes this error?

    8 replies
    Paulinakindermann
    @Paulinakindermann
    Hi,
    I am working on a FORM analysis:
    algo = ot.FORM(optimAlgo, event, distribution.getMean())
    algo.run()
    result = algo.getResult()
    Now, I would like to plot the probability density function of the limit state value, instead of only viewing the Probability of Failure. Does anyone know how I can do this? Or otherwise, how I can see the value of the limit state function that is computed in every iteration?
    2 replies
    Michael Baudin
    @mbaudin47
    Hi ! I am working on a process metamodel which acts like this. On input, I have the water temperature from time t0 to t1 (i.e. the past) and the air temperature from time t1 to t2 (i.e. the future). On output, the metamodel predicts the water temperature from time t1 to t2 (i.e. the future water temperature). However, the ProcessSample class only has one single mesh. Hence, I need two different ProcessSamples to manage the trajectories. Furthermore, the FieldFunction cannot be used, because there are two different Fields on input, not a single one as usual. I could create a single Field by merging the two Fields into a single one, but this would be like mixing potatoes with tomatoes and I don't want to make a soup. Is there any structure I could use ? Regards, Michaël
    4 replies
    Paulinakindermann
    @Paulinakindermann

    Hi,
    I am working on the estimation of a failure probability using Monte Carlo. I have quite a large amount of input variables and some are correlated. Therefore, I would like to create the joint distribution using a copula. The copula function takes the correlation matrix as input. As far as I know, the correlation matrix has to be created using ot.Correlation Matrix and you have to manually add the correlations like this: R[0,1] = 0.8 for example, which is a lot of work for a large amount of input variables and it makes me lose the overview .

    Is there a way to define the correlation matrix in e.g. a csv file instead and use this in ot.NormalCopula? If I try to load a csv file into an array, ot.NormalCopula does not recognize my correlation matrix.

    Thanks!

    3 replies
    Paulinakindermann
    @Paulinakindermann
    image.png

    Hi,

    Another question. I am trying to create the event whose probability I want to estimate, using ot.CompositeRandomVector(model,vector). I saw some examples using ot.SymbolicFunction for the model. However, my function is quite elaborate and also contains some variables without distributions, so I am looking for an easier way to define the model. I am trying to achieve this by defining the model as a regular python function:

    def Z_GEKB(Hm0,h,Tmm10,crest_height,alpha): Rc = crest_height - h #freeboard br = math.tan(alpha) / math.sqrt( (Hm0*2*np.pi) / (g*(Tmm10)**2) ) q = math.sqrt(g * (Hm0)**3) * ( (0.023/math.sqrt(math.tan(alpha))) * br * math.exp(-(2.7 * (Rc / (br*Hm0)))**(1.3)) ) return math.log10(m_c * q_c) - math.log10(m_a * q)

    vect = ot.RandomVector(jointdist) out = ot.CompositeRandomVector(Z_GEKB,vect)

    But then I get the error as sent above.

    6 replies
    christelle-git
    @christelle-git
    Hi everyone,
    is it possible to get the confidence level with the FunctionalChaosSobolIndices method ?
    5 replies
    josephmure
    @josephmure

    OpenTURNS now has a forum!

    This forum will allow us to discuss OpenTURNS in a more structured way, with threads dedicated to specific use cases, methods, or issues. More importantly, it will allow us to preserve discussions that would be lost on Gitter.

    As a bonus feature, the forum supports LaTeX. This should make mathematical discussions easier.

    1 reply
    Julien Schueller
    @jschueller
    christelle-git
    @christelle-git
    Hi, I've tried the box_behnken function to build a DOE and I notice that the output is formatted as float32, whereas with lhs method it is formatted as float64. As a consequence, when I try to dump it in json format I have an error that I tackle by converting box_behnken output with np.float64.
    Is there a reason why this output method is in float32 instead of float64 ? Thanks
    3 replies
    naybnet
    @Naybnet

    Hello all ! Wonderful to see that openturns has a chat !

    I am using the python module as a dependency of my analysis tool and I noticed migrating from version 1.12 to 1.15 that now Openturns requires X11-related dependencies (libX11, libSM in particular). As I want to package my tool using docker and do not need GUI related functionalities is there a way to use this library without those requirements ?

    5 replies
    fdeheeger
    @fdeheeger

    @jschueller
    Hello Sir, do you have a snippets somewhere to define quickly a ComposedDistribution...
    I keep falling back to me wanting to define it this way:

    domain = ot.ComposedDistribution({'R1': ot.Uniform(0.001,0.050),  
                                      'R2': ot.Uniform(0.001, 0.060),  
                                      'C10': ot.Uniform(0.02, 0.50)},
                      )

    Any advice to quickly define names ?

    1 reply
    Cédric Durantin
    @cdurantin
    Hello,
    I observed differences between openturns KrigingAlgorithm and DiceKriging (R) for trend coefficient estimation when covariance model is fixed. Is there any way to set the trend coefficient in the KrigingAlgorithm class ? I could then complete my comparison between the two softwares.
    Those coefficients are called beta in your documentation (https://openturns.github.io/openturns/latest/theory/meta_modeling/kriging.html#kriging). Once the regression basis is selected and the covariance model set, I should not observe differences with DiceKriging.
    3 replies
    Merlin Keller
    @merlinkeller_gitlab
    Hi to all! Is there an openturns module or class that supports functional outlier detection?
    4 replies
    Aurore Dupre
    @aur_dup_gitlab
    Hi all,
    I have a problem using KrigingAlgorithm trying to reproduce the following example: https://openturns.github.io/openturns/master/auto_meta_modeling/kriging_metamodel/plot_kriging.html
    I have an input design (x1 ~ N(0,1) and x2 ~ N(0,1)) and an output design (cos(x1 + x2)), I build the meta model using algo = ot.KrigingAlgorithm(inputDesign, outputDesign, covarianceModel, basis) where covarianceModel and basis are the same than in the example.
    However when I try to retrieve the marginals using : algo.BuildDistribution(inputDesign) I have the following error: AttributeError: type object 'object' has no attribute 'getattr'
    Note that it works if I use the FunctionalChaosAlgorithm.
    Many thanks in advance
    8 replies
    ChahrazedAmr
    @ChahrazedAmr
    Hello everyone, i am trying to reproduce this example https://openturns.github.io/openturns/latest/auto_reliability_sensitivity/design_of_experiments/plot_design_of_experiments.html?highlight=lhs but i am having this error "PlotDesign() missing 2 required positional arguments: 'Nx' and 'Ny'". Any help with that? Thanks
    4 replies
    isaacfradkin
    @isaacfradkin
    Hello. I'm trying to find the algorithm for computing rectangular probabilities in multivariate discrete distributions presented in: Lebrun. “Efficient Time/Space Algorithm to Compute Rectangular Probabilities of Multinomial, Multivariate Hypergeometric and Multivariate Pólya Distributions.” Stat. Comput. 23, no. 5 (2013): 615–23. https://doi.org/10.1007/s11222-012-9334-8.
    3 replies
    mohamed-808
    @mohamed-808
    please how can i couple between plaxis and openturns ?
    4 replies
    Ludovico
    @cottoncini
    Hi everyone!
    I'm trying to build a GaussProductExperiment with a composed distribution in which at least one of the marginals has size n=2, but the values for the corresponding components in the generated points are always +-nan. Is this expected behaviour?
    Please find a sample script below, with two different marginals of size 2 and a third one, of size 3, which gives the expected components; I'm using version 1.16. Thank you in advance.
    import openturns as ot
    d1 = ot.UserDefined(ot.Sample([[10], [20]]))
    d2 = ot.Bernoulli()
    d3 = ot.UserDefined(ot.Sample([[10], [100], [1000]]))
    dc = ot.ComposedDistribution([d1, d2, d3])
    print(ot.GaussProductExperiment(dc, [2, 2, 3]).generate())
         [ X0   X1   X2   ]
     0 : [  nan  nan   10 ]
     1 : [ -nan  nan   10 ]
     2 : [  nan -nan   10 ]
     3 : [ -nan -nan   10 ]
     4 : [  nan  nan  100 ]
     5 : [ -nan  nan  100 ]
     6 : [  nan -nan  100 ]
     7 : [ -nan -nan  100 ]
     8 : [  nan  nan 1000 ]
     9 : [ -nan  nan 1000 ]
    10 : [  nan -nan 1000 ]
    11 : [ -nan -nan 1000 ]
    8 replies
    mohamed-808
    @mohamed-808
    image.png
    please i want to perform a Reliability analysis using "form", but i want to use a data from another program "plaxis" instead of usecases from openturns library
    2 replies
    Michael Baudin
    @mbaudin47

    Hi!
    How to set the figure size with Viewer's options? I used the example from the doc, but the figure_kwargsoption has not effect:

    import openturns as ot
    import openturns.viewer as otv
    n = ot.Normal()
    graph = n.drawPDF()
    view = otv.View(graph, figure_kwargs = {"figsize": (400, 400)})

    This should create a gigantic figure. The option seems to be ignored.

    4 replies
    JPelamatti
    @JPelamatti
    Hello. Quick question, I have noticed that the getVariance() and getStandardDeviation() methods for a ot.Sample object return respectively an ot.Point and a 1x1 ot.TriangularMatrix, whereas according to the documentation both methods are (logically) supposed to return a point. Is that normal? Example below:
    2 replies
    image.png
    Michael Baudin
    @mbaudin47

    Hello ! Here is a script which creates a covariance matrix:

    import openturns as ot
    m = ot.SymmetricMatrix(3)
    m[0, 0] = 1.0e-02
    m[1, 1] = 1.0e-02
    m[2, 2] = 1.0e-02
    m[0, 1] = 7.0e-04
    ot.CovarianceMatrix(m)

    but generates: TypeError: InvalidArgumentException : The matrix is not symmetric, which cannot be true. More curious, the bug disappears when I insert print(m) just before the creation of the covariance matrix.
    This sounds like a memory leak, isn'it ?

    4 replies
    Kieran Delamotte
    @KieranDelamotte
    @mbaudin47
    I think there might be a missing checkSymmetry() somewhere instead. The print you add after your definition must trigger it and then the m matrix is correct for the CovarianceMatrix ctor.
    Michael Baudin
    @mbaudin47
    Thank you Kieran. I created the issue at: openturns/openturns#1787 to find a bugfix.
    orttak
    @orttak
    Hi, Can I save "openturns.metamodel.KrigingAlgorithm", "openturns.metamodel.KrigingResult" or "openturns.func.Function" for future processing? I create model to estimate weather condition at specific point and I want to save this model and use it.
    2 replies
    JPelamatti
    @JPelamatti
    Hello everyone, is there a method allowing to retrieve the GP model resulting from the use of EfficientGlobalOptimization? i.e., a KrigingResult object with the same parameters as the one provided to the optimization algorithm, but trained and conditioned with respect to both the initial data set and the infilled samples?
    Because I couldn't find any easy way to do so, and if it is indeed the case, I think that a ot.EfficientGlobalOptimization.getUpdatedKrigingResult() could be a useful addition to the class
    2 replies
    NicolasDelepine
    @NicolasDelepine
    Hi everyone, I have an other question regarding composed distribution (cf. my question of mars 2020). I would like to use a Bayes distribution (2D : parameters U_TI) in a composed distribution 5D ([U_TI,Hs,T,Dir]). I have an error because I mix 2D and 1D distribution. Is there a way to create a such distribution ? Many thanks in advance
    10 replies
    NicolasDelepine
    @NicolasDelepine
    Hi everyone, I have an other question regarding vonMises distribution. I would like to fit data with a such distribution. But I can't. For others distributions, I have already used ot.LogNormalFactory().build(data) or ot.WeibullFactory().build(data2), but it seems that the option is not available for vonMises.
    7 replies
    JPelamatti
    @JPelamatti
    Hello! Quick question, is there a way to extract and set the diagonal values of an ot.SquareMatrix object? I'm thinking about methods that would look something like getDiagonal() and setDiagonal(), which unfortunately do not exist (expect for the HMatrix class if I'm correct)
    1 reply
    nico nic
    @nico6744_gitlab
    Hi, I would like to use MCMC functionality. Do you have a simple example to illustrate it ? Many thanks in advance
    nico nic
    @nico6744_gitlab

    @nico6744_gitlab def make_model(x):
    a = pymc.Exponential('a', beta=x, value=0.5)

    @pymc.deterministic
    def b(a=a):
        return 100-a
    
    @pymc.stochastic
    def c(value=.5, a=a, b=b):
        return (value-a)**2/b
    
    return locals()

    M = pymc.MCMC(make_model(3))

    nico nic
    @nico6744_gitlab
    I would like to use an equivalent functionality as 'py.MCMC' (below, which is a deprecated python code), but i wonder if i can implement a refinement criteria in ot.MCMC.
    4 replies
    Michael Baudin
    @mbaudin47

    Hello!
    I just updated the project we use for PRACE training to OT1.16, but face an error because OpenTURNS cannot find ipopt:
    https://app.circleci.com/pipelines/github/mbaudin47/hpcuqtraining/90/workflows/f3e2f47f-2cb9-4e79-bb50-f3b5e2b8a16f/jobs/93

    import openturns as ot
    [...]
    ImportError: libipopt.so.3: cannot open shared object file: No such file or directory

    Do you have an advice? @jschueller: I saw that you maintained the ipopt conda package: you may see it more clearly than I.

    3 replies
    Simmeene
    @Simmeene

    Hello everyone!
    I'm writing my M.sc theses on uncertainty propagation and sensitivity analysis for a hydraulic model (finite element model). Totally new to both python and OT, but I've managed to do some things that I think will be useful.
    Because the hydraulic model i'm running is quite heavy I'm planning on doing some sort of polynomial chaos expansion. I emailed the professor Bruno Sudret as well, and he recommended using sparse polynomial expansion.
    1 . Do you all agree with this or would you recommend another method?

    I'm using the "Sobol’ sensitivity indices from chaos" eg. borehole example together with "Polynomial chaos is sensitive to the degree" when making my setup.

    I've managed to get good results with the examples. I've changed the sampling to sobol sequences, getting reasonable results for sobol indices, but when I look at the validation techniques in the examples they are based on creating new samples and doing additional model runs which I don't want. I've read a bit about Leave one out method but can't find any examples that use it for PCE.
    2 . Could that be an idea or are there other alternatives?

    Any help or advice would be much appreciated!
    Best regards //Simon

    4 replies
    vchabri
    @vchabri
    Hi everyone!
    Quick question about the ot.Sample object and its associated .sort() method. Is there any option to get a sorted sample in descending order instead of ascending one?
    I could'nt find such an option in the documentation, but maybe I'm wrong.
    Thanks a lot.
    3 replies
    efekhari27
    @efekhari27

    Hi everyone,

    I was wondering why the KrigingResults class doesn't provide an access to the Kriging variance function. The method getConditionalMarginalVariance() allows to compute the Kriging variance on various points but getting the function object could be interesting to use it for optimization purposes (as much as we get the predictor function using the getMetaModel() method). Of course, this is not or real lack since a Python function can easily wrap getConditionalMarginalVariance().

    Best,
    Elias

    2 replies
    Hi again,
    I was wondering if multiple cpus can be allocated to a SymbolicFunction(). It might sound useless since the main advantage of this analytical function is to be very quick. However, to get a reference value of a complicated toy-case, a large Monte Carlo simulation is often performed (order of 10^9). In this case, having a parallel SymbolicFunction() would save some time.
    Best, Elias
    5 replies
    efekhari27
    @efekhari27
    Sorry I have a third question,
    I tried the SimulatedAnneling() algorithm to optimize a LHS Design of Experiment based on a Normal distribution. I first used the L2-centered discrepancy (SpaceFillingC2()) as criterion and wanted to try using the minimum distance between the DoE points (SpaceFillingMinDist()). By simply replacing SpaceFillingC2() by SpaceFillingMinDist(), I get a bad DoE since the SimulatedAnneling() is a mimization problem while the SpaceFillingMinDist() criterion needs to be maximized. Is there a way to use the SpaceFillingMinDist() with SimulatedAnneling()?
    Best, Elias
    3 replies
    JPelamatti
    @JPelamatti
    Hello everyone,
    While playing a bit around with the PythonFunction class, I noticed that a user defined gradient function can only be provided by the user in the object constructor under the form of a standard python function, as this cannot be done later on with the setGradient accessor. Indeed, setGradient only seems to accept as input a GradientImplementation object, which I think can only be obtained through a getGradient accessor or by relying on finite difference gradients.
    Do you think that modifying the setGradient accessor so that it can accept a standard python function could be a useful and coherent enhancement of the class?
    Example:
    def mySimulator(x):
        y0 = 1. - x[0] * x[1]
        y = [y0]
        return y
    
    def myGradient(x):
        dy0dx0 = 0.123
        dy0dx1 = 0.321
        gradient = ot.Matrix([[dy0dx0],[dy0dx1]])
        return gradient
    
    # Defining the gradient in the constructor
    f = ot.PythonFunction(2,1,mySimulator,gradient=myGradient)
    print(f.gradient([0,0]))
    # Output: [[ 0.123 ] [ 0.321 ]]
    
    # Defining the gradient after the construction
    f = ot.PythonFunction(2,1,mySimulator)
    f.setGradient(myGradient)
    #output: TypeError: Object passed as argument is not convertible to a Gradient
    2 replies