Changeset 2684 for inundation/fit_interpolate/test_interpolate.py
- Timestamp:
- Apr 10, 2006, 3:15:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/fit_interpolate/test_interpolate.py
r2660 r2684 798 798 799 799 800 def fix_test_interpolation_precompute_points(self): 801 # looking at a discrete mesh 802 # 803 804 #Three timesteps 805 time = [0.0, 60.0] 806 807 #Setup mesh used to represent fitted function 808 points = [[ 15., -20.], 809 [ 15., 10.], 810 [ 0., -20.], 811 [ 0., 10.], 812 [ 0., -20.], 813 [ 15., 10.]] 814 815 triangles = [[0, 1, 2], 816 [3, 4, 5]] 817 818 #New datapoints where interpolated values are sought 819 interpolation_points = [[ 1., 0.], [0.,1.]] 820 821 #One quantity 822 Q = zeros( (2,6), Float ) 823 824 #Linear in time and space 825 for i, t in enumerate(time): 826 Q[i, :] = t*linear_function(points) 827 #print "Q", Q 828 829 830 831 interp = Interpolate(points, triangles) 832 f = array([linear_function(points),2*linear_function(points) ]) 833 f = transpose(f) 834 #print "f",f 835 z = interp.interpolate(f, interpolation_points) 836 answer = [linear_function(interpolation_points), 837 2*linear_function(interpolation_points) ] 838 answer = transpose(answer) 839 print "z",z 840 print "answer",answer 841 assert allclose(z, answer) 842 843 844 #Check interpolation of one quantity using interpolaton points) 845 I = Interpolation_function(time, Q, 846 vertex_coordinates = points, 847 triangles = triangles, 848 interpolation_points = interpolation_points, 849 verbose = False) 850 print "I.precomputed_values", I.precomputed_values 851 852 self.failUnless( I.precomputed_values['Attribute'][1] == 60.0, 853 ' failed') 854 800 855 def test_interpolation_function_outside_point(self): 801 856 # Test spatio-temporal interpolation … … 911 966 912 967 suite = unittest.makeSuite(Test_Interpolate,'test') 913 #suite = unittest.makeSuite(Test_Interpolate,'test_ points_outside_the_polygon')968 #suite = unittest.makeSuite(Test_Interpolate,'test_interpolation_precompute_points') 914 969 runner = unittest.TextTestRunner(verbosity=1) 915 970 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.