Changeset 2924


Ignore:
Timestamp:
May 19, 2006, 4:12:41 PM (18 years ago)
Author:
duncan
Message:

changing pyvolution code so fit_interpolate/fit.py is used.

Location:
inundation
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • inundation/fit_interpolate/fit.py

    r2897 r2924  
    400400    """
    401401    #Since this is a wrapper for fit, lets handle the geo_spatial att's
    402    
    403402    if use_cache is True:
    404403        interp = cache(_fit,
  • inundation/pyvolution/data_manager.py

    r2891 r2924  
    15301530            northing_min = None,
    15311531            northing_max = None,
    1532             expand_search = False, #To avoid intractable situations (This will be fixed when least_squares gets redesigned)
    15331532            verbose = False,
    15341533            origin = None,
  • inundation/pyvolution/interpolate_sww.py

    r2750 r2924  
    11""" Interpolation of a sww file.
     2
     3THIS FILE IS OBSOLETE
     4
    25Used to interpolate height information from sww files.
    36
  • inundation/pyvolution/quantity.py

    r2762 r2924  
    168168                   function = None,   # Callable object: f(x,y)
    169169                   geospatial_data = None, #Arbitrary dataset
    170                    points = None, values = None, data_georef = None, #Input for least squares (obsoleted by use of geo_spatial object)
     170                   points = None, values = None, data_georef = None, #Input for fit (obsoleted by use of geo_spatial object)
    171171                   filename = None, attribute_name = None, #Input from file
    172172                   alpha = None,
     
    196196        geospatial_data:
    197197          Arbitrary geo spatial dataset in the form of the class
    198           Geospatial_data. Mesh points are populated using least squares
    199           fitting
     198          Geospatial_data. Mesh points are populated using
     199          fit_interpolate.fit fitting
    200200
    201201        points:
    202           Nx2 array of data points for use with least squares fit
     202          Nx2 array of data points for use with fit_interpolate.fit
    203203          If points are present, an N array of attribute
    204204          values corresponding to
     
    214214        filename:
    215215          Name of a .pts file containing data points and attributes for
    216           use with least squares.
     216          use with fit_interpolate.fit.
    217217
    218218        attribute_name:
     
    222222
    223223        alpha:
    224           Smoothing parameter to be used with least squares fits.
    225           See module least_squares for further details about alpha.
     224          Smoothing parameter to be used with fit_interpolate.fit.
     225          See module fit_interpolate.fit for further details about alpha.
    226226          Alpha will only be used with points, values or filename.
    227227          Otherwise it will be ignored.
     
    255255
    256256        use_cache: True means that caching of intermediate results is
    257                    attempted for least squares fit.
     257                   attempted for fit_interpolate.fit.
    258258
    259259
     
    613613                               verbose = False,
    614614                               use_cache = False):
    615         """Set quantity values from arbitray data points using least squares
     615        """
     616        Set quantity values from arbitray data points using
     617        fit_interpolate.fit
    616618        """
    617619
     
    619621        from Numeric import Float
    620622        from utilities.numerical_tools import ensure_numeric
    621         from pyvolution.least_squares import fit_to_mesh
     623        #from pyvolution.least_squares import fit_to_mesh
     624        from fit_interpolate.fit import fit_to_mesh
    622625        from coordinate_transforms.geo_reference import Geo_reference
    623626
     
    629632            msg = 'set_values_from_points is only defined for '+\
    630633                  'location=\'vertices\''
    631             raise msg
     634            raise ms
    632635
    633636        coordinates = self.domain.coordinates
     
    647650
    648651
    649         #Call least squares method
     652        #Call fit_interpolate.fit function
    650653        args = (coordinates, triangles, points, values)
    651654        kwargs = {'data_origin': data_georef.get_origin(),
    652655                  'mesh_origin': mesh_georef.get_origin(),
    653656                  'alpha': alpha,
    654                   'precrop': True,
    655657                  'verbose': verbose}
    656658
     
    685687                             use_cache = False):
    686688        """Set quantity based on arbitrary points in .pts file
    687         using least_squares attribute_name selects name of attribute
     689        using attribute_name selects name of attribute
    688690        present in file.
    689691        If not specified try to use whatever is available in file.
  • inundation/pyvolution/test_combine_pts.py

    r2699 r2924  
    77
    88
    9 from least_squares import *
     9#from least_squares import *
    1010from Numeric import allclose, array, transpose
    1111
  • inundation/pyvolution/test_quantity.py

    r2754 r2924  
    99from Numeric import allclose, array, ones, Float
    1010
    11 from pyvolution.least_squares import fit_to_mesh               
     11from fit_interpolate.fit import fit_to_mesh
     12#from pyvolution.least_squares import fit_to_mesh               
    1213from domain import Domain
    1314from geospatial_data.geospatial_data import Geospatial_data
    1415from coordinate_transforms.geo_reference import Geo_reference
    1516
    16 #Aux for least_squares example
     17#Aux for fit_interpolate.fit example
    1718def linear_function(point):
    1819    point = array(point)
     
    282283
    283284
    284     def test_set_values_using_least_squares(self):
     285    def test_set_values_using_fit(self):
    285286
    286287
     
    304305        z = linear_function(data_points)
    305306
    306         #Use built-in least squares fit
     307        #Use built-in fit_interpolate.fit
    307308        quantity.set_values( Geospatial_data(data_points, z), alpha = 0 )
    308309        #quantity.set_values(points = data_points, values = z, alpha = 0)
     
    330331
    331332
    332     def test_test_set_values_using_least_squares_w_geo(self):
     333    def test_test_set_values_using_fit_w_geo(self):
    333334
    334335
Note: See TracChangeset for help on using the changeset viewer.