@@ -125,7 +125,7 @@ def testmany2d():
125125 nk = np .empty ( (npoints ,), dtype = np .int32 ) # number of neighbors, i.e. nk[i] is the number of actually used columns in hoods[i,:]
126126 for i in range (npoints ):
127127 I = tree .query_ball_point ( S [i ], r ) # indices of neighbors of S[i] at distance <= r (but also including S[i] itself!)
128- I = filter ( lambda idx : idx != i , I ) # exclude S[i] itself
128+ I = [ idx for idx in I if idx != i ] # exclude S[i] itself
129129 if len (I ) > max_nk :
130130 I = I [:max_nk ]
131131 I = np .array ( I , dtype = np .int32 )
@@ -463,7 +463,7 @@ def test3d():
463463 if points_per_axis % 2 == 1 :
464464 point_list = S .tolist ()
465465 oldlen = len (point_list )
466- point_list = filter ( lambda item : not (abs (item [0 ]) < 1e-8 and abs (item [1 ]) < 1e-8 and abs (item [2 ]) < 1e-8 ), point_list )
466+ point_list = [ item for item in point_list if not (abs (item [0 ]) < 1e-8 and abs (item [1 ]) < 1e-8 and abs (item [2 ]) < 1e-8 )]
467467 S = np .array (point_list )
468468 if len (point_list ) < oldlen :
469469 print ( "Sudoku LHS sampled the point at the origin; discarding it from the sample" )
@@ -530,7 +530,7 @@ def test3d():
530530
531531 # check exact solution and relative error
532532 #
533- exact = np .array ( map ( lambda func : func ( xi [0 ], xi [1 ], xi [2 ] ), funcs ) )
533+ exact = np .array ( [ func ( xi [0 ], xi [1 ], xi [2 ] ) for func in funcs ] )
534534 err = (fi - exact )
535535
536536 print ()
@@ -743,7 +743,7 @@ def test2d():
743743 if points_per_axis % 2 == 1 :
744744 point_list = S .tolist ()
745745 oldlen = len (point_list )
746- point_list = filter ( lambda item : not (abs (item [0 ]) < 1e-8 and abs (item [1 ]) < 1e-8 ), point_list )
746+ point_list = [ item for item in point_list if not (abs (item [0 ]) < 1e-8 and abs (item [1 ]) < 1e-8 ) ]
747747 S = np .array (point_list )
748748 if len (point_list ) < oldlen :
749749 print ( "Sudoku LHS sampled the point at the origin; discarding it from the sample" )
@@ -807,7 +807,7 @@ def test2d():
807807
808808 # check exact solution and relative error
809809 #
810- exact = np .array ( map ( lambda func : func ( xi [0 ], xi [1 ] ), funcs ) )
810+ exact = np .array ( [ func ( xi [0 ], xi [1 ] ) for func in funcs ] )
811811 err = (fi - exact )
812812
813813 print ()
@@ -1153,7 +1153,7 @@ def test1d():
11531153
11541154 # check exact solution and relative error
11551155 #
1156- exact = np .array ( map ( lambda func : func ( xi ), funcs ) )
1156+ exact = np .array ( [ func ( xi ) for func in funcs ] )
11571157 err = (fi - exact )
11581158
11591159 print ()
0 commit comments