Author: tlinnet Date: Wed Jan 14 16:41:27 2015 New Revision: 27166 URL: http://svn.gna.org/viewcvs/relax?rev=27166&view=rev Log: Merged revisions 27159-27165 via svnmerge from svn+ssh://tlinnet@xxxxxxxxxxx/svn/relax/trunk ........ r27159 | tlinnet | 2015-01-14 14:45:17 +0100 (Wed, 14 Jan 2015) | 3 lines Added save state for test of bug 23186. Bug #23186 (https://gna.org/bugs/index.php?23186): Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin. ........ r27160 | tlinnet | 2015-01-14 14:45:20 +0100 (Wed, 14 Jan 2015) | 3 lines Added systemtest "Relax_disp.test_bug_23186_cluster_error_calc_dw", which shows the failure of monte carlo simulations error calculations. Bug #23186 (https://gna.org/bugs/index.php?23186): Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin. ........ r27161 | tlinnet | 2015-01-14 14:55:37 +0100 (Wed, 14 Jan 2015) | 3 lines Added additional test for r2a parameter. Bug #23186 (https://gna.org/bugs/index.php?23186): Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin. ........ r27162 | tlinnet | 2015-01-14 15:20:02 +0100 (Wed, 14 Jan 2015) | 5 lines Attempt to implement GUI test: --gui-tests General.test_bug_23187_residue_delete_gui This will NOT catch the error. bug #23187: (https://gna.org/bugs/index.php?23187): Deleting residue in GUI, and then open spin viewer crashes relax. ........ r27163 | tlinnet | 2015-01-14 15:25:07 +0100 (Wed, 14 Jan 2015) | 3 lines Added test for spin independet error of k_AB. Bug #23186 (https://gna.org/bugs/index.php?23186): Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin. ........ r27164 | bugman | 2015-01-14 15:35:01 +0100 (Wed, 14 Jan 2015) | 8 lines Fix for the showing of the spin viewer window in the GUI tests. The show_tree() method of the main GUI window class was not calling the custom self.spin_viewer.Show() method, as required to set up the observer objects required to keep the spin viewer window updated. The value of status.show_gui was blocking this. Instead the show argument of this Show() method is being set to status.show_gui to allow the method to always be executed. ........ r27165 | tlinnet | 2015-01-14 16:10:03 +0100 (Wed, 14 Jan 2015) | 3 lines Fix in dispersion API, to set error value for clustered values. Bug #23186 (https://gna.org/bugs/index.php?23186): Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin. ........ Added: branches/nmrglue/test_suite/shared_data/dispersion/bug_23186.bz2 - copied unchanged from r27165, trunk/test_suite/shared_data/dispersion/bug_23186.bz2 Modified: branches/nmrglue/ (props changed) branches/nmrglue/gui/relax_gui.py branches/nmrglue/specific_analyses/relax_disp/api.py branches/nmrglue/test_suite/gui_tests/general.py branches/nmrglue/test_suite/system_tests/relax_disp.py Propchange: branches/nmrglue/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Jan 14 16:41:27 2015 @@ -1 +1 @@ -/trunk:1-27157 +/trunk:1-27165 Modified: branches/nmrglue/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/gui/relax_gui.py?rev=27166&r1=27165&r2=27166&view=diff ============================================================================== --- branches/nmrglue/gui/relax_gui.py (original) +++ branches/nmrglue/gui/relax_gui.py Wed Jan 14 16:41:27 2015 @@ -779,8 +779,8 @@ return # Open the window (the GUI flag check is inside the Show method). - if status.show_gui and not self.spin_viewer.IsShown(): - self.spin_viewer.Show() + if not self.spin_viewer.IsShown(): + self.spin_viewer.Show(show=status.show_gui) def state_load(self, event=None, file_name=None): Modified: branches/nmrglue/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/specific_analyses/relax_disp/api.py?rev=27166&r1=27165&r2=27166&view=diff ============================================================================== --- branches/nmrglue/specific_analyses/relax_disp/api.py (original) +++ branches/nmrglue/specific_analyses/relax_disp/api.py Wed Jan 14 16:41:27 2015 @@ -1123,8 +1123,8 @@ param_name, si, mi = param_index_to_param_info(index=index, spins=spins) else: param_name = aux_params[index - total_param_num] - si = 0 - mi = 0 + si = None + mi = None # The parameter error name. err_name = param_name + "_err" @@ -1140,8 +1140,15 @@ # Model and auxiliary parameters. else: - for spin in spins: - setattr(spin, err_name, error) + # If clustered paramater: + if si == None: + for spin in spins: + setattr(spin, err_name, error) + + # If independent value. + else: + # Set the value. + setattr(spins[si], err_name, error) def set_param_values(self, param=None, value=None, index=None, spin_id=None, error=False, force=True): @@ -1486,7 +1493,9 @@ if model_param: param_name, si, mi = param_index_to_param_info(index=index, spins=spins) if not param_name in ['r2eff', 'i0']: - si = 0 + if si == None: + si = 0 + else: param_name = aux_params[index - total_param_num] si = 0 Modified: branches/nmrglue/test_suite/gui_tests/general.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/test_suite/gui_tests/general.py?rev=27166&r1=27165&r2=27166&view=diff ============================================================================== --- branches/nmrglue/test_suite/gui_tests/general.py (original) +++ branches/nmrglue/test_suite/gui_tests/general.py Wed Jan 14 16:41:27 2015 @@ -72,6 +72,28 @@ self.assertEqual(cdp_name(), 'mf') + def test_bug_23187_residue_delete_gui(self): + """Catch U{bug #23187<https://gna.org/bugs/?23187>}, deleting residue in GUI, and then open spin viewer crashes relax.""" + + # Mf tab: Simulate the new analysis wizard. + analysis = self.new_analysis_wizard(analysis_type='mf', analysis_name='Mf test', pipe_name='mf', pipe_bundle='mf bundle') + + self._execute_uf(uf_name='residue.create', res_num=1) + self._execute_uf(uf_name='residue.create', res_num=2) + + # Launch the spin viewer window. + self.app.gui.show_tree() + + # Close the spin viewer window. + self.app.gui.spin_viewer.handler_close() + + # Delete spin, + self._execute_uf(uf_name='residue.delete', res_id=":2") + + # Launch the spin viewer window. + self.app.gui.show_tree() + + def test_new_analysis_wizard_memory_leak(self): """Test for memory leaks in the new analysis wizard.""" Modified: branches/nmrglue/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/test_suite/system_tests/relax_disp.py?rev=27166&r1=27165&r2=27166&view=diff ============================================================================== --- branches/nmrglue/test_suite/system_tests/relax_disp.py (original) +++ branches/nmrglue/test_suite/system_tests/relax_disp.py Wed Jan 14 16:41:27 2015 @@ -1449,6 +1449,78 @@ # Assert that the number of columns is equal, plus 1 for "#". self.assertEqual(nr_split_header, len(line_split_val) + 1) + + + def test_bug_23186_cluster_error_calc_dw(self): + """Catch U{bug #23186<https://gna.org/bugs/?23186>}: Error calculation of individual parameter "dw" from Monte-Carlo, is based on first spin.""" + + # Clear the data store. + self.interpreter.reset() + + # Load the state. + state = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'bug_23186.bz2' + self.interpreter.state.load(state, force=True) + + # Dic key to spectrometer frq. + dickey = 'SQ CPMG - 599.89086220 MHz' + + # First get the resi 0 array of sim r2a. + resi_0_r2a = [] + + # Loop over the dics in spin. + for cdic in cdp.mol[0].res[0].spin[0].r2a_sim: + resi_0_r2a.append(cdic[dickey]) + + # Get stats with numpy + resi_0_r2a_std = std(asarray(resi_0_r2a), ddof=1) + + # First get the resi 86 array of sim r2a. + resi_86_r2a = [] + + # Loop over the dics in spin. + for cdic in cdp.mol[0].res[1].spin[0].r2a_sim: + resi_86_r2a.append(cdic[dickey]) + + # Get stats with numpy + resi_86_r2a_std = std(asarray(resi_86_r2a), ddof=1) + + # Then get for dw. + + # First get the array of sim dw. + resi_0_dw = cdp.mol[0].res[0].spin[0].dw_sim + resi_86_dw = cdp.mol[0].res[1].spin[0].dw_sim + + # Get stats with numpy + resi_0_dw_std = std(asarray(resi_0_dw), ddof=1) + resi_86_dw_std = std(asarray(resi_86_dw), ddof=1) + + # Then get for spin independent parameter. + + # First get the array of sim dw. + resi_0_kAB = cdp.mol[0].res[0].spin[0].k_AB_sim + resi_86_kAB = cdp.mol[0].res[1].spin[0].k_AB_sim + + # Get stats with numpy + resi_0_kAB_std = std(asarray(resi_0_kAB), ddof=1) + resi_86_kAB_std = std(asarray(resi_0_kAB), ddof=1) + + # Assume they both std of k_AB values are equal + self.assertEqual(resi_0_kAB_std, resi_86_kAB_std) + + # Perform error analysis. + self.interpreter.monte_carlo.error_analysis() + + # Check values for k_AB. + self.assertEqual(resi_0_kAB_std, cdp.mol[0].res[0].spin[0].k_AB_err) + self.assertEqual(resi_86_kAB_std, cdp.mol[0].res[1].spin[0].k_AB_err) + + # Check values for r2a. + self.assertEqual(resi_0_r2a_std, cdp.mol[0].res[0].spin[0].r2a_err[dickey]) + self.assertEqual(resi_86_r2a_std, cdp.mol[0].res[1].spin[0].r2a_err[dickey]) + + # Check values for dw. + self.assertEqual(resi_0_dw_std, cdp.mol[0].res[0].spin[0].dw_err) + self.assertEqual(resi_86_dw_std, cdp.mol[0].res[1].spin[0].dw_err) def test_bug_9999_slow_r1rho_r2eff_error_with_mc(self):