Ignore:
Timestamp:
Oct 24, 2006, 4:56:49 PM (18 years ago)
Author:
ole
Message:

Introduced a covariance measure to verify Okushiri timeseries plus
some incidental work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/numerical_tools.py

    r3849 r3850  
    1010#(this should move to somewhere central)
    1111#try:
    12 #    from scipy import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange   
     12#    from scipy import ArrayType, array, sum, innerproduct, ravel, sqrt,
     13# searchsorted, sort, concatenate, Float, arange   
    1314#except:
    1415#    #print 'Could not find scipy - using Numeric'
    15 #    from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange
    16 from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt, searchsorted, sort, concatenate, Float, arange   
     16#    from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt,
     17#searchsorted, sort, concatenate, Float, arange
     18
     19from Numeric import ArrayType, array, sum, innerproduct, ravel, sqrt,\
     20     searchsorted, sort, concatenate, Float, arange   
    1721
    1822# Getting an infinite number to use when using Numeric
     
    3135    """
    3236
    33     error_msg = 'Input to acos is outside allowed domain [-1.0, 1.0]. I got %.12f' %x
     37    error_msg = 'Input to acos is outside allowed domain [-1.0, 1.0].'+\
     38                'I got %.12f' %x
    3439    warning_msg = 'Changing argument to acos from %.18f to %.1f' %(x, sign(x))
    3540
    36     # FIXME(Ole): Need function to compute machine precision as this is also
    37     # used in fit_interpolate/search_functions.py
    38    
    39    
    40     eps = 1.0e-15  # Machine precision
     41    eps = get_machine_precision() # Machine precision
    4142    if x < -1.0:
    4243        if x < -1.0 - eps:
     
    5051            raise ValueError, errmsg
    5152        else:
    52             print 'NOTE: changing argument to acos from %.18f to 1.0' %x           
     53            print 'NOTE: changing argument to acos from %.18f to 1.0' %x
    5354            x = 1.0
    5455
     
    148149        y = x
    149150
     151    x = ensure_numeric(x)
     152    y = ensure_numeric(y)       
    150153    assert(len(x)==len(y))
    151     N = len(x)
    152  
     154
     155    N = len(x)
    153156    cx = x - mean(x) 
    154157    cy = y - mean(y) 
Note: See TracChangeset for help on using the changeset viewer.