(self, filename='parameters_rbf.prm')
Reads in the parameters file and fill the self structure.

        :param string filename: parameters file to be read in. Default value is
            parameters_rbf.prm.
Reads in the parameters file and fill the self structure.
Reads in the parameters file and fill the self structure .
def read_parameters(self, filename='parameters_rbf.prm'):
        """
        Reads in the parameters file and fill the self structure.

        :param string filename: parameters file to be read in. Default value is
            parameters_rbf.prm.
        """
        if not isinstance(filename, str):
            raise TypeError('filename must be a string')

        # Checks if the parameters file exists. If not it writes the default
        # class into filename.  It consists in the vetices of a cube of side one
        # with a vertex in (0, 0, 0) and opposite one in (1, 1, 1).
        if not os.path.isfile(filename):
            self.write_parameters(filename)
            return

        config = configparser.RawConfigParser()
        config.read(filename)

        rbf_settings = dict(config.items('Radial Basis Functions'))
        
        self.basis = rbf_settings.pop('basis function')
        self.radius = float(rbf_settings.pop('radius'))
        self.extra = {k: eval(v) for k, v in rbf_settings.items()}

        ctrl_points = config.get('Control points', 'original control points')
        lines = ctrl_points.split('\n')
        self.original_control_points = np.array(
            list(map(lambda x: x.split(), lines)), dtype=float)

        mod_points = config.get('Control points', 'deformed control points')
        lines = mod_points.split('\n')
        self.deformed_control_points = np.array(
            list(map(lambda x: x.split(), lines)), dtype=float)

        if len(lines) != self.n_control_points:
            raise TypeError("The number of control points must be equal both in"
                            "the 'original control points' and in the 'deformed"
                            "control points' section of the parameters file"
                            "({0!s})".format(filename))
def read_parameters ( self , filename = 'parameters_rbf.prm' ) : if not isinstance ( filename , str ) : raise TypeError ( 'filename must be a string' ) # Checks if the parameters file exists. If not it writes the default # class into filename.  It consists in the vetices of a cube of side one # with a vertex in (0, 0, 0) and opposite one in (1, 1, 1). if not os . path . isfile ( filename ) : self . write_parameters ( filename ) return config = configparser . RawConfigParser ( ) config . read ( filename ) rbf_settings = dict ( config . items ( 'Radial Basis Functions' ) ) self . basis = rbf_settings . pop ( 'basis function' ) self . radius = float ( rbf_settings . pop ( 'radius' ) ) self . extra = { k : eval ( v ) for k , v in rbf_settings . items ( ) } ctrl_points = config . get ( 'Control points' , 'original control points' ) lines = ctrl_points . split ( '\n' ) self . original_control_points = np . array ( list ( map ( lambda x : x . split ( ) , lines ) ) , dtype = float ) mod_points = config . get ( 'Control points' , 'deformed control points' ) lines = mod_points . split ( '\n' ) self . deformed_control_points = np . array ( list ( map ( lambda x : x . split ( ) , lines ) ) , dtype = float ) if len ( lines ) != self . n_control_points : raise TypeError ( "The number of control points must be equal both in" "the 'original control points' and in the 'deformed" "control points' section of the parameters file" "({0!s})" . format ( filename ) )