Phoooooowwwwww..... This has been one loooooong marathon for a week intensive coding.
But I am done now! A little out of power, but happy with the result! Best Troels 2014-06-17 19:35 GMT+02:00 Edward d'Auvergne <[email protected]>: > That commit message might be a bit misleading when I present it to all > relax users. It sounds like the 'NS R1rho 3-site' model is new. You > have to be a bit more careful what you write, as I present your text > in all of the relax announcements. > > Regards, > > Edward > > > > On 17 June 2014 19:27, <[email protected]> wrote: > > Author: tlinnet > > Date: Tue Jun 17 19:27:10 2014 > > New Revision: 24056 > > > > URL: http://svn.gna.org/viewcvs/relax?rev=24056&view=rev > > Log: > > Implemented the target function for ns r1rho 3site. > > > > Task #7807 (https://gna.org/task/index.php?7807): Speed-up of > dispersion models for Clustered analysis. > > > > Modified: > > branches/disp_spin_speed/target_functions/relax_disp.py > > > > Modified: branches/disp_spin_speed/target_functions/relax_disp.py > > URL: > http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=24056&r1=24055&r2=24056&view=diff > > > ============================================================================== > > --- branches/disp_spin_speed/target_functions/relax_disp.py > (original) > > +++ branches/disp_spin_speed/target_functions/relax_disp.py Tue Jun > 17 19:27:10 2014 > > @@ -784,35 +784,26 @@ > > k_AC = pC * kex_AC / pA_pC > > dw_AC = dw_AB + dw_BC > > > > - # Initialise. > > - chi2_sum = 0.0 > > - > > - # Loop over the spins. > > - for si in range(self.num_spins): > > - # Loop over the spectrometer frequencies. > > - for mi in range(self.num_frq): > > - # The R20 index. > > - r20_index = mi + si*self.num_frq > > - > > - # Convert dw from ppm to rad/s. > > - dw_AB_frq = dw_AB[si] * self.frqs[0, si, mi, 0, 0] > > - dw_AC_frq = dw_AC[si] * self.frqs[0, si, mi, 0, 0] > > - > > - # Loop over the offsets. > > - for oi in range(self.num_offsets[0, si, mi]): > > - # Back calculate the R2eff values for each > experiment type. > > - ns_r1rho_3site(M0=self.M0, matrix=self.matrix, > r1rho_prime=r1rho_prime[r20_index], omega=self.chemical_shifts[0, si, mi, > oi, 0], offset=self.offset[0, si, mi, oi, 0], r1=self.r1[0, si, mi, oi, 0], > pA=pA, pB=pB, pC=pC, dw_AB=dw_AB_frq, dw_AC=dw_AC_frq, k_AB=k_AB, > k_BA=k_BA, k_BC=k_BC, k_CB=k_CB, k_AC=k_AC, k_CA=k_CA, > spin_lock_fields=self.spin_lock_omega1[0, si, mi, oi], > relax_time=self.relax_times[0, si, mi, oi], > inv_relax_time=self.inv_relax_times[0, si, mi, oi], > back_calc=self.back_calc[0, si, mi, oi], num_points=self.num_disp_points[0, > si, mi, oi]) > > - > > - # 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. > > - for di in range(self.num_disp_points[0, si, mi, > oi]): > > - if self.missing[0, si, mi, oi, di]: > > - self.back_calc[0, si, mi, oi, di] = > self.values[0, si, mi, oi, di] > > - > > - # Calculate and return the chi-squared value. > > - chi2_sum += chi2(self.values[0, si, mi, oi], > self.back_calc[0, si, mi, oi], self.errors[0, si, mi, oi]) > > + # Convert dw from ppm to rad/s. Use the out argument, to pass > directly to structure. > > + multiply( multiply.outer( dw_AB.reshape(1, self.NS), > self.nm_no_nd_ones ), self.frqs, out=self.dw_AB_struct ) > > + multiply( multiply.outer( dw_AC.reshape(1, self.NS), > self.nm_no_nd_ones ), self.frqs, out=self.dw_AC_struct ) > > + > > + # Reshape R20 to per experiment, spin and frequency. > > + self.r20_struct[:] = multiply.outer( > r1rho_prime.reshape(self.NE, self.NS, self.NM), self.no_nd_ones ) > > + > > + # Back calculate the R2eff values for each experiment type. > > + ns_r1rho_3site(M0=self.M0, matrix=self.matrix, > r1rho_prime=self.r20_struct, omega=self.chemical_shifts, > offset=self.offset, r1=self.r1, pA=pA, pB=pB, pC=pC, > dw_AB=self.dw_AB_struct, dw_AC=self.dw_AC_struct, k_AB=k_AB, k_BA=k_BA, > k_BC=k_BC, k_CB=k_CB, k_AC=k_AC, k_CA=k_CA, > spin_lock_fields=self.spin_lock_omega1, relax_time=self.relax_times, > inv_relax_time=self.inv_relax_times, back_calc=self.back_calc, > num_points=self.num_disp_points) > > + > > + # 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_sum > > + return chi2_rankN(self.values, self.back_calc, self.errors) > > > > > > def experiment_type_setup(self): > > > > > > _______________________________________________ > > 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

