Author: tlinnet Date: Tue Jan 20 12:02:10 2015 New Revision: 27225 URL: http://svn.gna.org/viewcvs/relax?rev=27225&view=rev Log: Extended the user function 'monte_carlo.create_data', to allow for the defition of the STD to use in gauss distribution. This is for creation of Monte-Carlo simulations, where one has perhaps gained information about the expected errors of the datapoints, which is not measured. Task #7882 (https://gna.org/task/?7882): Implement Monte-Carlo simulation, where errors are generated with width of standard deviation or residuals.): Implement Monte-Carlo simulation, where errors are generated with width of standard deviation or residuals. Modified: trunk/user_functions/monte_carlo.py Modified: trunk/user_functions/monte_carlo.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/monte_carlo.py?rev=27225&r1=27224&r2=27225&view=diff ============================================================================== --- trunk/user_functions/monte_carlo.py (original) +++ trunk/user_functions/monte_carlo.py Tue Jan 20 12:02:10 2015 @@ -87,16 +87,24 @@ desc_short = "distribution", desc = "The error distribution method.", wiz_element_type = "combo", - wiz_combo_choices = ["Measured error", "Reduced chi2"], - wiz_combo_data = ["measured", "red_chi2"], + wiz_combo_choices = ["Measured error", "Reduced chi2", "Fixed error"], + wiz_combo_data = ["measured", "red_chi2", "fixed"], wiz_read_only = True +) +uf.add_keyarg( + name = "fixed_error", + py_type = "float", + default = None, + desc_short = "fixed error value for fixed error distribution.", + desc = "The fixed value to use when distribution is set to 'fixed'.", + can_be_none = True ) # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("The method can either be set to back calculation (Monte Carlo) or direct (bootstrapping), the choice of which determines the simulation type. If the values or parameters are calculated rather than minimised, this option will have no effect. Errors should only be propagated via Monte Carlo simulations if errors have been measured. ") uf.desc[-1].add_paragraph("For error analysis, the method should be set to back calculation which will result in proper Monte Carlo simulations. The data used for each simulation is back calculated from the minimised model parameters and is randomised using Gaussian noise where the standard deviation is from the original error set. When the method is set to back calculation, this function should only be called after the model is fully minimised.") uf.desc[-1].add_paragraph("The simulation type can be changed by setting the method to direct. This will result in bootstrapping simulations which cannot be used in error analysis (and which are no longer Monte Carlo simulations). However, these simulations are required for certain model selection techniques (see the documentation for the model selection user function for details), and can be used for other purposes. Rather than the data being back calculated from the fitted model parameters, the data is generated by taking the original data and randomising using Gaussian noise with the standard deviations set to the original error set.") -uf.desc[-1].add_paragraph("The errors generated per simulation can either be generated indidual per datapoint and drawn from a gauss distrubtion described by the STD of the indidual point, or it can be generated from a overall gauss distribution described by the STD_fit of the goodness of fit, where STD_fit = sqrt(chi2/(N-p)).") +uf.desc[-1].add_paragraph("The errors generated per simulation can either be generated indidual per datapoint and drawn from a gauss distrubtion described by the STD of the indidual point, or it can be generated from a overall gauss distribution described by the STD_fit of the goodness of fit, where STD_fit = sqrt(chi2/(N-p)). The last possibility is to supply a fixed value of STD, from which gauss distribution to draw errors from.") uf.desc.append(monte_carlo_desc) uf.backend = error_analysis.monte_carlo_create_data uf.menu_text = "&create_data"