On Mon, Jan 12, 2009 at 2:37 PM, Sébastien Morin <sebastien.morin.1@xxxxxxxxx> wrote:
Hi, I am now planning to implement the code for calculating R2eff from peak intensities before passing R2eff values to the curve fitting code... I thought of a function like: ================= def calc_r2eff(self, exp_type='cpmg', id=None, delayT=None, int_cpmg=0, int_ref=0): """Calculate the effective transversal relaxation rate from the peak intensities. The equation depends on the experiment type chosen, either 'cpmg' or 'r1rho'. If 'cpmg' is chosen, the equation used is: r2eff = - ( 1 / delayT ) * log ( int_cpmg / int_ref ) If 'r1rho' is chosen, nothing happens yet, as the code is not implemented. """ if exp_type == 'cpmg': r2eff = - ( 1 / delayT ) * log ( int_cpmg / int_ref ) return r2eff =================
This design looks good. It's implementation will be a bit tricky though and will require much thought, as you'll find out ;)
I would put this one in 'specific_fns'. However, I am still not sure about how this function should be called.
Yep, it should be a method of the Relax_disp object.
The function should be called after data input (also after using exp_type() and cpmg_delayT()), and before any curve fitting. This function should be called for every spin (in a loop), for every experiment id (in a loop, which would include different spectrometer frequencies as well as different cpmg_delayT, if present). Is that a good approach ? Is there something important I forget ?
It should be called only when required. This is at the very start of Relax_disp.calc(), Relax_disp.back_calc(), Relax_disp.grid_search(), and Relax_disp.minimise(). Alternatively you could create a new user function, something like relax_disp.calc_r2eff(). It will need careful checks to make sure all the required data is input into relax. Regards, Edward