mailRe: Is there a way to clear the Monte Carlo simulation data key?


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on August 28, 2014 - 11:35:
Hi,

Maybe you should consider adding this to the monte_carlo.setup user
function?  Is the problem that you cannot run Monte Carlo simulations
twice with a different number of simulations?  This should really be
handled by monte_carlo.setup.

Regards,

Edward



On 28 August 2014 11:25, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Allright, I found a fix.


# Make Carlo Simulations number
mc_number_list = range(5, 100, 20)

sim_attr_list = ['chi2_sim', 'f_count_sim', 'g_count_sim',
'h_count_sim', 'i0_sim', 'iter_sim', 'peak_intensity_sim',
'r2eff_sim', 'select_sim', 'warning_sim']

# Loop over the Monte Carlo simulations:
for number in mc_number_list:
    # First delete old simulations.
    for cur_spin, mol_name, resi, resn, spin_id in
spin_loop(full_info=True, return_id=True, skip_desel=True):
        # Loop over the simulated attributes.
        for sim_attr in sim_attr_list:
            if hasattr(cur_spin, sim_attr):
                delattr(cur_spin, sim_attr)

    self.interpreter.monte_carlo.setup(number=number)
    self.interpreter.monte_carlo.create_data()
    self.interpreter.monte_carlo.initial_values()
    self.interpreter.minimise.execute(min_algor=min_algor,
constraints=constraints)
    self.interpreter.eliminate()
    self.interpreter.monte_carlo.error_analysis()

    est_key = 'mc_%s'%number
    est_keys.append(est_key)

    # Collect data.
    for cur_spin, mol_name, resi, resn, spin_id in
spin_loop(full_info=True, return_id=True, skip_desel=True):
        # Add key for estimate.
        my_dic[spin_id][est_key] = {}

        for exp_type, frq, offset, point, ei, mi, oi, di in
loop_exp_frq_offset_point(return_indices=True):
            # Generate the param_key.
            param_key = return_param_key_from_data(exp_type=exp_type,
frq=frq, offset=offset, point=point)

            # Add key to dic.
            my_dic[spin_id][est_key][param_key] = {}

            # Get the value.
            r2eff = getattr(cur_spin, 'r2eff')[param_key]
            r2eff_err = getattr(cur_spin, 'r2eff_err')[param_key]
            i0 = getattr(cur_spin, 'i0')[param_key]
            i0_err = getattr(cur_spin, 'i0_err')[param_key]

            # Save to dic.
            my_dic[spin_id][est_key][param_key]['r2eff'] = r2eff
            my_dic[spin_id][est_key][param_key]['r2eff_err'] = r2eff_err
            my_dic[spin_id][est_key][param_key]['i0'] = i0
            my_dic[spin_id][est_key][param_key]['i0_err'] = i0_err

2014-08-28 11:20 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,

Could you describe a situation that covers this?  What do you mean by
the Monte Carlo simulation data key?  In the data pipe and spin
containers, the Monte Carlo simulation optimisation results are
usually stored in the "*_sim" data structures as lists, and the errors
from the simulations in the "*_err" data structures which are simple
floats.  But this is dependent on the analysis and data type - some
model parameters can be single values, lists of values, or
dictionaries of values, and this is preserved in the Monte Carlo
simulation structures as well.

Regards,

Edward


On 28 August 2014 11:14, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> 
wrote:
Dear Edward.

Is there a way to clear the Monte Carlo simulation data key?

I try to run some data with increasing number of Monte Carlo simulations.

Thank you.
Best
Troels

_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-users mailing list
relax-users@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-users



Related Messages


Powered by MHonArc, Updated Thu Aug 28 11:40:16 2014