Module bootstrap
[hide private]
[frames] | no frames]

Source Code for Module bootstrap

 1  # A method based on model selection using bootstrap criteria. 
 2  # 
 3  # The Kullback-Leibeler discrepancy is used. 
 4  # 
 5  # The program is divided into the following stages: 
 6  #       Stage 1:  Creation of the files for the model-free calculations for models 1 to 5.  Monte Carlo 
 7  #               simulations are used, but the initial data rather than the backcalculated data is randomized. 
 8  #       Stage 2:  Model selection and the creation of the final run.  Monte Carlo simulations are used to 
 9  #               find errors.  This stage has the option of optimizing the diffusion tensor along with the 
10  #               model-free parameters. 
11  #       Stage 3:  Extraction of the data. 
12   
13  from re import match 
14   
15  from common_ops import common_operations 
16   
17   
18 -class bootstrap(common_operations):
19 - def __init__(self, mf):
20 "Model-free analysis based on bootstrap model selection." 21 22 self.mf = mf 23 24 print "Model-free analysis based on bootstrap model selection." 25 self.initialize() 26 self.mf.data.runs = ['m1', 'm2', 'm3', 'm4', 'm5'] 27 self.goto_stage()
28
29 - def initial_runs(self):
30 "Creation of the files for the Modelfree calculations for models 1 to 5." 31 32 for run in self.mf.data.runs: 33 print "Creating input files for model " + run 34 self.mf.log.write("\n\n<<< Model " + run + " >>>\n\n") 35 self.mf.file_ops.mkdir(dir=run) 36 self.mf.file_ops.open_mf_files(dir=run) 37 self.set_run_flags(run) 38 self.log_params('M1', self.mf.data.usr_param.md1) 39 self.log_params('M2', self.mf.data.usr_param.md2) 40 self.create_mfin(sims='y', sim_type='expr') 41 self.create_run(dir=run) 42 for res in range(len(self.mf.data.relax_data[0])): 43 # Mfdata. 44 self.create_mfdata(res) 45 # Mfmodel. 46 self.create_mfmodel(res, self.mf.data.usr_param.md1, type='M1') 47 # Mfpar. 48 self.create_mfpar(res) 49 self.mf.file_ops.close_mf_files(dir=run)
50