@@ -143,29 +143,6 @@ def set_samples(self, samples):
143143 'have wrong dimension' )
144144
145145 self .samples = samples
146- self .set_weights ()
147-
148- def set_weights (self ):
149- """Sets weights based on assigned samples.
150- """
151- if self .samples is None :
152- raise RuntimeError ("PCE weights cannot be set unless samples are set first." "" )
153-
154- if self .sampling .lower () == 'greedy-induced' :
155- self .weights = self .christoffel_weights ()
156- elif self .sampling .lower () == 'gq' :
157- M = self .sampling_options .get ('M' )
158- if M is None :
159- raise ValueError ("The sampling option 'M' must be specified for Gauss quadrature sampling." )
160-
161- _ , self .weights = self .distribution .polys .tensor_gauss_quadrature (M )
162-
163- elif self .sampling .lower () == 'gq-induced' :
164- self .weights = self .christoffel_weights ()
165-
166- else :
167- raise ValueError ("Unsupported sample type '{0}' for input\
168- sample_type" .format (self .sampling ))
169146
170147 def map_to_standard_space (self , q ):
171148 """Maps parameter values from model space to standard space.
@@ -234,6 +211,8 @@ def generate_samples(self, **kwargs):
234211
235212 self .samples = self .map_to_model_space (x )
236213
214+ self .weights = self .christoffel_weights ()
215+
237216 elif self .sampling .lower () == 'gq' :
238217
239218 M = self .sampling_options .get ('M' )
@@ -242,9 +221,7 @@ def generate_samples(self, **kwargs):
242221
243222 p_standard , w = self .distribution .polys .tensor_gauss_quadrature (M )
244223 self .samples = self .map_to_model_space (p_standard )
245- # We do the following in the call to self.set_weights() below. A
246- # little more expensive, but makes for more transparent control structure.
247- #self.weights = w
224+ self .weights = w
248225
249226 elif self .sampling .lower () == 'gq-induced' :
250227
@@ -255,13 +232,12 @@ def generate_samples(self, **kwargs):
255232 p_standard = self .distribution .opolys .idist_gq_sampling (K , self .indices , M = self .sampling_options .get ('M' ))
256233
257234 self .samples = self .map_to_model_space (p_standard )
235+ self .weights = self .christoffel_weights ()
258236
259237 else :
260238 raise ValueError ("Unsupported sample type '{0}' for input\
261239 sample_type" .format (self .sampling ))
262240
263- self .set_weights ()
264-
265241 def integration_weights (self ):
266242 """
267243 Generates sample weights associated to integration."
0 commit comments