Changeset 4211
 Timestamp:
 Feb 5, 2007, 11:03:29 AM (17 years ago)
 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 20 20 import time 21 21 from random import seed, random 22 23 from anuga.pyvolution.least_squares import Interpolation 22 import tempfile 23 24 24 from anuga.fit_interpolate.interpolate import Interpolate 25 25 from anuga.fit_interpolate.fit import Fit 26 26 from anuga.pmesh.mesh import Mesh 27 from anuga.geospatial_data.geospatial_data import Geospatial_data 27 28 28 29 def mem_usage(): … … 49 50 50 51 class BenchmarkLeastSquares: 51 """ 52 """ 53 54 """ 55 56 Note(DSGDSG): 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(DSGDSG): If you are interested in benchmarking fitting, before 56 and after blocking O:\1\dgray\before_blocking_subsandpit is before blocking 57 58 """ 60 59 61 60 def __init__(self): … … 67 66 max_points_per_cell=4, 68 67 is_fit=True, 69 use_least_squares=True, 68 use_least_squares=False, 69 use_file_type=None, 70 70 save=False): 71 71 ''' … … 87 87 88 88 if use_least_squares is True: 89 from anuga.where.least_squares import Interpolation 89 90 interp = Interpolation(mesh_dict['vertices'], 90 91 mesh_dict['triangles'], … … 107 108 max_vertices_per_cell = max_points_per_cell) 108 109 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 111 122 else: 112 123 # run an interploate problem. 
anuga_core/source/anuga/fit_interpolate/run_long_benchmark.py
r3454 r4211 15 15 delimiter = ',' 16 16 17 use_least_squares_list = [ True,False]17 use_least_squares_list = [False] 18 18 is_fit_list = [True] 19 19 #num_of_points_list = [10] 20 20 #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]21 num_of_points_list = [10, 100] #, 10000, 100000] #, 10000000] 22 maxArea_list = [0.1, 0.001] #, 0.00001, 0.0000001] 23 23 max_points_per_cell_list = [8] 24 use_file_type_list = [None,'txt'] 24 25 25 26 fd = open(ofile,'a') 26 27 # write the title line 27 28 28 fd.write("use_ least_squares" + delimiter +29 fd.write("use_file_type" + delimiter + 29 30 "num_of_points" + delimiter + 30 31 "maxArea" + delimiter + … … 36 37 37 38 38 for use_ least_squares in use_least_squares_list:39 for use_file_type in use_file_type_list: 39 40 for is_fit in is_fit_list: 40 41 for num_of_points in num_of_points_list: … … 46 47 ,max_points_per_cell=max_points_per_cell 47 48 ,is_fit=is_fit 48 ,use_ least_squares=use_least_squares49 ,use_file_type=use_file_type 49 50 ) 50 51 print "time",time 51 52 print "mem", mem 52 fd.write(str(use_ least_squares) + delimiter +53 fd.write(str(use_file_type) + delimiter + 53 54 str(is_fit) + delimiter + 54 55 str(num_of_points) + delimiter +
Note: See TracChangeset
for help on using the changeset viewer.