Author: tlinnet Date: Sun Dec 7 13:12:51 2014 New Revision: 26986 URL: http://svn.gna.org/viewcvs/relax?rev=26986&view=rev Log: Added two new systemtests in Spectrum. test_select_sn_ratio_all and test_select_sn_ratio_any. These test the user function select.sn_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=26986&r1=26985&r2=26986&view=diff ============================================================================== --- trunk/test_suite/system_tests/spectrum.py (original) +++ trunk/test_suite/system_tests/spectrum.py Sun Dec 7 13:12:51 2014 @@ -281,3 +281,67 @@ # Make the test: self.assertEqual(spin_ids_sel, [':3@N']) self.assertEqual(spin_ids_desel, [':4@N', ':5@N', ':6@N']) + + + def test_select_sn_ratio_all(self): + """Test the select.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() + + # First deselect all spins. + self.interpreter.deselect.all() + + # Select spins. + self.interpreter.select.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, [':5@N', ':6@N']) + self.assertEqual(spin_ids_desel, [':3@N', ':4@N']) + + + def test_select_sn_ratio_any(self): + """Test the select.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() + + # First deselect all spins. + self.interpreter.deselect.all() + + # Select spins. + self.interpreter.select.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, [':4@N', ':5@N', ':6@N']) + self.assertEqual(spin_ids_desel, [':3@N'])