Author: tlinnet Date: Fri Jan 16 23:19:58 2015 New Revision: 27207 URL: http://svn.gna.org/viewcvs/relax?rev=27207&view=rev Log: In systemtest Relax_disp.test_task_7882_monte_carlo_std_residual() inserted sanity checks of calculation of degrees of freedom.
Task #7882 (https://gna.org/task/?7882): Implement Monte-Carlo simulation, where errors are generated with width of standard deviation or residuals. Modified: trunk/test_suite/system_tests/relax_disp.py Modified: trunk/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/relax_disp.py?rev=27207&r1=27206&r2=27207&view=diff ============================================================================== --- trunk/test_suite/system_tests/relax_disp.py (original) +++ trunk/test_suite/system_tests/relax_disp.py Fri Jan 16 23:19:58 2015 @@ -8534,13 +8534,35 @@ file_name = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'error_testing'+sep+'task_7882' self.interpreter.results.read(file_name) + # Get the spins, which was used for clustering. + spins_cluster = cdp.clustering['sel'] + spins_free = cdp.clustering['free spins'] + # Recalc the values at this step, to make sure that Sum of Squares are stored (Chi2 without weighting) and its standard deviation is stored. self.interpreter.minimise.execute(min_algor='simplex', func_tol=1e-05, max_iter=10, verbosity=0) + + # For sanity check, calculate degree of freedom. + cur_spin_id = spins_cluster[0] + cur_spin = return_spin(cur_spin_id) + + # Calculate total number of datapoins. + N = len(spins_cluster) + N_dp = N * len(cur_spin.r2eff) + + # Calculate number of paramaters. For CR72, there is R2 per spectrometer field, individual dw, and shared kex and pA. + N_par = cdp.spectrometer_frq_count * N + N + 1 + 1 + dof = N_dp - N_par # Make sure they are stored for all spins. for spin, spin_id in spin_loop(return_id=True, skip_desel=True): self.assert_(hasattr(spin, 'sos')) self.assert_(hasattr(spin, 'sos_std')) + + # Calculate degree of freedoms. + dof_spin = int(round(spin.sos / spin.sos_std**2)) + + # Assert that this is the same. + self.assertEqual(dof, dof_spin) # Then check the results are stored after a call to grid search function. # First reset. @@ -8561,6 +8583,12 @@ self.assert_(hasattr(spin, 'sos')) self.assert_(hasattr(spin, 'sos_std')) + # Calculate degree of freedoms. + dof_spin = int(round(spin.sos / spin.sos_std**2)) + + # Assert that this is the same. + self.assertEqual(dof, dof_spin) + # Then check the results are stored after a call to calculate function. # First reset. self.interpreter.reset() @@ -8580,9 +8608,11 @@ self.assert_(hasattr(spin, 'sos')) self.assert_(hasattr(spin, 'sos_std')) - # Get the spins, which was used for clustering. - spins_cluster = cdp.clustering['sel'] - spins_free = cdp.clustering['free spins'] + # Calculate degree of freedoms. + dof_spin = int(round(spin.sos / spin.sos_std**2)) + + # Assert that this is the same. + self.assertEqual(dof, dof_spin) def test_tp02_data_to_tp02(self): _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits