mailr24548 - in /branches/zooming_grid_search/test_suite/system_tests: relax_fit.py scripts/relax_fit_zooming_grid.py


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

Header


Content

Posted by edward on July 17, 2014 - 14:46:
Author: bugman
Date: Thu Jul 17 14:46:53 2014
New Revision: 24548

URL: http://svn.gna.org/viewcvs/relax?rev=24548&view=rev
Log:
Created the Relax_fit.test_zooming_grid_search system test.

This will be used to test the implementation of the zooming grid search.  The 
relaxation
curve-fitting analysis should be one of the fastest for testing this.


Added:
    
branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit_zooming_grid.py
      - copied, changed from r24545, 
branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit.py
Modified:
    branches/zooming_grid_search/test_suite/system_tests/relax_fit.py

Modified: branches/zooming_grid_search/test_suite/system_tests/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/zooming_grid_search/test_suite/system_tests/relax_fit.py?rev=24548&r1=24547&r2=24548&view=diff
==============================================================================
--- branches/zooming_grid_search/test_suite/system_tests/relax_fit.py   
(original)
+++ branches/zooming_grid_search/test_suite/system_tests/relax_fit.py   Thu 
Jul 17 14:46:53 2014
@@ -242,3 +242,12 @@
             if hasattr(orig_spin, 'peak_intensity'):
                 for id in dp_new.spectrum_ids:
                     self.assertEqual(orig_spin.peak_intensity[id], 
new_spin.peak_intensity[id])
+
+
+    def test_zooming_grid_search(self):
+        """Test the relaxation curve fitting C modules."""
+
+        # Execute the script.
+        self.script_exec(status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_fit_zooming_grid.py')
+
+        # Check the curve-fitting results.

Copied: 
branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit_zooming_grid.py
 (from r24545, 
branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit.py)
URL: 
http://svn.gna.org/viewcvs/relax/branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit_zooming_grid.py?p2=branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit_zooming_grid.py&p1=branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit.py&r1=24545&r2=24548&rev=24548&view=diff
==============================================================================
--- branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit.py 
  (original)
+++ 
branches/zooming_grid_search/test_suite/system_tests/scripts/relax_fit_zooming_grid.py
      Thu Jul 17 14:46:53 2014
@@ -1,4 +1,4 @@
-# Script for relaxation curve fitting.
+# Script for testing the zooming grid search in the relaxation curve fitting.
 
 # Python module imports.
 from os import sep
@@ -7,14 +7,6 @@
 from data_store import Relax_data_store; ds = Relax_data_store()
 from status import Status; status = Status()
 
-
-# Missing intensity type (allow this script to run outside of the system 
test framework).
-if not hasattr(ds, 'int_type'):
-    ds.int_type = 'height'
-
-# Missing temporary directory.
-if not hasattr(ds, 'tmpdir'):
-    ds.tmpdir = 'temp'
 
 # Create the data pipe.
 pipe.create('rx', 'relax_fit')
@@ -64,7 +56,7 @@
     # Loop over the spectra.
     for i in range(len(names)):
         # Load the peak intensities.
-        spectrum.read_intensities(file=names[i]+'.list', dir=data_path, 
spectrum_id=names[i], int_method=ds.int_type)
+        spectrum.read_intensities(file=names[i]+'.list', dir=data_path, 
spectrum_id=names[i], int_method='height')
 
         # Set the relaxation times.
         relax_fit.relax_time(time=times[i], spectrum_id=names[i])
@@ -86,47 +78,7 @@
 # Set the relaxation curve type.
 relax_fit.select_model('exp')
 
