Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2006 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax. # 6 # # 7 # relax is free software; you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation; either version 2 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # relax is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with relax; if not, write to the Free Software # 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 20 # # 21 ############################################################################### 22 2329 3014432 """Function for duplicating data.""" 33 34 # Test that the new run exists. 35 if not new_run in self.relax.data.run_names: 36 raise RelaxNoRunError, new_run 37 38 # Test that the old run exists. 39 if not old_run in self.relax.data.run_names: 40 raise RelaxNoRunError, old_run 41 42 # Test that the new run has no sequence loaded. 43 if self.relax.data.res.has_key(new_run): 44 raise RelaxSequenceError, new_run 45 46 # Reset the new run type to hybrid! 47 self.relax.data.run_types[self.relax.data.run_names.index(new_run)] = 'hybrid' 48 49 # Duplicate the hybrid run data structure. 50 self.relax.data.hybrid_runs[new_run] = self.relax.data.hybrid_runs[old_run]51 5254 """Function for creating the hybrid run.""" 55 56 # Test if the hybrid run already exists. 57 if hybrid in self.relax.data.run_names: 58 raise RelaxRunError, hybrid 59 60 # Loop over the runs to be hybridised. 61 for run in runs: 62 # Test if the run exists. 63 if not run in self.relax.data.run_names: 64 raise RelaxNoRunError, run 65 66 # Test if sequence data is loaded. 67 if not self.relax.data.res.has_key(run): 68 raise RelaxNoSequenceError, run 69 70 # Check the sequence. 71 for i in xrange(len(self.relax.data.res[runs[0]])): 72 # Reassign the data structure. 73 data1 = self.relax.data.res[runs[0]][i] 74 75 # Loop over the rest of the runs. 76 for run in runs[1:]: 77 # Reassign the data structure. 78 data2 = self.relax.data.res[run][i] 79 80 # Test if the sequence is the same. 81 if data1.name != data2.name or data1.num != data2.num: 82 raise RelaxError, "The residues '" + data1.name + " " + `data1.num` + "' of the run " + `runs[0]` + " and '" + data2.name + " " + `data2.num` + "' of the run " + `run` + " are not the same." 83 84 # Add the run and type to the runs list. 85 self.relax.data.run_names.append(hybrid) 86 self.relax.data.run_types.append('hybrid') 87 88 # Create the data structure of the runs which form the hybrid. 89 self.relax.data.hybrid_runs[hybrid] = runs90 9193 """Function for returning the values k, n, and chi2 of the hybrid. 94 95 k - number of parameters. 96 n - number of data points. 97 chi2 - the chi-squared value. 98 """ 99 100 # Arguments. 101 self.run = run 102 103 # Initialise. 104 k_total = 0 105 n_total = 0 106 chi2_total = 0.0 107 108 # Specific setup. 109 for run in self.relax.data.hybrid_runs[self.run]: 110 # Function type. 111 function_type = self.relax.data.run_types[self.relax.data.run_names.index(run)] 112 113 # Specific model statistics and number of instances functions. 114 model_statistics = self.relax.specific_setup.setup('model_stats', function_type) 115 116 # Loop over the instances. 117 for i in xrange(num): 118 # Get the statistics. 119 k, n, chi2 = model_statistics(run, instance=i, global_stats=global_stats) 120 121 # Bad stats. 122 if k == None or n == None or chi2 == None: 123 continue 124 125 # Sum the stats. 126 k_total = k_total + k 127 n_total = n_total + n 128 chi2_total = chi2_total + chi2 129 130 # Return the totals. 131 return k_total, n_total, chi2_total132 133135 """Function for returning the number of instances, which for hybrids is always 1.""" 136 137 return 1138 139
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 14:04:18 2013 | http://epydoc.sourceforge.net |