mailr18643 - /branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 05, 2013 - 15:51:
Author: bugman
Date: Tue Mar  5 15:51:35 2013
New Revision: 18643

URL: http://svn.gna.org/viewcvs/relax?rev=18643&view=rev
Log:
For the frame order displacement test suite data, an optimisation script has 
been added.

This is to verify this data through the auto-analysis, but it is not part of 
the test suite as these
tests are insanely slow (~8 hours on one machine).


Added:
    
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py
      - copied, changed from r18628, 
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/rigid_test.py

Copied: 
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py
 (from r18628, 
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/rigid_test.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py?p2=branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py&p1=branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/rigid_test.py&r1=18628&r2=18643&rev=18643&view=diff
==============================================================================
--- 
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/rigid_test.py
 (original)
+++ 
branches/frame_order_testing/test_suite/shared_data/frame_order/displacements/optimisation.py
 Tue Mar  5 15:51:35 2013
@@ -23,15 +23,74 @@
 
 This script should be run from the directory where it is found with the 
commands:
 
-$ ../../../../relax rigid_test.py
+$ ../../../../relax optimisation.py
 """
 
 # Python module imports.
 from numpy import array, float64
-
-
-# Create the data pipe.
-pipe.create(pipe_name='rigid test', pipe_type='frame order')
+from time import asctime, localtime
+
+# relax module imports.
+from auto_analyses.frame_order import Frame_order_analysis
+
+
+# Analysis variables.
+#####################
+
+# The grid search size (the number of increments per dimension).
+GRID_INC = 11
+
+# The more precise grid search size for the initial rigid model (the number 
of increments per dimension).
+GRID_INC_RIGID = 31
+
+# The number of Sobol' points for the PCS numerical integration in the grid 
searches.
+NUM_INT_PTS_GRID = 50
+
+# The list of the number of Sobol' points for the PCS numerical integration 
to use iteratively in the optimisations after the grid search (for the PCS 
data subset).
+NUM_INT_PTS_SUBSET = [100]
+
+# The minimisation function tolerance cutoff to terminate optimisation (for 
the PCS data subset, see the minimise user function).
+FUNC_TOL_SUBSET = [1e-2]
+
+# The list of the number of Sobol' points for the PCS numerical integration 
to use iteratively in the optimisations after the grid search (for all PCS 
and RDC data).
+NUM_INT_PTS_FULL = [100, 1000, 10000]
+
+# The minimisation function tolerance cutoff to terminate optimisation (for 
all PCS and RDC data, see the minimise user function).
+FUNC_TOL_FULL = [1e-2, 1e-3, 1e-4]
+
+# The optimisation technique.
+MIN_ALGOR = 'simplex'
+
+# The number of Monte Carlo simulations to be used for error analysis at the 
end of the protocol.
+MC_NUM = 100
+
+# The number of Sobol' points for the PCS numerical integration during Monte 
Carlo simulations.
+MC_INT_PTS = 100
+
+# The minimisation function tolerance cutoff to terminate optimisation 
during Monte Carlo simulations.
+MC_FUNC_TOL = 1e-2
+
+# The frame order models to use.
+MODELS = [
+    'rigid',
+    'free rotor',
+    'rotor',
+    'iso cone, torsionless',
+    'iso cone, free rotor',
+    'iso cone',
+    'pseudo-ellipse, torsionless',
+    'pseudo-ellipse'
+]
+
+# Set up the base data pipes.
+#############################
+
+# The data pipe bundle to group all data pipes.
+PIPE_BUNDLE = "Frame Order (%s)" % asctime(localtime())
+
+# Create the base data pipe containing only a subset of the PCS data.
+SUBSET = "Data subset - " + PIPE_BUNDLE
+pipe.create(pipe_name=SUBSET, pipe_type='frame order', bundle=PIPE_BUNDLE)
 
 # Read the structures.
 structure.read_pdb('displaced.pdb', set_mol_name='fancy_mol')
@@ -56,6 +115,7 @@
     'pcs_yb.txt',
     'pcs_ho.txt'
 ]
+pcs_files_subset = pcs_files
 rdc_files = [
     'rdc_dy.txt',
     'rdc_tb.txt',
@@ -71,7 +131,7 @@
     rdc.read(align_id=ln[i], file=rdc_files[i], dir='.', spin_id1_col=1, 
spin_id2_col=2, data_col=3, error_col=4)
 
     # The PCS (only a subset of ~5 spins for fast initial optimisations).
-    pcs.read(align_id=ln[i], file=pcs_files[i], dir='.', mol_name_col=1, 
res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+    pcs.read(align_id=ln[i], file=pcs_files_subset[i], dir='.', 
mol_name_col=1, res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
 
     # The temperature and field strength.
     temperature(id=ln[i], temp=303.0)
@@ -125,35 +185,19 @@
 # Set the paramagnetic centre position.
 paramag.centre(pos=[-5, -7, -9])
 
-# Set the number of integration points.
-frame_order.num_int_pts(10000)
-
-# Set the real parameter values (the inverted displacement values).
-cdp.ave_pos_x = -1
-cdp.ave_pos_y = -2
-cdp.ave_pos_z = -3
-cdp.ave_pos_alpha = 0.14159265359
-cdp.ave_pos_beta  = 2.0
-cdp.ave_pos_gamma = 2.14159265359
-
-# Set some parameters close to zero, but far enough away from zero to allow 
for the numerical integration.
-cdp.cone_s1 = 0.99
-cdp.cone_theta = 0.1
-cdp.cone_theta_x = 0.1
-cdp.cone_theta_y = 0.1
-cdp.cone_sigma_max = 0.1
-
-# Loop over all frame order models, showing that they should all have a 
chi-squared close to zero.
-for model in ['rigid', 'free rotor', 'rotor', 'iso cone, torsionless', 'iso 
cone, free rotor', 'iso cone', 'pseudo-ellipse, torsionless', 
'pseudo-ellipse']:
-    # Print out.
-    text = "# Model: %s" % model
-    print("\n\n%s\n%s" % (text, '#'*len(text)))
-
-    # Select the Frame Order model.
-    frame_order.select_model(model=model)
-
-    # Calculate the chi2 value.
-    calc()
-
-    # Attempt to mimimise.
-    #minimise('simplex', constraints=False)
+# Duplicate the PCS data subset data pipe to create a data pipe containing 
all the PCS data.
+DATA = "Data - " + PIPE_BUNDLE
+pipe.copy(pipe_from=SUBSET, pipe_to=DATA, bundle_to=PIPE_BUNDLE)
+pipe.switch(DATA)
+
+# Load the complete PCS data into the already filled data pipe.
+for i in range(len(ln)):
+    pcs.read(align_id=ln[i], file=pcs_files[i], mol_name_col=1, 
res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+
+
+
+# Execution.
+############
+
+# Do not change!
+Frame_order_analysis(data_pipe_full=DATA, data_pipe_subset=SUBSET, 
pipe_bundle=PIPE_BUNDLE, grid_inc=GRID_INC, grid_inc_rigid=GRID_INC_RIGID, 
min_algor=MIN_ALGOR, num_int_pts_grid=NUM_INT_PTS_GRID, 
num_int_pts_subset=NUM_INT_PTS_SUBSET, func_tol_subset=FUNC_TOL_SUBSET, 
num_int_pts_full=NUM_INT_PTS_FULL, func_tol_full=FUNC_TOL_FULL, 
mc_sim_num=MC_NUM, mc_int_pts=MC_INT_PTS, mc_func_tol=MC_FUNC_TOL, 
models=MODELS)




Related Messages


Powered by MHonArc, Updated Tue Mar 05 16:20:02 2013