Changeset 429
- Timestamp:
- Oct 20, 2004, 2:26:43 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/test_least_squares.py
r424 r429 117 117 118 118 119 120 def teszt_more_triangles(self):119 # this causes a memory error in scipy.sparce 120 def bad_test_more_triangles(self): 121 121 print "dd" 122 122 a = [-1.0, 0.0] … … 146 146 147 147 148 def tes t_smooth_attributes_to_mesh(self):148 def teszt_smooth_attributes_to_mesh(self): 149 149 print "ee" 150 150 a = [0.0, 0.0] … … 162 162 data_coords = [d1, d2, d3] 163 163 164 interp = Interpolation(points, triangles, data_coords, alpha= 0.0000005)164 interp = Interpolation(points, triangles, data_coords, alpha=5.0e-7) 165 165 z = [z1, z2, z3] 166 166 f = interp.fit(z) 167 167 answer = [0, 5., 5.] 168 169 168 assert allclose(f, answer) 170 169 … … 562 561 563 562 def test_fit_to_mesh_file(self): 563 from load_mesh.loadASCII import mesh_file_to_mesh_dictionary, \ 564 export_trianglulation_file 565 import tempfile 566 import os 567 568 # create a .tsh file, no user outline 569 mesh_dic = {} 570 mesh_dic['generatedpointlist'] = [[0.0, 0.0], 571 [0.0, 5.0], 572 [5.0, 0.0]] 573 mesh_dic['generatedtrianglelist'] = [[0, 2, 1]] 574 mesh_dic['generatedsegmentlist'] = [[0, 1], [2, 0], [1, 2]] 575 mesh_dic['generatedtriangleattributelist'] = [['']] 576 mesh_dic['generatedpointattributelist'] = [[], [], []] 577 mesh_dic['generatedpointattributetitlelist'] = [] 578 mesh_dic['generatedtriangleneighborlist'] = [[-1, -1, -1]] 579 mesh_dic['generatedsegmentmarkerlist'] = ['external', 580 'external', 581 'external'] 582 mesh_file = tempfile.mktemp(".tsh") 583 export_trianglulation_file(mesh_file,mesh_dic) 584 585 # create an .xya file 586 point_file = tempfile.mktemp(".xya") 587 fd = open(point_file,'w') 588 fd.write("elevation, stage \n 1.0, 1.0,2.,4 \n 1.0, 3.0,4,8 \n 3.0,1.0,4.,8 \n") 589 fd.close() 590 591 mesh_output_file = "new_trianlge.tsh" 592 fit_to_mesh_file(mesh_file, 593 point_file, 594 mesh_output_file, 595 alpha = 0.0) 596 # load in the .tsh file we just wrote 597 mesh_dic = mesh_file_to_mesh_dictionary(mesh_output_file) 598 599 assert allclose(mesh_dic['generatedpointattributelist'], 600 [[0.0, 0.0], 601 [5.0, 10.0], 602 [5.0,10.0]]) 603 604 self.failUnless(mesh_dic['generatedpointattributetitlelist'] == 605 ['elevation','stage'], 606 'test_fit_to_mesh_file failed') 607 608 #clean up 609 os.remove(mesh_file) 610 os.remove(point_file) 611 612 def test_fit_to_mesh_fileII(self): 564 613 from load_mesh.loadASCII import mesh_file_to_mesh_dictionary, \ 565 614 export_trianglulation_file … … 613 662 #------------------------------------------------------------- 614 663 if __name__ == "__main__": 615 suite = unittest.makeSuite(TestCase,'tes t')664 suite = unittest.makeSuite(TestCase,'teszt') 616 665 runner = unittest.TextTestRunner() 617 666 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.