def check_scatter_2D(self, sample_nos, p_ref, save): """ Check to see that the :meth:`bet.postTools.plotDomains.scatter_2D` ran without generating an error. """ try: plotDomains.scatter_2D(self.samples[:, [0, 1]], sample_nos, self.P_samples, p_ref, save, False, 'XLABEL', 'YLABEL', self.filename) go = True except (RuntimeError, TypeError, NameError): go = False nptest.assert_equal(go, True)
def check_scatter_2D(self, sample_nos, p_ref, save): """ Check to see that the :meth:`bet.postTools.plotDomains.scatter_2D` ran without generating an error. """ try: input_sample_set_temp = sample.sample_set(2) input_sample_set_temp.set_values( self.disc._input_sample_set.get_values()[:, [0, 1]]) plotDomains.scatter_2D( input_sample_set_temp, sample_nos, self.disc._input_sample_set.get_probabilities(), p_ref, save, False, 'XLABEL', 'YLABEL', self.filename) go = True except (RuntimeError, TypeError, NameError): go = False nptest.assert_equal(go, True)
def check_scatter_2D(self, sample_nos, p_ref, save): """ Check to see that the :meth:`bet.postTools.plotDomains.scatter_2D` ran without generating an error. """ try: input_sample_set_temp = sample.sample_set(2) input_sample_set_temp.set_values(self.disc._input_sample_set.get_values()[:, [0, 1]]) plotDomains.scatter_2D( input_sample_set_temp, sample_nos, self.disc._input_sample_set.get_probabilities(), p_ref, save, False, 'XLABEL', 'YLABEL', self.filename) go = True except (RuntimeError, TypeError, NameError): go = False nptest.assert_equal(go, True)
num_samples=num_iid_samples) # Compute the simple function approximation to the distribution on the data space simpleFunP.user_partition_user_distribution(my_discretization, Partition_discretization, Monte_Carlo_discretization) # Calculate probabilities calculateP.prob(my_discretization) ######################################## # Post-process the results (optional) ######################################## # Show some plots of the different sample sets plotD.scatter_2D(my_discretization._input_sample_set, filename = 'Parameter_Samples', file_extension = '.eps') plotD.scatter_2D(my_discretization._output_sample_set, filename = 'QoI_Samples', file_extension = '.eps') plotD.scatter_2D(my_discretization._output_probability_set, filename = 'Data_Space_Discretization', file_extension = '.eps') ''' Suggested changes for user: At this point, the only thing that should change in the plotP.* inputs should be either the nbins values or sigma (which influences the kernel density estimation with smaller values implying a density estimate that looks more like a histogram and larger values smoothing out the values more).
''' Suggested changes for user: Try different reference parameters. ''' # Define the reference parameter param_ref = np.array([5.5, 4.5]) #param_ref = np.array([4.5, 3.0]) #param_ref = np.array([3.5, 1.5]) # Compute the reference QoI Q_ref = my_model(param_ref) # Create some plots of input and output discretizations plotD.scatter_2D(input_samples, ref_sample=param_ref, filename='nonlinearMapParameterSamples', file_extension='.eps') if Q_ref.size == 2: plotD.show_data_domain_2D(my_discretization, Q_ref=Q_ref, file_extension=".eps") ''' Suggested changes for user: Try different ways of discretizing the probability measure on D defined as a uniform probability measure on a rectangle or interval depending on choice of QoI_num in myModel.py. ''' randomDataDiscretization = False if randomDataDiscretization is False: simpleFunP.regular_partition_uniform_distribution_rectangle_scaled(
''' Suggested changes for user: Try different reference parameters. ''' # Define the reference parameter #param_ref = np.zeros((1,num_KL_terms)) param_ref = np.ones((1, num_KL_terms)) # Compute the reference QoI Q_ref = my_model(param_ref) # Create some plots of input and output discretizations if num_KL_terms == 2: plotD.scatter_2D(input_samples, ref_sample=param_ref[0, :], filename='FEniCS_ParameterSamples', file_extension='.eps') if Q_ref.size == 2: plotD.show_data_domain_2D(my_discretization, Q_ref=Q_ref[0, :], file_extension=".eps") ''' Suggested changes for user: Try different ways of discretizing the probability measure on D defined as a uniform probability measure on a rectangle or interval depending on choice of QoI_num in myModel.py. ''' randomDataDiscretization = False if randomDataDiscretization is False: simpleFunP.regular_partition_uniform_distribution_rectangle_scaled(
input_samples, savefile='FEniCS_Example.txt.gz') ''' Suggested changes for user: Try different reference parameters. ''' # Define the reference parameter #param_ref = np.zeros((1,num_KL_terms)) param_ref = np.ones((1,num_KL_terms)) # Compute the reference QoI Q_ref = my_model(param_ref) # Create some plots of input and output discretizations plotD.scatter_2D(input_samples, ref_sample=param_ref[0,:], filename='FEniCS_ParameterSamples.eps') if Q_ref.size == 2: plotD.show_data_domain_2D(my_discretization, Q_ref=Q_ref[0,:], file_extension="eps") ''' Suggested changes for user: Try different ways of discretizing the probability measure on D defined as a uniform probability measure on a rectangle or interval depending on choice of QoI_num in myModel.py. ''' randomDataDiscretization = False if randomDataDiscretization is False: simpleFunP.regular_partition_uniform_distribution_rectangle_scaled( data_set=my_discretization, Q_ref=Q_ref[0,:], rect_scale=0.1,
''' Suggested changes for user: Try different reference parameters. ''' # Define the reference parameter param_ref = np.array([5.5, 4.5]) #param_ref = np.array([4.5, 3.0]) #param_ref = np.array([3.5, 1.5]) # Compute the reference QoI Q_ref = my_model(param_ref) # Create some plots of input and output discretizations plotD.scatter_2D(input_samples, ref_sample = param_ref, filename = 'nonlinearMapParameterSamples', file_extension='.eps') if Q_ref.size == 2: plotD.show_data_domain_2D(my_discretization, Q_ref = Q_ref, file_extension=".eps") ''' Suggested changes for user: Try different ways of discretizing the probability measure on D defined as a uniform probability measure on a rectangle or interval depending on choice of QoI_num in myModel.py. ''' randomDataDiscretization = False if randomDataDiscretization is False: simpleFunP.regular_partition_uniform_distribution_rectangle_scaled( data_set=my_discretization, Q_ref=Q_ref, rect_scale=0.25,