Changeset 6548


Ignore:
Timestamp:
Mar 18, 2009, 4:59:03 PM (16 years ago)
Author:
ole
Message:

Added caching test to validation suite following fix of ticket:314
Also removed parameter acceptable_overshoot which was never implemented anyway.

Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/fit.py

    r6545 r6548  
    474474                alpha=DEFAULT_ALPHA,
    475475                verbose=False,
    476                 acceptable_overshoot=1.01,
    477                 # FIXME: Move to config - this value is assumed in caching test
    478                 # FIXME(Ole): Just realised that this was never implemented (29 Jan 2009). I suggest removing it altogether.
    479476                mesh_origin=None,
    480477                data_origin=None,
     
    493490              'alpha': alpha,
    494491              'verbose': verbose,
    495               'acceptable_overshoot': acceptable_overshoot,
    496492              'mesh_origin': mesh_origin,
    497493              'data_origin': data_origin,
     
    549545                 alpha=DEFAULT_ALPHA,
    550546                 verbose=False,
    551                  acceptable_overshoot=1.01,
    552547                 mesh_origin=None,
    553548                 data_origin=None,
     
    575570          alpha: Smoothing parameter.
    576571
    577           acceptable overshoot: NOT IMPLEMENTED
    578           controls the allowed factor by which
    579           fitted values
    580           may exceed the value of input data. The lower limit is defined
    581           as min(z) - acceptable_overshoot*delta z and upper limit
    582           as max(z) + acceptable_overshoot*delta z
    583          
    584572
    585573          mesh_origin: A geo_reference object or 3-tuples consisting of
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/test_caching_of_set_quantity.py

    r6547 r6548  
    1 """This script tests that caching works for set_quantity using point data from a file.
     1"""This script tests that caching works for set_quantity using point
     2data from a file.
    23First cache is cleared, then set_quantity is run twice checking that
    34fitting is evaluated only first time and that the result from cache on the
     
    67This script depends on  Benchmark_2.msh and Benchmark_2_Bathymetry.pts
    78"""
    8 # FIXME(Ole): This needs to become a unit test - in automated validation tests under Okushiri.
    9 
    10 # FIXME(Ole): This won't work until ticket:314 has been fixed.
    119
    1210# Module imports
     
    1816import time
    1917
    20 internal_verbose = True # Verbose used in set_quantity and passed into fit_to_mesh
     18internal_verbose = True # Verbosity used within this function
    2119
    2220filename=project.bathymetry_filename
     
    2725# Create Domain from mesh
    2826#-------------------------
    29 domain = cache(Domain, (project.mesh_filename, {'verbose': True}), verbose=False)
     27domain = cache(Domain,
     28               (project.mesh_filename,
     29                {'verbose': True}),
     30               verbose=False)
    3031
    3132# Clear caching of underlying function                                           
     
    3738          'alpha': alpha,
    3839          'verbose': internal_verbose,
    39           'acceptable_overshoot': 1.01, # This is the default value in _fit_to_mesh - actually, not implemented. Remove!
    4040          'mesh_origin': None,
    4141          'data_origin': None,
     
    6262
    6363
    64 
    6564#-------------------------
    6665# Initial Conditions
    6766#-------------------------
    68 #print 'Set elevation and cache'
    6967t0 = time.time()
    7068domain.set_quantity('elevation',
     
    8482             dependencies=[filename],
    8583             test=True)
     84             
    8685assert flag is not None
    87 res = domain.get_quantity('elevation').get_values()                                       
     86res = domain.get_quantity('elevation').get_values()
    8887assert num.allclose(res, ref)
    8988
    9089# Now check this using the high level call
    91 
    9290print 'Try to read in via cache'
    9391t0 = time.time()
     
    9997cache_time = time.time()-t0                   
    10098                   
    101 res = domain.get_quantity('elevation').get_values()                                        
     99res = domain.get_quantity('elevation').get_values()
    102100assert num.allclose(res, ref)
    103101
    104102print 'cache_time', cache_time
    105103print 'compute_time', compute_time
    106 assert cache_time < compute_time/10
     104
     105msg = 'Caching did not speed things up as expected'
     106assert cache_time < compute_time/10, msg
  • anuga_validation/okushiri_2005/test_caching_of_set_quantity.py

    r6237 r6548  
    1 """This script tests that caching works for set_quantity using point data from a file.
     1"""This script tests that caching works for set_quantity using point
     2data from a file.
    23First cache is cleared, then set_quantity is run twice checking that
    34fitting is evaluated only first time and that the result from cache on the
     
    67This script depends on  Benchmark_2.msh and Benchmark_2_Bathymetry.pts
    78"""
    8 # FIXME(Ole): This needs to become a unit test - in automated validation tests under Okushiri.
    99
    10 # FIXME(Ole): This won't work until ticket:314 has been fixed.
     10# FIXME(Ole): This script is obsolete and has been moved into the
     11# automatic validation unit test suite.
    1112
    1213# Module imports
     
    1819import time
    1920
    20 internal_verbose = True # Verbose used in set_quantity and passed into fit_to_mesh
     21internal_verbose = True # Verbosity used within this function
    2122
    2223filename=project.bathymetry_filename
Note: See TracChangeset for help on using the changeset viewer.