Hi all,

The getWeights() method will be deprecated. You should use the 
generateWithWeights() method to get the points and the weights. Nevertheless, 
the attached script works well using both generate() then getWeights() or 
generateWithWeights() with OT 1.7

Regards,

Régis


----- Mail original -----
> De : BLATMAN Geraud <[email protected]>
> À : "[email protected]" <[email protected]>
> Cc : "[email protected]" <[email protected]>
> Envoyé le : Mercredi 15 juin 2016 17h30
> Objet : Re: [ot-users] OpenTURNS - How to get the weights of a quadrature 
> rule?
> 
> Hi Denis,
> 
> Unfortunately this does not change the results... I have also tried : myExp. 
> generateWithWeights(), but the returned weights are still constant and equal 
> to 
> 1/N.
> 
>   
> 
> 
> Geraud BLATMAN
> Ingénieur-chercheur
> EDF - R&D
> Matériaux et Mécanique des Composants
> Groupe T24 - Équipe Études Probabilistes
> EDF Lab Les Renardières - Écuelles
> 77818 Moret-Sur-Loing Cedex
> 
> [email protected]
> Tél. : 01 60 73 70 39
> 
> 
> -----Message d'origine-----
> De : [email protected] [mailto:[email protected]] 
> Envoyé : mercredi 15 juin 2016 17:14
> À : BLATMAN Geraud
> Cc : [email protected]
> Objet : Re: [ot-users] OpenTURNS - How to get the weights of a quadrature 
> rule?
> 
> On 2016-06-15 11:38 GMT+02:00 BLATMAN Geraud wrote:
>> 
>>  Dear users,
>> 
>>  I am wondering how to obtain the weights related to a Gauss quadrature rule 
> in OpenTURNS. These weights should be computed somewhere since Gauss 
> quadrature 
> can be used to estimate the coefficients of a polynomial chaos expansion, as 
> shown by the following commands taken from the Use Cases Guide (Section 
> 4.3.4) :
>> 
>>  >>> marginalDegrees = [2] * dim
>>  >>> evaluationCoeffStrategy_3 = IntegrationStrategy(    
> GaussProductExperiment(distributionMu, marginalDegrees))
>> 
>>  So I have tried to retrieve the weights from the ‘GaussProductExperiment’ 
> object as follows :
>> 
>>  >>> myExp = GaussProductExperiment(distributionMu, 
> marginalDegrees) 
>>  >>> weights = myExp.getWeight()
>> 
>>  However I always get weights all equal to 1/N (N being the sample size), 
> whatever the distribution (parameter ‘distributionMu’). For instance, if this 
> distribution is a collection of independent uniform variables over [-1,1], I 
> would rather expect the well-known Gauss-Legendre quadrature weights.
>> 
>>  Any ideas ?
> 
> Hello, it seems that weights are computed only after myExp.generate() is 
> being 
> called.  This is annoying, but not trivial to fix.
> 
> Denis
> 
> 
> 
> Ce message et toutes les pièces jointes (ci-après le 'Message') sont 
> établis à l'intention exclusive des destinataires et les informations qui y 
> figurent sont strictement confidentielles. Toute utilisation de ce Message 
> non 
> conforme à sa destination, toute diffusion ou toute publication totale ou 
> partielle, est interdite sauf autorisation expresse.
> 
> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le 
> copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. 
> Si vous avez reçu ce Message par erreur, merci de le supprimer de votre 
> système, 
> ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque 
> support que ce soit. Nous vous remercions également d'en avertir 
> immédiatement l'expéditeur par retour du message.
> 
> Il est impossible de garantir que les communications par messagerie 
> électronique 
> arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
> ____________________________________________________
> 
> This message and any attachments (the 'Message') are intended solely for 
> the addressees. The information contained in this Message is confidential. 
> Any 
> use of information contained in this Message not in accord with its purpose, 
> any 
> dissemination or disclosure, either whole or partial, is prohibited except 
> formal approval.
> 
> If you are not the addressee, you may not copy, forward, disclose or use any 
> part of it. If you have received this message in error, please delete it and 
> all 
> copies from your system and notify the sender immediately by return message.
> 
> E-mail communication cannot be guaranteed to be timely secure, error or 
> virus-free.
> 
> _______________________________________________
> OpenTURNS users mailing list
> [email protected]
> http://openturns.org/mailman/listinfo/users
>
import openturns as ot
distribution = ot.ComposedDistribution([ot.Exponential(), ot.Triangular(-1.0, -0.5, 1.0)])
marginalDegrees = [3, 2]
myPlane = ot.GaussProductExperiment(distribution, marginalDegrees)

print "sample=", myPlane.generate()
print "weights=", myPlane.getWeight()

sample, weights = myPlane.generateWithWeights()

print "sample=", sample
print "weights=", weights
sample=     [ marginal_1_marginal 1 marginal_2_marginal 1 ]
0 : [  0.415775             -0.511215             ]
1 : [  2.29428              -0.511215             ]
2 : [  6.28995              -0.511215             ]
3 : [  0.415775              0.357369             ]
4 : [  2.29428               0.357369             ]
5 : [  6.28995               0.357369             ]
weights= [0.429018,0.168036,0.00626806,0.282075,0.110482,0.00412119]
sample=     [ marginal_1_marginal 1 marginal_2_marginal 1 ]
0 : [  0.415775             -0.511215             ]
1 : [  2.29428              -0.511215             ]
2 : [  6.28995              -0.511215             ]
3 : [  0.415775              0.357369             ]
4 : [  2.29428               0.357369             ]
5 : [  6.28995               0.357369             ]
weights= [0.429018,0.168036,0.00626806,0.282075,0.110482,0.00412119]
_______________________________________________
OpenTURNS users mailing list
[email protected]
http://openturns.org/mailman/listinfo/users

Reply via email to