Author: bugman Date: Thu Jan 24 11:28:18 2013 New Revision: 18296 URL: http://svn.gna.org/viewcvs/relax?rev=18296&view=rev Log: Merged revisions 18289-18295 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r18289 | bugman | 2013-01-24 10:02:33 +0100 (Thu, 24 Jan 2013) | 5 lines Added Monte Carlo simulations to the align_fit.py N-state model system test script. This is to increase the very low coverage of Monte Carlo simulation testing for the N-state model. ........ r18290 | bugman | 2013-01-24 10:56:29 +0100 (Thu, 24 Jan 2013) | 6 lines Modified the metal_pos_opt.py N-state model system test script to test the bootstrapping code path. This converts the Monte Carlo simulations into bootstrapping to make sure this method also functions correctly. ........ r18291 | bugman | 2013-01-24 10:57:51 +0100 (Thu, 24 Jan 2013) | 5 lines Implemented the N-state model specific return_data() method. This is needed for bootstrapping. ........ r18292 | bugman | 2013-01-24 11:05:38 +0100 (Thu, 24 Jan 2013) | 3 lines Fixes for the N-state model return_data() method. ........ r18293 | bugman | 2013-01-24 11:22:02 +0100 (Thu, 24 Jan 2013) | 5 lines Modified the RelaxNoRDCError and RelaxNoPCSError to accept no alignment ID. This is then used to indicate the complete absence of data. ........ r18294 | bugman | 2013-01-24 11:23:12 +0100 (Thu, 24 Jan 2013) | 5 lines Modified the initial testing of the rdc.set_errors and pcs.set_errors user functions. This is to better indicate to the user what the problem is and why the user function cannot operate. ........ r18295 | bugman | 2013-01-24 11:25:17 +0100 (Thu, 24 Jan 2013) | 7 lines Fixes for the align_fit.py N-state model system test script. The recently introduced Monte Carlo simulations and associated RDC and PCS error setting was failing when RDC or PCS data was missing. The script now checks the mode of operation and only sets errors if the corresponding data is present. ........ Modified: branches/frame_order_testing/ (props changed) branches/frame_order_testing/generic_fns/pcs.py branches/frame_order_testing/generic_fns/rdc.py branches/frame_order_testing/relax_errors.py branches/frame_order_testing/specific_fns/n_state_model.py branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/align_fit.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 11:28:18 2013 @@ -1,1 +1,1 @@ -/trunk:1-18287 +/trunk:1-18295 Modified: branches/frame_order_testing/generic_fns/pcs.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/pcs.py?rev=18296&r1=18295&r2=18296&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/pcs.py (original) +++ branches/frame_order_testing/generic_fns/pcs.py Thu Jan 24 11:28:18 2013 @@ -685,8 +685,12 @@ if not exists_mol_res_spin_data(): raise RelaxNoSequenceError + # Test if PCS data exists. + if not hasattr(cdp, 'pcs_ids'): + raise RelaxNoPCSError() + # Test if data corresponding to 'align_id' exists. - if not hasattr(cdp, 'pcs_ids') or (align_id and align_id not in cdp.pcs_ids): + if align_id and align_id not in cdp.pcs_ids: raise RelaxNoPCSError(align_id) # Arg check. Modified: branches/frame_order_testing/generic_fns/rdc.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/rdc.py?rev=18296&r1=18295&r2=18296&view=diff ============================================================================== --- branches/frame_order_testing/generic_fns/rdc.py (original) +++ branches/frame_order_testing/generic_fns/rdc.py Thu Jan 24 11:28:18 2013 @@ -725,8 +725,12 @@ if not exists_mol_res_spin_data(): raise RelaxNoSequenceError + # Test if RDC data exists. + if not hasattr(cdp, 'rdc_ids'): + raise RelaxNoRDCError() + # Test if data corresponding to 'align_id' exists. - if not hasattr(cdp, 'rdc_ids') or (align_id and align_id not in cdp.rdc_ids): + if align_id and align_id not in cdp.rdc_ids: raise RelaxNoRDCError(align_id) # Arg check. Modified: branches/frame_order_testing/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/relax_errors.py?rev=18296&r1=18295&r2=18296&view=diff ============================================================================== --- branches/frame_order_testing/relax_errors.py (original) +++ branches/frame_order_testing/relax_errors.py Thu Jan 24 11:28:18 2013 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2012 Edward d'Auvergne # +# Copyright (C) 2003-2013 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -781,8 +781,11 @@ # No RDC data. class RelaxNoRDCError(BaseError): - def __init__(self, id): - self.text = "RDC data corresponding to the identification string " + repr(id) + " does not exist." + def __init__(self, id=None): + if id: + self.text = "RDC data corresponding to the identification string " + repr(id) + " does not exist." + else: + self.text = "No RDC data exists." # RDC data already exists. class RelaxRDCError(BaseError): @@ -791,8 +794,11 @@ # No PCS data. class RelaxNoPCSError(BaseError): - def __init__(self, id): - self.text = "PCS data corresponding to the identification string " + repr(id) + " does not exist." + def __init__(self, id=None): + if id: + self.text = "PCS data corresponding to the identification string " + repr(id) + " does not exist." + else: + self.text = "No PCS data exists." # PCS data already exists. class RelaxPCSError(BaseError): 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=18296&r1=18295&r2=18296&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 11:28:18 2013 @@ -2347,6 +2347,49 @@ return self._param_num(), self._num_data_points(), cdp.chi2 + def return_data(self, data_id): + """Return the base data for the given data ID. + + @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: list of str + @return: The base data. + @rtype: list of (float or None) + """ + + # Alias the spin or interatomic data container, data type and alignment ID. + container = data_id[0] + data_type = data_id[1] + align_id = data_id[2] + + # The data structure to return. + data = [] + + # Skip deselected spins. + if data_id[1] == 'pcs' and not container.select: + return + + # Return the RDC data. + if data_type == 'rdc' and hasattr(container, 'rdc'): + if align_id not in container.rdc: + data.append(None) + else: + data.append(container.rdc[align_id]) + + # Return the NOESY data. + elif data_type == 'noesy' and hasattr(container, 'noesy'): + data.append(container.noesy) + + # Return the PCS data. + elif data_id[1] == 'pcs' and hasattr(container, 'pcs'): + if align_id not in container.pcs: + data.append(None) + else: + data.append(container.pcs[align_id]) + + # Return the data. + return data + + return_data_name_doc = Desc_container("N-state model data type string matching patterns") _table = uf_tables.add_table(label="table: N-state data type patterns", caption="N-state model data type string matching patterns.") _table.add_headings(["Data type", "Object name", "Patterns"]) Modified: branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/align_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/align_fit.py?rev=18296&r1=18295&r2=18296&view=diff ============================================================================== --- branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/align_fit.py (original) +++ branches/frame_order_testing/test_suite/system_tests/scripts/n_state_model/align_fit.py Thu Jan 24 11:28:18 2013 @@ -75,6 +75,19 @@ self._execute_uf(uf_name='grid_search', inc=3) self._execute_uf('simplex', constraints=False, max_iter=500, uf_name='minimise') +# Set up the errors needed for the simulations. +if ds.mode in ['rdc', 'all']: + self._execute_uf(uf_name='rdc.set_errors', sd=1.0) +if ds.mode in ['pcs', 'all']: + self._execute_uf(uf_name='pcs.set_errors', sd=0.1) + +# Monte Carlo simulations. +self._execute_uf(uf_name='monte_carlo.setup', number=3) +self._execute_uf(uf_name='monte_carlo.create_data') +self._execute_uf(uf_name='monte_carlo.initial_values') +self._execute_uf('bfgs', constraints=False, max_iter=5, uf_name='minimise') +self._execute_uf(uf_name='monte_carlo.error_analysis') + # Write out a results file. self._execute_uf('devnull', force=True, uf_name='results.write') 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=18296&r1=18295&r2=18296&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 11:28:18 2013 @@ -170,7 +170,7 @@ self._execute_uf(uf_name='pcs.set_errors', sd=0.1) self._execute_uf(uf_name='monte_carlo.setup', number=3) - self._execute_uf(uf_name='monte_carlo.create_data') + self._execute_uf(uf_name='monte_carlo.create_data', method='direct') self._execute_uf(uf_name='monte_carlo.initial_values') self._execute_uf('bfgs', constraints=False, max_iter=5, uf_name='minimise') self._execute_uf(uf_name='monte_carlo.error_analysis')