Author: tlinnet Date: Sun Dec 7 13:12:53 2014 New Revision: 26987 URL: http://svn.gna.org/viewcvs/relax?rev=26987&view=rev Log: Added the new user function select.sn_ratio, to select spins with signal to noise ratio above a specified ration. The default ratio for signal to noise selection is 10.0. But should probably be 50-100 instead. THe default of 'all_sn' is True, meaning that all Signal to Noise ratios for the spins needs tpo pass the test. Modified: trunk/user_functions/select.py Modified: trunk/user_functions/select.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/select.py?rev=26987&r1=26986&r2=26987&view=diff ============================================================================== --- trunk/user_functions/select.py (original) +++ trunk/user_functions/select.py Sun Dec 7 13:12:53 2014 @@ -31,7 +31,7 @@ # relax module imports. from graphics import WIZARD_IMAGE_PATH -from pipe_control import domain, selection +from pipe_control import domain, selection, spectrum from user_functions.data import Uf_info; uf_info = Uf_info() from user_functions.objects import Desc_container @@ -363,6 +363,67 @@ uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png' +# The select.sn_ratio user function. +uf = uf_info.add_uf("select.sn_ratio") +uf.title = "Select spins with signal to noise ratio higher or lower than ratio." +uf.title_short = "Spin signal to noise selection." +uf.display = True +uf.add_keyarg( + name = "ratio", + default = 10.0, + py_type = "float", + desc_short = "ratio", + desc = "The signal to noise ratio to compare to." +) +uf.add_keyarg( + name = "operation", + default = ">", + py_type = "str", + desc_short = "comparison operation", + desc = "The comparison operation by which to select the spins.", + wiz_element_type = "combo", + wiz_combo_choices = [ + "'<' : strictly less than", + "'<=' : less than or equal", + "'>' : strictly greater than", + "'>=' : greater than or equal", + "'==' : equal", + "'!=' : not equal", + ], + wiz_combo_data = [ + "<", + "<=", + ">", + ">=", + "==", + "!=", + ], + wiz_read_only = True +) +uf.add_keyarg( + name = "all_sn", + default = True, + py_type = "bool", + desc_short = "all S/N per spin flag", + desc = "A flag specifying if all the signal to noise ratios per spin should match the comparison operator, of if just a single comparison match is enough." +) +# Description. +uf.desc.append(Desc_container()) +uf.desc[-1].add_paragraph("The comparison operation is the method which to select spins accorfing to: operation(sn_ratio, ratio).") +uf.desc[-1].add_paragraph("The 'all_sn' flag default is True, meaning that if all of the spins signal to noise levels evaluates to True in the comparison, the spin is selected.") +# Prompt examples. +uf.desc.append(Desc_container("Prompt examples")) +uf.desc[-1].add_paragraph("To select all spins with a signal to noise ratio higher than 10.0:") +uf.desc[-1].add_prompt("relax> select.sn_ratio(ratio=10.0, operation='>')") +uf.desc[-1].add_prompt("relax> select.sn_ratio(ratio=10.0, operation='>', all_sn=False)") +uf.backend = spectrum.sn_ratio_selection +uf.menu_text = "&sn_ratio" +uf.gui_icon = "relax.fid" +uf.wizard_height_desc = 500 +uf.wizard_size = (1000, 750) +uf.wizard_image = WIZARD_IMAGE_PATH + 'select.png' + + # The select.spin user function. uf = uf_info.add_uf("select.spin") uf.title = "Select specific spins."