Changeset 4108
- Timestamp:
- Dec 20, 2006, 3:58:01 PM (16 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
r3514 r4108 93 93 print "Interpolate!" 94 94 calc = interp.interpolate(mesh_dict['vertex_attributes']) 95 else: 96 # need to change to fit_interpolate code97 interp = Fit(mesh_dict['vertices'],95 else: 96 if is_fit is True: 97 interp = Fit(mesh_dict['vertices'], 98 98 mesh_dict['triangles'], 99 max_vertices_per_cell = max_points_per_cell) 100 if is_fit is True: 99 max_vertices_per_cell = max_points_per_cell) 101 100 print "Fit in Fit" 102 101 calc = interp.fit(points_dict['points'], 103 102 points_dict['point_attributes']) 104 pass105 103 else: 106 104 # run an interploate problem. -
anuga_core/source/anuga/fit_interpolate/fit.py
r3945 r4108 78 78 Note: Don't supply a vertex coords as a geospatial object and 79 79 a mesh origin, since geospatial has its own mesh origin. 80 81 82 Usage, 83 To use this in a blocking way, call build_fit_subset, with z info, 84 and then fit, with no point coord, z info. 85 80 86 """ 81 87 # Initialise variabels … … 232 238 233 239 if self.AtA == None: 234 # AtA and Atz need otbe initialised.240 # AtA and Atz need to be initialised. 235 241 m = self.mesh.number_of_nodes 236 242 if len(z.shape) > 1: … … 243 249 244 250 self.AtA = Sparse(m,m) 251 # The memory damage has been done by now. 252 245 253 self.point_count += point_coordinates.shape[0] 246 254 #print "_build_matrix_AtA_Atz - self.point_count", self.point_count … … 250 258 # self.mesh.get_boundary_polygon() 251 259 260 # Why are these global? 252 261 self.inside_poly_indices, self.outside_poly_indices = \ 253 262 in_and_outside_polygon(point_coordinates, … … 311 320 #FIXME (DSG) - do a message 312 321 else: 322 # This is where build fit subset can be looped over, 323 # if a file name is passed in. 313 324 point_coordinates = ensure_absolute(point_coordinates, 314 325 geo_reference=point_origin) 326 #if isinstance(point_coordinates,Geospatial_data) and z is None: 327 # z will come from the geo-ref 315 328 self.build_fit_subset(point_coordinates, z, verbose) 316 329 … … 345 358 346 359 347 def build_fit_subset(self, point_coordinates, z ,348 verbose =False):360 def build_fit_subset(self, point_coordinates, z=None, attribute_name=None, 361 verbose=False): 349 362 """Fit a smooth surface to given 1d array of data points z. 350 363 … … 356 369 List of coordinate pairs [x, y] of 357 370 data points or an nx2 Numeric array or a Geospatial_data object 358 z: Single 1d vector or array of data at the point_coordinates. 359 360 """ 361 #Note: Don't get the z info from anuga.geospatial_data.attributes yet. 362 # If we did fit would have to handle attribute title info. 371 z: Single 1d vector or array of data at the point_coordinates. 372 attribute_name: Used to get the z values from the 373 geospatial object if no attribute_name is specified, 374 it's a bit of a lucky dip as to what attributes you get. 375 If there is only one attribute it will be that one. 376 377 """ 363 378 364 379 #FIXME(DSG-DSG): Check that the vert and point coords … … 369 384 370 385 #Convert input to Numeric arrays 371 z = ensure_numeric(z, Float) 386 if z is not None: 387 z = ensure_numeric(z, Float) 388 else: 389 msg = 'z not specified' 390 assert isinstance(point_coordinates,Geospatial_data), msg 391 z = point_coordinates.get_attributes(attribute_name) 392 372 393 point_coordinates = ensure_numeric(point_coordinates, Float) 373 394
Note: See TracChangeset
for help on using the changeset viewer.