Hi, If you think this is sufficient, then that's ok. Otherwise system tests such as Relax_disp.test_tp02_data_to_tp02 could be duplicated and the model changed.
Regards, Edward On 18 August 2014 12:39, Troels Emtekær Linnet <[email protected]> wrote: > Hi Edward. > > Currently only one system test is covering them. > > On 18 Aug 2014 12:17, "Edward d'Auvergne" <[email protected]> wrote: >> >> Hi Troels, >> >> Are all these R1-fitting R1rho models now tested in the test suite? >> >> Cheers, >> >> Edward >> >> >> >> On 5 August 2014 20:47, <[email protected]> wrote: >> > Author: tlinnet >> > Date: Tue Aug 5 20:47:24 2014 >> > New Revision: 24969 >> > >> > URL: http://svn.gna.org/viewcvs/relax?rev=24969&view=rev >> > Log: >> > Split target function of model TAP03, into a calc and two func_TAP03* >> > variants. >> > >> > One target function will use measured R1 values, while one target >> > function will use the fitted R1 values. >> > >> > They will use the same calculation function. >> > >> > sr #3135(https://gna.org/support/?3135): Optimisation of the R1 >> > relaxation rate for the off-resonance R1rho relaxation dispersion models. >> > >> > Modified: >> > branches/R1_fitting/target_functions/relax_disp.py >> > >> > Modified: branches/R1_fitting/target_functions/relax_disp.py >> > URL: >> > http://svn.gna.org/viewcvs/relax/branches/R1_fitting/target_functions/relax_disp.py?rev=24969&r1=24968&r2=24969&view=diff >> > >> > ============================================================================== >> > --- branches/R1_fitting/target_functions/relax_disp.py (original) >> > +++ branches/R1_fitting/target_functions/relax_disp.py Tue Aug 5 >> > 20:47:24 2014 >> > @@ -55,7 +55,7 @@ >> > from lib.errors import RelaxError >> > from lib.float import isNaN >> > from target_functions.chi2 import chi2_rankN >> > -from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, >> > EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, >> > EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_LIST_CPMG, EXP_TYPE_R1RHO, >> > MODEL_B14, MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, >> > MODEL_DPL94_FIT_R1, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, >> > MODEL_LIST_MMQ, MODEL_LIST_MQ_CPMG, MODEL_LIST_NUMERIC, MODEL_LIST_R1RHO, >> > MODEL_LIST_R1RHO_FULL, MODEL_LIST_R1RHO_FIT_R1, MODEL_LIST_R1RHO_W_R1, >> > MODEL_LM63, MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_MP05, >> > MODEL_MMQ_CR72, MODEL_NOREX, MODEL_NOREX_R1RHO, MODEL_NOREX_R1RHO_FIT_R1, >> > MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, >> > MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, >> > MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, MODEL_NS_MMQ_3SITE, >> > MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, >> > MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_PARAM_DW_MIX_DOUBLE, >> > MODEL_PARAM_DW_MIX_QUADRUPLE, MODEL_PARAM_INV_RELAX_TIMES, >> > MODEL_PARAM_R20B, >> > MODEL_TAP03, MODEL_TP02, MODEL_TP02_FIT_R1, MODEL_TSMFK01 >> > +from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, >> > EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, >> > EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_LIST_CPMG, EXP_TYPE_R1RHO, >> > MODEL_B14, MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_DPL94, >> > MODEL_DPL94_FIT_R1, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, >> > MODEL_LIST_MMQ, MODEL_LIST_MQ_CPMG, MODEL_LIST_NUMERIC, MODEL_LIST_R1RHO, >> > MODEL_LIST_R1RHO_FULL, MODEL_LIST_R1RHO_FIT_R1, MODEL_LIST_R1RHO_W_R1, >> > MODEL_LM63, MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_MP05, >> > MODEL_MMQ_CR72, MODEL_NOREX, MODEL_NOREX_R1RHO, MODEL_NOREX_R1RHO_FIT_R1, >> > MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, >> > MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, >> > MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, MODEL_NS_MMQ_3SITE, >> > MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, >> > MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_PARAM_DW_MIX_DOUBLE, >> > MODEL_PARAM_DW_MIX_QUADRUPLE, MODEL_PARAM_INV_RELAX_TIMES, >> > MODEL_PARAM_R20B, >> > MODEL_TAP03, MODEL_TAP03_FIT_R1, MODEL_TP02, MODEL_TP02_FIT_R1, >> > MODEL_TSMFK01 >> > >> > >> > class Dispersion: >> > @@ -526,6 +526,8 @@ >> > self.func = self.func_TP02_fit_r1 >> > if model == MODEL_TAP03: >> > self.func = self.func_TAP03 >> > + if model == MODEL_TAP03_FIT_R1: >> > + self.func = self.func_TAP03_fit_r1 >> > if model == MODEL_MP05: >> > self.func = self.func_MP05 >> > if model == MODEL_NS_R1RHO_2SITE: >> > @@ -900,6 +902,44 @@ >> > return chi2_rankN(self.values, self.back_calc, self.errors) >> > >> > >> > + def calc_TAP03(self, R1=None, r1rho_prime=None, dw=None, pA=None, >> > kex=None): >> > + """Calculation function for the Trott, Abergel and Palmer >> > (2003) R1rho off-resonance 2-site model. >> > + >> > + @keyword R1: The R1 value. >> > + @type R1: list of float >> > + @keyword r1rho_prime: The R1rho value for all states in the >> > absence of exchange. >> > + @type r1rho_prime: list of float >> > + @keyword dw: The chemical shift differences in ppm >> > for each spin. >> > + @type dw: list of float >> > + @keyword pA: The population of state A. >> > + @type pA: float >> > + @keyword kex: The rate of exchange. >> > + @type kex: float >> > + @return: The chi-squared value. >> > + @rtype: float >> > + """ >> > + >> > + # Reshape r1rho_prime to per experiment, spin and frequency. >> > + self.r1rho_prime_struct[:] = multiply.outer( >> > r1rho_prime.reshape(self.NE, self.NS, self.NM), self.no_nd_ones ) >> > + >> > + # Convert dw from ppm to rad/s. Use the out argument, to pass >> > directly to structure. >> > + multiply( multiply.outer( dw.reshape(1, self.NS), >> > self.nm_no_nd_ones ), self.frqs, out=self.dw_struct ) >> > + >> > + # Back calculate the R1rho values. >> > + r1rho_TAP03(r1rho_prime=self.r1rho_prime_struct, >> > omega=self.chemical_shifts, offset=self.offset, pA=pA, dw=self.dw_struct, >> > kex=kex, R1=R1, spin_lock_fields=self.spin_lock_omega1, >> > spin_lock_fields2=self.spin_lock_omega1_squared, back_calc=self.back_calc) >> > + >> > + # Clean the data for all values, which is left over at the end >> > of arrays. >> > + self.back_calc = self.back_calc*self.disp_struct >> > + >> > + # For all missing data points, set the back-calculated value to >> > the measured values so that it has no effect on the chi-squared value. >> > + if self.has_missing: >> > + # Replace with values. >> > + self.back_calc[self.mask_replace_blank.mask] = >> > self.values[self.mask_replace_blank.mask] >> > + >> > + # Return the total chi-squared value. >> > + return chi2_rankN(self.values, self.back_calc, self.errors) >> > + >> > + >> > def calc_TP02(self, R1=None, r1rho_prime=None, dw=None, pA=None, >> > kex=None): >> > """Calculation function for the Trott and Palmer (2002) R1rho >> > off-resonance 2-site model. >> > >> > @@ -1879,30 +1919,40 @@ >> > params = dot(params, self.scaling_matrix) >> > >> > # Unpack the parameter values. >> > - R20 = params[:self.end_index[0]] >> > + r1rho_prime = params[:self.end_index[0]] >> > dw = params[self.end_index[0]:self.end_index[1]] >> > pA = params[self.end_index[1]] >> > kex = params[self.end_index[1]+1] >> > >> > - # Convert dw from ppm to rad/s. Use the out argument, to pass >> > directly to structure. >> > - multiply( multiply.outer( dw.reshape(1, self.NS), >> > self.nm_no_nd_ones ), self.frqs, out=self.dw_struct ) >> > - >> > - # Reshape R20 to per experiment, spin and frequency. >> > - self.r20_struct[:] = multiply.outer( R20.reshape(self.NE, >> > self.NS, self.NM), self.no_nd_ones ) >> > - >> > - # Back calculate the R1rho values. >> > - r1rho_TAP03(r1rho_prime=self.r20_struct, >> > omega=self.chemical_shifts, offset=self.offset, pA=pA, dw=self.dw_struct, >> > kex=kex, R1=self.r1, spin_lock_fields=self.spin_lock_omega1, >> > spin_lock_fields2=self.spin_lock_omega1_squared, back_calc=self.back_calc) >> > - >> > - # Clean the data for all values, which is left over at the end >> > of arrays. >> > - self.back_calc = self.back_calc*self.disp_struct >> > - >> > - # For all missing data points, set the back-calculated value to >> > the measured values so that it has no effect on the chi-squared value. >> > - if self.has_missing: >> > - # Replace with values. >> > - self.back_calc[self.mask_replace_blank.mask] = >> > self.values[self.mask_replace_blank.mask] >> > - >> > - # Return the total chi-squared value. >> > - return chi2_rankN(self.values, self.back_calc, self.errors) >> > + # Calculate and return the chi-squared value. >> > + return self.calc_TAP03(R1=self.r1, r1rho_prime=r1rho_prime, >> > dw=dw, pA=pA, kex=kex) >> > + >> > + >> > + def func_TAP03_fit_r1(self, params): >> > + """Target function for the Trott, Abergel and Palmer (2003) >> > R1rho off-resonance 2-site model, where R1 is fitted. >> > + >> > + @param params: The vector of parameter values. >> > + @type params: numpy rank-1 float array >> > + @return: The chi-squared value. >> > + @rtype: float >> > + """ >> > + >> > + # Scaling. >> > + if self.scaling_flag: >> > + params = dot(params, self.scaling_matrix) >> > + >> > + # Unpack the parameter values. >> > + r1 = params[:self.end_index[0]] >> > + r1rho_prime = params[self.end_index[0]:self.end_index[1]] >> > + dw = params[self.end_index[1]:self.end_index[2]] >> > + pA = params[self.end_index[2]] >> > + kex = params[self.end_index[2]+1] >> > + >> > + # Reshape R1 to per experiment, spin and frequency. >> > + self.r1_struct[:] = multiply.outer( r1.reshape(self.NE, >> > self.NS, self.NM), self.no_nd_ones ) >> > + >> > + # Calculate and return the chi-squared value. >> > + return self.calc_TAP03(R1=self.r1_struct, >> > r1rho_prime=r1rho_prime, dw=dw, pA=pA, kex=kex) >> > >> > >> > def func_TP02(self, params): >> > >> > >> > _______________________________________________ >> > relax (http://www.nmr-relax.com) >> > >> > This is the relax-commits mailing list >> > [email protected] >> > >> > 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-commits >> >> _______________________________________________ >> relax (http://www.nmr-relax.com) >> >> This is the relax-devel mailing list >> [email protected] >> >> >> 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-devel _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list [email protected] 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-devel

