Author: tlinnet Date: Fri Mar 7 13:21:37 2014 New Revision: 22442 URL: http://svn.gna.org/viewcvs/relax?rev=22442&view=rev Log: Removed lib.test_rotating_frame.py and the associated unittest. Regarding sr #3124, (https://gna.org/support/index.php?3124) - Grace graphs production for R1rho analysis with R2_eff as function of Omega_eff. This is in response to http://www.mail-archive.com/relax-devel@xxxxxxx/msg05080.html. Removed: trunk/lib/rotating_frame.py trunk/test_suite/unit_tests/_lib/test_rotating_frame.py Modified: trunk/lib/__init__.py trunk/test_suite/unit_tests/_lib/__init__.py Modified: trunk/lib/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/__init__.py?rev=22442&r1=22441&r2=22442&view=diff ============================================================================== --- trunk/lib/__init__.py (original) +++ trunk/lib/__init__.py Fri Mar 7 13:21:37 2014 @@ -46,7 +46,6 @@ 'periodic_table', 'physical_constants', 'regex', - 'rotating_frame', 'selection', 'software', 'spectral_densities', Removed: trunk/lib/rotating_frame.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/rotating_frame.py?rev=22441&view=auto ============================================================================== --- trunk/lib/rotating_frame.py (original) +++ trunk/lib/rotating_frame.py (removed) @@ -1,94 +0,0 @@ -############################################################################### -# # -# Copyright (C) 2014 Troels E. Linnet # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -############################################################################### - -# Module docstring. -"""Module containing functions related to rotating frame NMR calculations. -Some of the calculations mentioned in the U{manual<http://www.nmr-relax.com/manual/Dispersion_model_summary.html>} -""" - -# Python module imports. -from os import sep - -# relax module imports. -from pipe_control.mol_res_spin import find_index, get_spin_ids, index_molecule, index_residue, return_spin, spin_loop -from specific_analyses.relax_disp.disp_data import loop_exp_frq_offset, return_offset_data, return_param_key_from_data, return_spin_lock_nu1 - -def calc_rotating_frame_params(): - """Calculates and return dictionaries of rotating frame parameters, calculated from: - - The spectrometer frequency. - - The spin-lock or hard pulse offset. - - The dispersion point data (the spin-lock field strength in Hz). - - The return will be dictionaries stored for each spin, - - spin.Domega - The average resonance offset in the rotating frame ( Domega = w_{pop_ave} - w_rf ) [rad/s] - - spin.theta - Rotating frame tilt angle ( theta = arctan(w_1 / Omega) ) [rad] - - spin.w_eff - Effective field in rotating frame ( w_eff = sqrt( Omega^2 + w_1^2 ) ) [rad/s] - - Calculations are mentioned in the U{manual<http://www.nmr-relax.com/manual/Dispersion_model_summary.html>} - - The dictionary keys are generated with: - return_param_key_from_data() from module specific_analyses.relax_disp.disp_data. - """ - # Get the field count - field_count = cdp.spectrometer_frq_count - - # Get the spin_lock_field points - spin_lock_nu1 = return_spin_lock_nu1(ref_flag=False) - - # Initialize data containers - all_spin_ids = get_spin_ids() - - # Containers for only selected spins - cur_spin_ids = [] - cur_spins = [] - for curspin_id in all_spin_ids: - # Get the spin - curspin = return_spin(curspin_id) - - # Check if is selected - if curspin.select == True: - cur_spin_ids.append(curspin_id) - cur_spins.append(curspin) - - # The offset and R1 data. - chemical_shifts, offsets, tilt_angles, Delta_omega, w_eff = return_offset_data(spins=cur_spins, spin_ids=cur_spin_ids, field_count=field_count, fields=spin_lock_nu1) - - # Loop over the index of spins, then exp_type, frq, offset - print("Printing the following") - print("exp_type curspin_id frq offset{ppm} offsets[ei][si][mi][oi]{rad/s} ei mi oi si di cur_spin.chemical_shift{ppm} chemical_shifts[ei][si][mi]{rad/s} spin_lock_nu1{Hz} tilt_angles[ei][si][mi][oi]{rad}") - for si in range(len(cur_spin_ids)): - theta_spin_dic = dict() - curspin_id = cur_spin_ids[si] - cur_spin = cur_spins[si] - for exp_type, frq, offset, ei, mi, oi in loop_exp_frq_offset(return_indices=True): - # Loop over the dispersion points. - spin_lock_fields = spin_lock_nu1[ei][mi][oi] - for di in range(len(spin_lock_fields)): - print("%-8s %-10s %11.1f %8.4f %12.5f %i %i %i %i %i %7.3f %12.5f %12.5f %12.5f"%(exp_type, curspin_id, frq, offset, offsets[ei][si][mi][oi], ei, mi, oi, si, di, cur_spin.chemical_shift, chemical_shifts[ei][si][mi], spin_lock_fields[di], tilt_angles[ei][si][mi][oi][di])) - dic_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=spin_lock_fields[di]) - theta_spin_dic["%s"%(dic_key)] = tilt_angles[ei][si][mi][oi][di] - # Store the data - cur_spin.theta = theta_spin_dic - - print("\nThe theta data now resides in") - for curspin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): - spin_index = find_index(selection=spin_id, global_index=False) - print("%s cdp.mol[%i].res[%i].spin[%i].theta"%(spin_id, spin_index[0], spin_index[1], spin_index[2])) Modified: trunk/test_suite/unit_tests/_lib/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/__init__.py?rev=22442&r1=22441&r2=22442&view=diff ============================================================================== --- trunk/test_suite/unit_tests/_lib/__init__.py (original) +++ trunk/test_suite/unit_tests/_lib/__init__.py Fri Mar 7 13:21:37 2014 @@ -39,6 +39,5 @@ 'test_io', 'test_mathematics', 'test_regex', - 'test_rotating_frame', 'test_selection' ] Removed: trunk/test_suite/unit_tests/_lib/test_rotating_frame.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/test_rotating_frame.py?rev=22441&view=auto ============================================================================== --- trunk/test_suite/unit_tests/_lib/test_rotating_frame.py (original) +++ trunk/test_suite/unit_tests/_lib/test_rotating_frame.py (removed) @@ -1,56 +0,0 @@ -############################################################################### -# # -# Copyright (C) 2014 Troels E. Linnet # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see <http://www.gnu.org/licenses/>. # -# # -############################################################################### - -# Module docstring. -"""Unit tests of the lib.rotating_frame module.""" - -# Python module imports. -from os import sep - -# relax module imports. -from lib.rotating_frame import calc_rotating_frame_params -from lib.errors import RelaxError -from pipe_control import state -from pipe_control.mol_res_spin import spin_loop -from test_suite.unit_tests.base_classes import UnitTestCase -from status import Status; status = Status() - - -class Test_rotating_frame(UnitTestCase): - """Unit tests for the functions of the 'lib.rotating_frame' module.""" - - def test_calc_rotating_frame_params(self): - """Unit test of the calc_tilt_angle() function for R1rho setup. - - This uses the data of the saved state attached to U{bug #21344<https://gna.org/bugs/?21344>}. - """ - - # Load the state. - statefile = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'bug_21344_trunc.bz2' - state.load_state(statefile, force=True) - - # Use calc_tilt_angle function - calc_rotating_frame_params() - - # Test the existence of - for curspin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=False): - print(curspin, mol_name, res_num, res_name, spin_id) - self.assert_(hasattr(curspin, 'theta'))