Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2003-2014 Edward d'Auvergne # 4 # Copyright (C) 2006 Chris MacRaild # 5 # Copyright (C) 2008 Sebastien Morin # 6 # Copyright (C) 2014 Troels E. Linnet # 7 # # 8 # This file is part of the program relax (http://www.nmr-relax.com). # 9 # # 10 # This program is free software: you can redistribute it and/or modify # 11 # it under the terms of the GNU General Public License as published by # 12 # the Free Software Foundation, either version 3 of the License, or # 13 # (at your option) any later version. # 14 # # 15 # This program is distributed in the hope that it will be useful, # 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 18 # GNU General Public License for more details. # 19 # # 20 # You should have received a copy of the GNU General Public License # 21 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 22 # # 23 ############################################################################### 24 25 # Module docstring. 26 """The R1 and R2 exponential relaxation curve fitting optimisation functions.""" 27 28 # relax module imports. 29 from specific_analyses.relax_fit.parameters import assemble_param_vector 30 from target_functions.relax_fit_wrapper import Relax_fit_opt 31 3234 """Back-calculation of peak intensity for the given relaxation time. 35 36 @keyword spin: The spin container. 37 @type spin: SpinContainer instance 38 @keyword relax_time_id: The ID string for the desired relaxation time. 39 @type relax_time_id: str 40 @return: The peak intensity for the desired relaxation time. 41 @rtype: float 42 """ 43 44 # Create the initial parameter vector. 45 param_vector = assemble_param_vector(spin=spin) 46 47 # The keys. 48 keys = list(spin.peak_intensity.keys()) 49 50 # The peak intensities and times. 51 values = [] 52 errors = [] 53 times = [] 54 for key in keys: 55 values.append(spin.peak_intensity[key]) 56 errors.append(spin.peak_intensity_err[key]) 57 times.append(cdp.relax_times[key]) 58 59 # A fake scaling matrix in a diagonalised list form. 60 scaling_list = [] 61 for i in range(len(param_vector)): 62 scaling_list.append(1.0) 63 64 # Initialise the relaxation fit functions. 65 model = Relax_fit_opt(model=spin.model, num_params=len(spin.params), values=values, errors=errors, relax_times=times, scaling_matrix=scaling_list) 66 67 # Make a single function call. This will cause back calculation and the data will be stored in the C module. 68 model.func(param_vector) 69 70 # Get the data back. 71 results = model.back_calc_data() 72 73 # Return the correct peak height. 74 return results[keys.index(relax_time_id)]75
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:20 2024 | http://epydoc.sourceforge.net |