@@ -244,34 +244,20 @@ def read_parameters(self, filename='parameters_rbf.prm'):
244244
245245 ctrl_points = config .get ('Control points' , 'original control points' )
246246 lines = ctrl_points .split ('\n ' )
247- original_control_points = np .zeros ((len (lines ), 3 ))
248- for line , i in zip (lines , list (range (0 , self .n_control_points ))):
249- values = line .split ()
250- original_control_points [i ] = np .array (
251- [float (values [0 ]),
252- float (values [1 ]),
253- float (values [2 ])])
254- self .original_control_points = original_control_points
247+ self .original_control_points = np .array (
248+ list (map (lambda x : x .split (), lines )), dtype = float )
255249
256250 mod_points = config .get ('Control points' , 'deformed control points' )
257251 lines = mod_points .split ('\n ' )
252+ self .deformed_control_points = np .array (
253+ list (map (lambda x : x .split (), lines )), dtype = float )
258254
259255 if len (lines ) != self .n_control_points :
260256 raise TypeError ("The number of control points must be equal both in"
261257 "the 'original control points' and in the 'deformed"
262258 "control points' section of the parameters file"
263259 "({0!s})" .format (filename ))
264260
265- deformed_control_points = np .zeros ((self .n_control_points , 3 ))
266- for line , i in zip (lines , list (range (0 , self .n_control_points ))):
267- values = line .split ()
268- deformed_control_points [i ] = np .array (
269- [float (values [0 ]),
270- float (values [1 ]),
271- float (values [2 ])])
272- self .deformed_control_points = deformed_control_points
273-
274-
275261 def write_parameters (self , filename = 'parameters_rbf.prm' ):
276262 """
277263 This method writes a parameters file (.prm) called `filename` and fills
0 commit comments