Author: tlinnet Date: Fri Jul 25 13:59:32 2014 New Revision: 24749 URL: http://svn.gna.org/viewcvs/relax?rev=24749&view=rev Log: Extended specific_analyses.relax_disp.optimisation.back_calc_r2eff() to handle interpolated spin-lock offset values. sr #3124(https://gna.org/support/?3124): Grace graphs production for R1rho analysis with R2_eff as function of Omega_eff. sr #3138(https://gna.org/support/?3138): Interpolating theta through spin-lock offset [Omega], rather than spin-lock field strength [w1]. Modified: branches/r1rho_plotting/specific_analyses/relax_disp/optimisation.py Modified: branches/r1rho_plotting/specific_analyses/relax_disp/optimisation.py URL: http://svn.gna.org/viewcvs/relax/branches/r1rho_plotting/specific_analyses/relax_disp/optimisation.py?rev=24749&r1=24748&r2=24749&view=diff ============================================================================== --- branches/r1rho_plotting/specific_analyses/relax_disp/optimisation.py (original) +++ branches/r1rho_plotting/specific_analyses/relax_disp/optimisation.py Fri Jul 25 13:59:32 2014 @@ -107,21 +107,23 @@ return results -def back_calc_r2eff(spin=None, spin_id=None, cpmg_frqs=None, spin_lock_nu1=None, store_chi2=False): +def back_calc_r2eff(spin=None, spin_id=None, cpmg_frqs=None, spin_lock_offset=None, spin_lock_nu1=None, store_chi2=False): """Back-calculation of R2eff/R1rho values for the given spin. - @keyword spin: The specific spin data container. - @type spin: SpinContainer instance - @keyword spin_id: The spin ID string for the spin container. - @type spin_id: str - @keyword cpmg_frqs: The CPMG frequencies to use instead of the user loaded values - to enable interpolation. - @type cpmg_frqs: list of lists of numpy rank-1 float arrays - @keyword spin_lock_nu1: The spin-lock field strengths to use instead of the user loaded values - to enable interpolation. - @type spin_lock_nu1: list of lists of numpy rank-1 float arrays - @keyword store_chi2: A flag which if True will cause the spin specific chi-squared value to be stored in the spin container. - @type store_chi2: bool - @return: The back-calculated R2eff/R1rho value for the given spin. - @rtype: numpy rank-1 float array + @keyword spin: The specific spin data container. + @type spin: SpinContainer instance + @keyword spin_id: The spin ID string for the spin container. + @type spin_id: str + @keyword cpmg_frqs: The CPMG frequencies to use instead of the user loaded values - to enable interpolation. + @type cpmg_frqs: list of lists of numpy rank-1 float arrays + @keyword spin_lock_offset: The spin-lock offsets to use instead of the user loaded values - to enable interpolation. + @type spin_lock_offset: list of lists of numpy rank-1 float arrays + @keyword spin_lock_nu1: The spin-lock field strengths to use instead of the user loaded values - to enable interpolation. + @type spin_lock_nu1: list of lists of numpy rank-1 float arrays + @keyword store_chi2: A flag which if True will cause the spin specific chi-squared value to be stored in the spin container. + @type store_chi2: bool + @return: The back-calculated R2eff/R1rho value for the given spin. + @rtype: numpy rank-1 float array """ # Skip protons for MMQ data. @@ -145,14 +147,42 @@ values, errors, missing, frqs, frqs_H, exp_types, relax_times = return_r2eff_arrays(spins=[spin], spin_ids=[spin_id], fields=fields, field_count=field_count) # The offset and R1 data. - chemical_shifts, offsets, tilt_angles, Delta_omega, w_eff = return_offset_data(spins=[spin], spin_ids=[spin_id], field_count=field_count, fields=spin_lock_nu1) + chemical_shifts, spin_lock_fields_inter, offsets, tilt_angles, Delta_omega, w_eff = return_offset_data(spins=[spin], spin_ids=[spin_id], field_count=field_count, spin_lock_offset=spin_lock_offset, fields=spin_lock_nu1) r1 = return_r1_data(spins=[spin], spin_ids=[spin_id], field_count=field_count) # The dispersion data. recalc_tau = True - if cpmg_frqs == None and spin_lock_nu1 == None: + if cpmg_frqs == None and spin_lock_nu1 == None and spin_lock_offset == None: cpmg_frqs = return_cpmg_frqs(ref_flag=False) spin_lock_nu1 = return_spin_lock_nu1(ref_flag=False) + + # Reset the cpmg_frqs if interpolating R1rho models. + elif cpmg_frqs == None and spin_lock_nu1 == None and spin_lock_offset != None: + cpmg_frqs = None + spin_lock_nu1 = spin_lock_fields_inter + + recalc_tau = False + values = [] + errors = [] + missing = [] + for exp_type, ei in loop_exp(return_indices=True): + values.append([]) + errors.append([]) + missing.append([]) + for si in range(1): + values[ei].append([]) + errors[ei].append([]) + missing[ei].append([]) + for frq, mi in loop_frq(return_indices=True): + values[ei][si].append([]) + errors[ei][si].append([]) + missing[ei][si].append([]) + for oi, offset in enumerate(offsets[ei][si][mi]): + num = len(spin_lock_nu1[ei][mi][oi]) + + values[ei][si][mi].append(zeros(num, float64)) + errors[ei][si][mi].append(ones(num, float64)) + missing[ei][si][mi].append(zeros(num, int32)) # Reconstruct the structures for interpolation. else: @@ -710,7 +740,7 @@ self.values, self.errors, self.missing, self.frqs, self.frqs_H, self.exp_types, self.relax_times = return_r2eff_arrays(spins=spins, spin_ids=spin_ids, fields=fields, field_count=len(fields), sim_index=sim_index) # The offset and R1 data. - self.chemical_shifts, self.offsets, self.tilt_angles, self.Delta_omega, self.w_eff = return_offset_data(spins=spins, spin_ids=spin_ids, field_count=len(fields)) + self.chemical_shifts, spin_lock_fields_inter, self.offsets, self.tilt_angles, self.Delta_omega, self.w_eff = return_offset_data(spins=spins, spin_ids=spin_ids, field_count=len(fields)) self.r1 = return_r1_data(spins=spins, spin_ids=spin_ids, field_count=len(fields), sim_index=sim_index) # Parameter number.