Author: bugman Date: Mon Oct 28 15:52:17 2013 New Revision: 21282 URL: http://svn.gna.org/viewcvs/relax?rev=21282&view=rev Log: Created the new relax_disp.insignificance user function. This will be used to deselect all spins whereby the maximum difference in all its dispersion curves is below a certain cutoff. Modified: branches/relax_disp/specific_analyses/relax_disp/disp_data.py branches/relax_disp/user_functions/relax_disp.py Modified: branches/relax_disp/specific_analyses/relax_disp/disp_data.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/disp_data.py?rev=21282&r1=21281&r2=21282&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/disp_data.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/disp_data.py Mon Oct 28 15:52:17 2013 @@ -45,6 +45,7 @@ from pipe_control import pipes from pipe_control.mol_res_spin import exists_mol_res_spin_data, return_spin, spin_loop from pipe_control.result_files import add_result_file +from pipe_control.selection import desel_spin from pipe_control.spectrum import check_spectrum_id from specific_analyses.relax_disp.checks import check_exp_type, check_mixed_curve_types from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG, EXP_TYPE_DESC_CPMG, EXP_TYPE_DESC_DQ_CPMG, EXP_TYPE_DESC_R1RHO, EXP_TYPE_DESC_MQ_CPMG, EXP_TYPE_DESC_MQ_R1RHO, EXP_TYPE_DESC_ZQ_CPMG, EXP_TYPE_DQ_CPMG, EXP_TYPE_LIST, EXP_TYPE_LIST_CPMG, EXP_TYPE_LIST_R1RHO, EXP_TYPE_MQ_CPMG, EXP_TYPE_MQ_R1RHO, EXP_TYPE_R1RHO, EXP_TYPE_ZQ_CPMG @@ -417,6 +418,42 @@ return False +def insignificance(level=0.0): + """Deselect all spins with insignificant dispersion profiles. + + @keyword level: The R2eff/R1rho value in rad/s by which to judge insignificance. If the maximum difference between two points on all dispersion curves for a spin is less than this value, that spin will be deselected. + @type level: float + """ + + # Number of spectrometer fields. + fields = [None] + field_count = 1 + if hasattr(cdp, 'spectrometer_frq_count'): + fields = cdp.spectrometer_frq_list + field_count = cdp.spectrometer_frq_count + + # Loop over all spins. + for spin, spin_id in spin_loop(return_id=True, skip_desel=True): + # Get all the data. + values, errors, missing, frqs, exp_types = return_r2eff_arrays(spins=[spin], spin_ids=[spin_id], fields=fields, field_count=field_count) + + # The flag. + desel = True + + # Loop over the experiments. + for exp_index in range(len(values)): + # Loop over the magnetic fields. + for frq_index in range(len(values[exp_index, 0])): + # The difference. + diff = values[exp_index, 0,frq_index].max() - values[exp_index, 0,frq_index].min() + if diff > level: + desel = False + + # Deselect the spin. + if desel: + desel_spin(spin_id) + + def is_cpmg_exp_type(id=None): """Determine if the given spectrum ID corresponds to a CPMG experiment type. Modified: branches/relax_disp/user_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=21282&r1=21281&r2=21282&view=diff ============================================================================== --- branches/relax_disp/user_functions/relax_disp.py (original) +++ branches/relax_disp/user_functions/relax_disp.py Mon Oct 28 15:52:17 2013 @@ -38,7 +38,7 @@ from pipe_control.mol_res_spin import get_spin_ids from specific_analyses.relax_disp.catia import catia_execute, catia_input from specific_analyses.relax_disp.cpmgfit import cpmgfit_execute, cpmgfit_input -from specific_analyses.relax_disp.disp_data import cpmg_frq, exp_type, plot_disp_curves, plot_exp_curves, relax_time, spin_lock_field, spin_lock_offset +from specific_analyses.relax_disp.disp_data import cpmg_frq, exp_type, insignificance, plot_disp_curves, plot_exp_curves, relax_time, spin_lock_field, spin_lock_offset from specific_analyses.relax_disp.nessy import nessy_input from specific_analyses.relax_disp.parameters import copy from specific_analyses.relax_disp.sherekhan import sherekhan_input @@ -344,6 +344,29 @@ uf.wizard_size = (800, 550) uf.wizard_apply_button = False uf.wizard_image = ANALYSIS_IMAGE_PATH + 'relax_disp_200x200.png' + + +# The relax_disp.insignificance user function. +uf = uf_info.add_uf('relax_disp.insignificance') +uf.title = "Deselect all spins with insignificant dispersion." +uf.title_short = "Insignificant spin deselection." +uf.add_keyarg( + name = "level", + py_type = "float", + default = 2.0, + desc_short = "insignificance level", + desc = "The R2eff/R1rho value in rad/s by which to judge insignificance. If the maximum difference between two points on all dispersion curves for a spin is less than this value, that spin will be deselected.", + can_be_none = False +) +# Description. +uf.desc.append(Desc_container()) +uf.desc[-1].add_paragraph("This can be used to deselect all spins which have insignificant dispersion profiles. The insignificance value is the R2eff/R1rho value in rad/s by which to judge the dispersion curves by. If the maximum difference between two points on all dispersion curves for a spin is less than this value, that spin will be deselected.") +uf.backend = insignificance +uf.gui_icon = "relax.spin_grey" +uf.menu_text = "&insignificance" +uf.wizard_size = (800, 550) +uf.wizard_apply_button = False +uf.wizard_image = WIZARD_IMAGE_PATH + 'deselect.png' # The relax_disp.nessy_input user function.