Author: tlinnet Date: Sun Dec 7 12:27:29 2014 New Revision: 26982 URL: http://svn.gna.org/viewcvs/relax?rev=26982&view=rev Log: Added two new systemtest in Spectrum. test_deselect_sn_ratio_all and test_deselect_sn_ratio_any. These test the user function deselect.sn_ratio, to deselect spins with a signal to noise ratio lower than the specified ratio. Modified: trunk/test_suite/system_tests/spectrum.py Modified: trunk/test_suite/system_tests/spectrum.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/spectrum.py?rev=26982&r1=26981&r2=26982&view=diff ============================================================================== --- trunk/test_suite/system_tests/spectrum.py (original) +++ trunk/test_suite/system_tests/spectrum.py Sun Dec 7 12:27:29 2014 @@ -223,3 +223,61 @@ # View the plotting. if show_grace: self.interpreter.grace.view(file=outfile, dir=filedir, grace_exe='xmgrace') + + + def test_deselect_sn_ratio_all(self): + """Test the deselect.sn_ratio for signal to noise ratios, where all ID should evaluate to True. + """ + + # Setup data. + self.setup_signal_noise_ratio() + + # Calculate the signal to noise ratio calculation. + self.interpreter.spectrum.sn_ratio() + + # deselect spins. + self.interpreter.deselect.sn_ratio(ratio=400.0, operation='<', all_sn=True) + + # Test + spin_ids_sel = [] + spin_ids_desel = [] + + # Collect spin ids which are selected. + for cur_spin, cur_spin_id in spin_loop(return_id=True, skip_desel=False): + if cur_spin.select: + spin_ids_sel.append(cur_spin_id) + else: + spin_ids_desel.append(cur_spin_id) + + # Make the test: + self.assertEqual(spin_ids_sel, [':3@N', ':4@N']) + self.assertEqual(spin_ids_desel, [':5@N', ':6@N']) + + + def test_deselect_sn_ratio_any(self): + """Test the deselect.sn_ratio for signal to noise ratios, where any ID should evaluate to True. + """ + + # Setup data. + self.setup_signal_noise_ratio() + + # Calculate the signal to noise ratio calculation. + self.interpreter.spectrum.sn_ratio() + + # Deselect spins. + self.interpreter.deselect.sn_ratio(ratio=200.0, operation='<', all_sn=False) + + # Test + spin_ids_sel = [] + spin_ids_desel = [] + + # Collect spin ids which are selected. + for cur_spin, cur_spin_id in spin_loop(return_id=True, skip_desel=False): + if cur_spin.select: + spin_ids_sel.append(cur_spin_id) + else: + spin_ids_desel.append(cur_spin_id) + + # Make the test: + self.assertEqual(spin_ids_sel, [':3@N']) + self.assertEqual(spin_ids_desel, [':4@N', ':5@N', ':6@N'])