-# Grid search.
-minimise.grid_search(inc=11)
-
-# Minimise.
-minimise.execute('simplex', constraints=False)
-
-# Monte Carlo simulations.
-monte_carlo.setup(number=3)
-monte_carlo.create_data()
-monte_carlo.initial_values()
-minimise.execute('simplex', constraints=False)
-monte_carlo.error_analysis()
-
-# Save the relaxation rates.
-value.write(param='rx', file='devnull', force=True)
-
-# Save the results.
-results.write(file='devnull', force=True)
-
-# Create Grace plots of the data.
-grace.write(y_data_type='chi2', file='chi2.agr', dir=ds.tmpdir, force=True)  
  # Minimised chi-squared value.
-grace.write(y_data_type='i0', file='i0.agr', dir=ds.tmpdir, force=True)    # 
Initial peak intensity.
-grace.write(y_data_type='rx', file='rx.agr', dir=ds.tmpdir, force=True)    # 
Relaxation rate.
-grace.write(y_data_type='rx', file='rx_err.agr', dir=ds.tmpdir, 
plot_data='error', force=True)    # Relaxation rate.
-grace.write(y_data_type='rx', file='rx_sim.agr', dir=ds.tmpdir, 
plot_data='sim', force=True)    # Relaxation rate.
-grace.write(x_data_type='i0', y_data_type='rx', file='i0_vs_rx.agr', 
dir=ds.tmpdir, force=True)    # Relaxation rate.
-grace.write(x_data_type='i0', y_data_type='rx', file='i0_vs_rx_err.agr', 
plot_data='error', dir=ds.tmpdir, force=True)    # Relaxation rate.
-grace.write(x_data_type='i0', y_data_type='rx', file='i0_vs_rx_sim.agr', 
plot_data='sim', dir=ds.tmpdir, force=True)    # Relaxation rate.
-grace.write(x_data_type='relax_times', y_data_type='peak_intensity', 
file='curves.agr', dir=ds.tmpdir, force=True)    # Average peak intensities.
-grace.write(x_data_type='relax_times', y_data_type='peak_intensity', 
norm=True, file='curves_norm.agr', dir=ds.tmpdir, force=True)    # Average 
peak intensities (normalised).
-grace.write(x_data_type='res_num', y_data_type='peak_intensity', 
file='intensities.agr', dir=ds.tmpdir, force=True)    # Average peak 
intensities.
-
-# Create Grace plots with the axes reversed.
-grace.write(x_data_type='chi2', y_data_type='res_num', file='chi2_rev.agr', 
dir=ds.tmpdir, force=True)    # Minimised chi-squared value.
-grace.write(x_data_type='i0', y_data_type='res_num', file='i0_rev.agr', 
dir=ds.tmpdir, force=True)    # Initial peak intensity.
-grace.write(x_data_type='rx', y_data_type='res_num', file='rx_rev.agr', 
dir=ds.tmpdir, force=True)    # Relaxation rate.
-grace.write(x_data_type='rx', y_data_type='res_num', file='rx_err_rev.agr', 
dir=ds.tmpdir, plot_data='error', force=True)    # Relaxation rate.
-grace.write(x_data_type='rx', y_data_type='res_num', file='rx_sim_rev.agr', 
dir=ds.tmpdir, plot_data='sim', force=True)    # Relaxation rate.
-grace.write(x_data_type='peak_intensity', y_data_type='relax_times', 
file='curves_rev.agr', dir=ds.tmpdir, force=True)    # Average peak 
intensities.
-grace.write(x_data_type='peak_intensity', y_data_type='relax_times', 
norm=True, file='curves_norm_rev.agr', dir=ds.tmpdir, force=True)    # 
Average peak intensities (normalised).
-grace.write(x_data_type='peak_intensity', y_data_type='res_num', 
file='intensities_rev.agr', dir=ds.tmpdir, force=True)    # Average peak 
intensities.
-
-# Save the program state.
-state.save('devnull', force=True)
+# Zooming grid search.
+for zoom in [0, 1, 2, 3]:
+    minimise.grid_search(inc=7)
+    minimise.grid_zoom(level=zoom)




Related Messages


Powered by MHonArc, Updated Thu Jul 17 15:00:02 2014