Changeset 4211


Ignore:
Timestamp:
Feb 5, 2007, 11:03:29 AM (18 years ago)
Author:
duncan
Message:

focus on loading files

Location:
anuga_core/source/anuga/fit_interpolate
Files:
2 edited

Legend:

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

    r4129 r4211  
    2020import time
    2121from random import seed, random
    22 
    23 from anuga.pyvolution.least_squares import Interpolation
     22import tempfile
     23
    2424from anuga.fit_interpolate.interpolate import Interpolate
    2525from anuga.fit_interpolate.fit import Fit
    2626from anuga.pmesh.mesh import Mesh
     27from anuga.geospatial_data.geospatial_data import Geospatial_data
    2728
    2829def mem_usage():
     
    4950
    5051class BenchmarkLeastSquares:
    51 """
    52 """
    53 
    54 """
    55 
    56 Note(DSG-DSG): If you are interested in benchmarking fitting, before
    57 and after blocking O:\1\dgray\before_blocking_subsandpit is before blocking
    58 
    59 """
     52
     53    """
     54
     55    Note(DSG-DSG): If you are interested in benchmarking fitting, before
     56    and after blocking O:\1\dgray\before_blocking_subsandpit is before blocking
     57
     58    """
    6059
    6160    def __init__(self):
     
    6766              max_points_per_cell=4,
    6867              is_fit=True,
    69               use_least_squares=True,
     68              use_least_squares=False,
     69              use_file_type=None,
    7070              save=False):
    7171        '''
     
    8787
    8888        if use_least_squares is True:
     89            from anuga.where.least_squares import Interpolation
    8990            interp = Interpolation(mesh_dict['vertices'],
    9091                                   mesh_dict['triangles'],
     
    107108                                 max_vertices_per_cell = max_points_per_cell)
    108109                print "Fit in Fit"
    109                 calc = interp.fit(points_dict['points'],
    110                                   points_dict['point_attributes'])
     110                if use_file_type == None:
     111                    calc = interp.fit(points_dict['points'],
     112                                      points_dict['point_attributes'])
     113                else:
     114                    #check that the type
     115                    fileName = tempfile.mktemp("." + use_file_type)
     116                    G1 = Geospatial_data(points_dict['points'],
     117                                         points_dict['point_attributes'])
     118                    G1.export_points_file(fileName, absolute=True)
     119                    calc = interp.fit(fileName)
     120                    os.remove(fileName)
     121                   
    111122            else:
    112123                # run an interploate problem.
  • anuga_core/source/anuga/fit_interpolate/run_long_benchmark.py

    r3454 r4211  
    1515delimiter = ','
    1616
    17 use_least_squares_list = [True,False]
     17use_least_squares_list = [False]
    1818is_fit_list = [True]
    1919#num_of_points_list = [10]
    2020#maxArea_list = [0.1, 0.001]
    21 num_of_points_list = [10, 100, 10000, 100000] #, 10000000]
    22 maxArea_list = [0.1, 0.001, 0.00001, 0.0000001]
     21num_of_points_list = [10, 100] #, 10000, 100000] #, 10000000]
     22maxArea_list = [0.1, 0.001] #, 0.00001, 0.0000001]
    2323max_points_per_cell_list = [8]
     24use_file_type_list = [None,'txt']
    2425
    2526fd = open(ofile,'a')
    2627# write the title line
    2728
    28 fd.write("use_least_squares" + delimiter +
     29fd.write("use_file_type" + delimiter +
    2930    "num_of_points" + delimiter +
    3031         "maxArea" + delimiter +
     
    3637
    3738
    38 for use_least_squares in use_least_squares_list:
     39for use_file_type in use_file_type_list:
    3940    for is_fit in is_fit_list:
    4041        for num_of_points in num_of_points_list:
     
    4647                                                   ,max_points_per_cell=max_points_per_cell
    4748                                                   ,is_fit=is_fit
    48                                                    ,use_least_squares=use_least_squares
     49                                                   ,use_file_type=use_file_type
    4950                                               )
    5051                    print "time",time
    5152                    print "mem", mem
    52                     fd.write(str(use_least_squares) + delimiter +
     53                    fd.write(str(use_file_type) + delimiter +
    5354                             str(is_fit) + delimiter +
    5455                             str(num_of_points) + delimiter +
Note: See TracChangeset for help on using the changeset viewer.