Author: bugman Date: Thu Jan 24 16:08:02 2013 New Revision: 18308 URL: http://svn.gna.org/viewcvs/relax?rev=18308&view=rev Log: Merged revisions 18301-18307 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18301 | bugman | 2013-01-24 13:00:31 +0100 (Thu, 24 Jan 2013) | 7 lines Big data store clean up fix for the N-state model. The N-state model specific base_data_loop() method now skips deselected interatomic data containers and spins. This prevents a lot of junk data being created in the data pipe, for example back calculated and Monte Carlo simulation RDC and PCS data. ........ r18302 | bugman | 2013-01-24 14:16:51 +0100 (Thu, 24 Jan 2013) | 5 lines Added new checks in the N_state_model.test_metal_pos_opt system test. These are for structures which should not be in the deselected spins and interatomic containers ........ r18303 | bugman | 2013-01-24 14:21:42 +0100 (Thu, 24 Jan 2013) | 5 lines The N-state model _check_rdcs() method now skips deselected interatomic data containers. A FIXME comment has also been added to highlight a possible future problem. ........ r18304 | bugman | 2013-01-24 14:43:43 +0100 (Thu, 24 Jan 2013) | 3 lines Small docstring fix. ........ r18305 | bugman | 2013-01-24 14:45:07 +0100 (Thu, 24 Jan 2013) | 6 lines Added some consistency to the specific analysis API base class. The return_data() method argument has been changed from 'spin' to 'data_id', as the data from the base_data_loop() methods are often not spin containers. ........ r18306 | bugman | 2013-01-24 14:49:52 +0100 (Thu, 24 Jan 2013) | 5 lines Fixes for the relaxation curve-fitting specific return_data() method. Strangely, it appears as if this method is never used. ........ r18307 | bugman | 2013-01-24 16:05:54 +0100 (Thu, 24 Jan 2013) | 5 lines Made the chi2 value check less stringent in the N_state_model.test_metal_pos_opt system test. For some bizarre reason, the calc() call in the GUI is less precise. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/specific_fns/api_base.py branches/frame_order_testing/specific_fns/n_state_model.py branches/frame_order_testing/specific_fns/relax_fit.py branches/frame_order_testing/test_suite/system_tests/n_state_model.py branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/metal_pos_opt.py Propchange: branches/frame_order_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Jan 24 16:08:02 2013 @@ -1,1 +1,1 @@ -/trunk:1-18299 +/trunk:1-18307 Modified: branches/frame_order_testing/specific_fns/api_base.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/api_base.py?rev=18308&r1=18307&r2=18308&view=diff ============================================================================== --- branches/frame_order_testing/specific_fns/api_base.py (original) +++ branches/frame_order_testing/specific_fns/api_base.py Thu Jan 24 16:08:02 2013 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004-2012 Edward d'Auvergne # +# Copyright (C) 2004-2013 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -117,7 +117,7 @@ """Create the Monte Carlo data. @keyword data_id: The data identification information, as yielded by the base_data_loop() generator method. - @type data_id: str + @type data_id: anything @return: The Monte Carlo simulation data. @rtype: list of floats """ @@ -523,13 +523,13 @@ return self.PARAMS.get_conv_factor(param) - def return_data(self, spin): + def return_data(self, data_id=None): """Return the data points used in optimisation. - @param spin: The SpinContainer object. - @type spin: SpinContainer instance - @return: The array of relaxation data values. - @rtype: list of float + @keyword data_id: The data identification information, as yielded by the base_data_loop() generator method. + @type data_id: anything + @return: The array of data values. + @rtype: list of float """ # Not implemented. @@ -571,13 +571,13 @@ return param - def return_error(self, data_id): + def return_error(self, data_id=None): """Return the error points corresponding to the data points used in optimisation. - @param data_id: The data identification information, as yielded by the base_data_loop() generator method. - @type data_id: str - @return: The array of relaxation data error values. - @rtype: list of float + @keyword data_id: The data identification information, as yielded by the base_data_loop() generator method. + @type data_id: anything + @return: The array of data error values. + @rtype: list of float """ # Not implemented. @@ -708,7 +708,7 @@ """Pack the Monte Carlo simulation data. @param data_id: The data identification information, as yielded by the base_data_loop() generator method. - @type data_id: str + @type data_id: anything @param sim_data: The Monte Carlo simulation data. @type sim_data: list of float """ Modified: branches/frame_order_testing/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/n_state_model.py?rev=18308&r1=18307&r2=18308&view=diff ============================================================================== --- branches/frame_order_testing/specific_fns/n_state_model.py (original) +++ branches/frame_order_testing/specific_fns/n_state_model.py Thu Jan 24 16:08:02 2013 @@ -412,7 +412,12 @@ @return: True if the RDCs should be used, False otherwise. """ + # Skip deselected interatomic data containers. + if not interatom.select: + return False + # Skip deselected spins. + # FIXME: These checks could be fatal in the future if a user has good RDCs and one of the two spins are deselected! if not spin1.select or not spin2.select: return False @@ -1797,6 +1802,10 @@ # Loop over the interatomic data containers. for interatom in interatomic_loop(): + # Skip deselected data. + if not interatom.select: + continue + # Re-initialise the data structure. data = [interatom, None, None] @@ -1826,6 +1835,10 @@ # Loop over the spins. for spin in spin_loop(): + # Skip deselected data. + if not spin.select: + continue + # Re-initialise the data structure. data = [spin, None, None] @@ -2451,7 +2464,7 @@ @keyword data_id: The list of spin ID, data type, and alignment ID, as yielded by the base_data_loop() generator method. @type data_id: str @return: The Monte Carlo simulation data errors. - @rtype: list of floats + @rtype: list of float """ # Initialise the MC data structure. Modified: branches/frame_order_testing/specific_fns/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/specific_fns/relax_fit.py?rev=18308&r1=18307&r2=18308&view=diff ============================================================================== --- branches/frame_order_testing/specific_fns/relax_fit.py (original) +++ branches/frame_order_testing/specific_fns/relax_fit.py Thu Jan 24 16:08:02 2013 @@ -850,15 +850,19 @@ print("No spins have been deselected.") - def return_data(self, spin): + def return_data(self, data_id=None): """Function for returning the peak intensity data structure. - @param spin: The spin container. - @type spin: SpinContainer instance - @return: The peak intensity data structure. - @rtype: list of float - """ - + @keyword data_id: The spin identification string, as yielded by the base_data_loop() generator method. + @type data_id: str + @return: The peak intensity data structure. + @rtype: list of float + """ + + # Get the spin container. + spin = return_spin(data_id) + + # Return the peak intensities. return spin.intensities Modified: branches/frame_order_testing/test_suite/system_tests/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/n_state_model.py?rev=18308&r1=18307&r2=18308&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/n_state_model.py (original) +++ branches/frame_order_testing/test_suite/system_tests/n_state_model.py Thu Jan 24 16:08:02 2013 @@ -572,12 +572,22 @@ 'Tm': [ 0.000125066528687, -0.000564062193363, -0.000607973317902, 0.000090266635200, 0.000174865797403, 0.002488010156480, 0.000830246873289, 0.000762523870219, -0.000096933008248, 0.000742665143642, -0.000215152849719], 'Er': [-0.481445160767000, -0.361046693640000, -0.370098680342000, -0.413514467402000, -0.410802287329000, -1.081011578870000, -0.963176128222000, -0.745366702244000, -0.674570724880000, -0.751320872646000, -0.684906087274000, -0.461253969271000, -0.443680922437000, -0.344056233315000, -0.328118573270000, -0.395048353548000, -0.356220572284000, -0.324533952261000, -0.411777498713000, -0.511811581196000, -1.018565433020000, -0.959481602761000, -0.734022165690000, -0.660034918889000, -0.709085634512000, -0.878775632044000, -0.553464480425000, -0.765371835675000, -1.548006987460000] } + spin_deselect_blacklist = ['pcs_bc', 'pcs_sim'] + # Loop over the align IDs. for tag in ['Dy', 'Tb', 'Tm', 'Er']: i = 0 for spin, spin_id in spin_loop(return_id=True): # Deselected spin. if not spin.select: + print("Checking the deselected spin '%s'" % spin_id) + + # Check that the container is clean. + for name in spin_deselect_blacklist: + print(" Checking the blacklisted object %s." % name) + self.assert_(not hasattr(spin, name)) + + # Skip the rest of the checks. continue # No PCS. @@ -608,12 +618,22 @@ 'Tm': [-0.057386340972700, -0.045650398398700, -0.074873514450400, 0.099056143214600, 0.021275817005300, 0.037132036464200, 0.047340390362400, 0.128745838536000, 0.010906407989400], 'Er': [ 22.944150028900001, 23.363231565100001, 25.948323446000000, 6.955380304960000, 1.784067087050000, 7.228324193240000, 8.271072502000001, -7.403618580470000] } + interatom_deselect_blacklist = ['rdc_bc', 'rdc_sim'] + # Loop over the align IDs. for tag in ['Dy', 'Tm', 'Er']: i = 0 for interatom in interatomic_loop(): # Deselected interatomic container. if not interatom.select: + print("Checking the deselected interatom '%s-%s'" % (interatom.spin_id1, interatom.spin_id2)) + + # Check that the container is clean. + for name in interatom_deselect_blacklist: + print(" Checking the blacklisted object %s." % name) + self.assert_(not hasattr(interatom, name)) + + # Skip the rest of the checks. continue # No RDC. Modified: branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/metal_pos_opt.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/metal_pos_opt.py?rev=18308&r1=18307&r2=18308&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/metal_pos_opt.py (original) +++ branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/metal_pos_opt.py Thu Jan 24 16:08:02 2013 @@ -113,7 +113,7 @@ cdp.paramagnetic_centre[0] = cdp.paramagnetic_centre[0] + 0.02 print("Shifted position: [%.3f, %.3f, %.3f]\n" % (cdp.paramagnetic_centre[0], cdp.paramagnetic_centre[1], cdp.paramagnetic_centre[2])) self._execute_uf(uf_name='calc') -print("Chi2: %s" % cdp.chi2) +print("Chi2: %.15f" % cdp.chi2) if cdp.chi2 < 1e-15: raise RelaxError("The chi2 value cannot be zero here!") @@ -121,15 +121,16 @@ x, y, z = cdp.paramagnetic_centre self._execute_uf(uf_name='n_state_model.select_model', model='population') self._execute_uf(uf_name='calc') -print("Chi2: %s" % cdp.chi2) +print("Chi2: %.15f" % cdp.chi2) chi2 = cdp.chi2 if cdp.chi2 < 1e-15: raise RelaxError("The chi2 value cannot be zero here!") self._execute_uf(uf_name='paramag.centre', fix=True) self._execute_uf(uf_name='calc') -print("Chi2: %s" % cdp.chi2) -if abs(cdp.chi2 - chi2) > 1e-15: - raise RelaxError("The chi2 value must match the previous value of %s." % chi2) +print("Chi2: %.15f" % cdp.chi2) +if abs(cdp.chi2 - chi2) > 1e-10: + print "%.15g" % abs(cdp.chi2 - chi2) + raise RelaxError("The chi2 value must match the previous value of %.15f." % chi2) self._execute_uf(uf_name='n_state_model.select_model', model='fixed') self._execute_uf(uf_name='paramag.centre', fix=False) self._execute_uf(uf_name='calc')