Author: bugman Date: Wed Mar 10 17:33:53 2010 New Revision: 10963 URL: http://svn.gna.org/viewcvs/relax?rev=10963&view=rev Log: Shifted the model-free _back_calc() method into the analysis specific API as back_calc_ri(). This is now being called by the relax_data.back_calc() user function. Modified: 1.3/generic_fns/relax_data.py 1.3/specific_fns/api_base.py 1.3/specific_fns/model_free/main.py Modified: 1.3/generic_fns/relax_data.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/relax_data.py?rev=10963&r1=10962&r2=10963&view=diff ============================================================================== --- 1.3/generic_fns/relax_data.py (original) +++ 1.3/generic_fns/relax_data.py Wed Mar 10 17:33:53 2010 @@ -180,20 +180,23 @@ # Global data flag. global_flag = 0 - # Specific back-calculate function setup. - back_calculate = specific_fns.setup.get_specific_fn('back_calc', pipes.get_type()) + # Specific Ri back-calculate function setup. + back_calculate = specific_fns.setup.get_specific_fn('back_calc_ri', pipes.get_type()) # Loop over the spins. - for spin in spin_loop(): + for spin, spin_id in spin_loop(return_id=True): # Skip deselected spins. if not spin.select: continue + # The global index. + spin_index = find_index(spin_id) + # Initialise all data structures. update_data_structures_spin(spin, ri_label, frq_label, frq) # Back-calculate the relaxation value. - value = back_calculate(spin=spin, ri_label=ri_label, frq_label=frq_label, frq=frq) + value = back_calculate(spin=spin_index, ri_label=ri_label, frq_label=frq_label, frq=frq) # Update all data structures. update_data_structures_spin(spin, ri_label, frq_label, frq, value) Modified: 1.3/specific_fns/api_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/api_base.py?rev=10963&r1=10962&r2=10963&view=diff ============================================================================== --- 1.3/specific_fns/api_base.py (original) +++ 1.3/specific_fns/api_base.py Wed Mar 10 17:33:53 2010 @@ -33,6 +33,25 @@ All the methods here are prototype methods. To identify that the method is not available for certain analysis types, if called a RelaxImplementError is raised if called. """ + + def back_calc_ri(self, spin_index=None, ri_label=None, frq_label=None, frq=None): + """Back-calculation of relaxation data from the model-free parameter values. + + @keyword spin_index: The global spin index. + @type spin_index: int + @keyword ri_label: The relaxation data type, i.e. 'R1', 'R2', or 'NOE'. + @type ri_label: str + @keyword frq_label: The field strength label. + @type frq_label: str + @keyword frq: The field strength. + @type frq: float + @return: The back calculated relaxation data value corresponding to the index. + @rtype: float + """ + + # Not implemented. + raise RelaxImplementError + def base_data_loop(self): """Generator method for looping over the base data of the specific analysis type. Modified: 1.3/specific_fns/model_free/main.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/main.py?rev=10963&r1=10962&r2=10963&view=diff ============================================================================== --- 1.3/specific_fns/model_free/main.py (original) +++ 1.3/specific_fns/model_free/main.py Wed Mar 10 17:33:53 2010 @@ -430,23 +430,23 @@ return scaling_matrix - def _back_calc(self, index=None, ri_label=None, frq_label=None, frq=None): + def back_calc_ri(self, spin_index=None, ri_label=None, frq_label=None, frq=None): """Back-calculation of relaxation data from the model-free parameter values. - @keyword index: The relaxation data index. - @type index: int - @keyword ri_label: The relaxation data type, i.e. 'R1', 'R2', or 'NOE'. - @type ri_label: str - @keyword frq_label: The field strength label. - @type frq_label: str - @keyword frq: The field strength. - @type frq: float - @return: The back calculated relaxation data value corresponding to the index. - @rtype: float + @keyword spin_index: The global spin index. + @type spin_index: int + @keyword ri_label: The relaxation data type, i.e. 'R1', 'R2', or 'NOE'. + @type ri_label: str + @keyword frq_label: The field strength label. + @type frq_label: str + @keyword frq: The field strength. + @type frq: float + @return: The back calculated relaxation data value corresponding to the index. + @rtype: float """ # Get the relaxation value from the minimise function. - value = self.minimise(min_algor='back_calc', min_options=(index, ri_label, frq_label, frq)) + value = self.minimise(min_algor='back_calc', min_options=(spin_index, ri_label, frq_label, frq)) # Return the relaxation value. return value @@ -1164,7 +1164,7 @@ # Loop over the relaxation data. for j in xrange(len(spin.relax_data)): # Back calculate the value. - value = self._back_calc(index=global_index, ri_label=spin.ri_labels[j], frq_label=spin.frq_labels[spin.remap_table[j]], frq=spin.frq[spin.remap_table[j]]) + value = self.back_calc_ri(spin_index=global_index, ri_label=spin.ri_labels[j], frq_label=spin.frq_labels[spin.remap_table[j]], frq=spin.frq[spin.remap_table[j]]) # Append the value. mc_data.append(value)