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

        :param string filename: parameters file to be read in.
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.prm'):
        """
        Reads in the parameters file and fill the self structure.

        :param string filename: parameters file to be read in.
        """
        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.
        if not os.path.isfile(filename):
            self.write_parameters(filename)
            return

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

        self.n_control_points[0] = config.getint('Box info',
                                                 'n control points x')
        self.n_control_points[1] = config.getint('Box info',
                                                 'n control points y')
        self.n_control_points[2] = config.getint('Box info',
                                                 'n control points z')

        self.box_length[0] = config.getfloat('Box info', 'box length x')
        self.box_length[1] = config.getfloat('Box info', 'box length y')
        self.box_length[2] = config.getfloat('Box info', 'box length z')

        self.box_origin[0] = config.getfloat('Box info', 'box origin x')
        self.box_origin[1] = config.getfloat('Box info', 'box origin y')
        self.box_origin[2] = config.getfloat('Box info', 'box origin z')

        self.rot_angle[0] = config.getfloat('Box info', 'rotation angle x')
        self.rot_angle[1] = config.getfloat('Box info', 'rotation angle y')
        self.rot_angle[2] = config.getfloat('Box info', 'rotation angle z')

        self.array_mu_x = np.zeros(self.n_control_points)
        self.array_mu_y = np.zeros(self.n_control_points)
        self.array_mu_z = np.zeros(self.n_control_points)

        mux = config.get('Parameters weights', 'parameter x')
        muy = config.get('Parameters weights', 'parameter y')
        muz = config.get('Parameters weights', 'parameter z')

        for line in mux.split('\n'):
            values = np.array(line.split())
            self.array_mu_x[tuple(map(int, values[0:3]))] = float(values[3])

        for line in muy.split('\n'):
            values = line.split()
            self.array_mu_y[tuple(map(int, values[0:3]))] = float(values[3])

        for line in muz.split('\n'):
            values = line.split()
            self.array_mu_z[tuple(map(int, values[0:3]))] = float(values[3])
def read_parameters ( self , filename = 'parameters.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. if not os . path . isfile ( filename ) : self . write_parameters ( filename ) return config = configparser . RawConfigParser ( ) config . read ( filename ) self . n_control_points [ 0 ] = config . getint ( 'Box info' , 'n control points x' ) self . n_control_points [ 1 ] = config . getint ( 'Box info' , 'n control points y' ) self . n_control_points [ 2 ] = config . getint ( 'Box info' , 'n control points z' ) self . box_length [ 0 ] = config . getfloat ( 'Box info' , 'box length x' ) self . box_length [ 1 ] = config . getfloat ( 'Box info' , 'box length y' ) self . box_length [ 2 ] = config . getfloat ( 'Box info' , 'box length z' ) self . box_origin [ 0 ] = config . getfloat ( 'Box info' , 'box origin x' ) self . box_origin [ 1 ] = config . getfloat ( 'Box info' , 'box origin y' ) self . box_origin [ 2 ] = config . getfloat ( 'Box info' , 'box origin z' ) self . rot_angle [ 0 ] = config . getfloat ( 'Box info' , 'rotation angle x' ) self . rot_angle [ 1 ] = config . getfloat ( 'Box info' , 'rotation angle y' ) self . rot_angle [ 2 ] = config . getfloat ( 'Box info' , 'rotation angle z' ) self . array_mu_x = np . zeros ( self . n_control_points ) self . array_mu_y = np . zeros ( self . n_control_points ) self . array_mu_z = np . zeros ( self . n_control_points ) mux = config . get ( 'Parameters weights' , 'parameter x' ) muy = config . get ( 'Parameters weights' , 'parameter y' ) muz = config . get ( 'Parameters weights' , 'parameter z' ) for line in mux . split ( '\n' ) : values = np . array ( line . split ( ) ) self . array_mu_x [ tuple ( map ( int , values [ 0 : 3 ] ) ) ] = float ( values [ 3 ] ) for line in muy . split ( '\n' ) : values = line . split ( ) self . array_mu_y [ tuple ( map ( int , values [ 0 : 3 ] ) ) ] = float ( values [ 3 ] ) for line in muz . split ( '\n' ) : values = line . split ( ) self . array_mu_z [ tuple ( map ( int , values [ 0 : 3 ] ) ) ] = float ( values [ 3 ] )