(self, filename)
This method writes a parameters file (.prm) called `filename` and fills
        it with all the parameters class members.

        :param string filename: parameters file to be written out.
This method writes a parameters file (.prm) called `filename` and fills
        it with all the parameters class members.
This method writes a parameters file ( . prm ) called filename and fills it with all the parameters class members .
def write_parameters(self, filename):
        """
        This method writes a parameters file (.prm) called `filename` and fills
        it with all the parameters class members.

        :param string filename: parameters file to be written out.
        """
        if not isinstance(filename, str):
            raise TypeError("filename must be a string")

        output_string = ""
        output_string += "\n[Inverse Distance Weighting]\n"
        output_string += "# This section describes the settings of idw.\n\n"
        output_string += "# the power parameter\n"
        output_string += "power = {}\n".format(self.power)

        output_string += "\n\n[Control points]\n"
        output_string += "# This section describes the IDW control points.\n\n"
        output_string += "# original control points collects the coordinates\n"
        output_string += "# of the interpolation control points before the\n"
        output_string += "# deformation.\n"

        output_string += "original control points: "
        output_string += (
            '   '.join(map(str, self.original_control_points[0])) + "\n")
        for points in self.original_control_points[1:]:
            output_string += 25 * ' ' + '   '.join(map(str, points)) + "\n"
        output_string += "\n"
        output_string += "# deformed control points collects the coordinates\n"
        output_string += "# of the interpolation control points after the\n"
        output_string += "# deformation.\n"
        output_string += "deformed control points: "
        output_string += (
            '   '.join(map(str, self.original_control_points[0])) + "\n")
        for points in self.deformed_control_points[1:]:
            output_string += 25 * ' ' + '   '.join(map(str, points)) + "\n"

        with open(filename, 'w') as f:
            f.write(output_string)
def write_parameters ( self , filename ) : if not isinstance ( filename , str ) : raise TypeError ( "filename must be a string" ) output_string = "" output_string += "\n[Inverse Distance Weighting]\n" output_string += "# This section describes the settings of idw.\n\n" output_string += "# the power parameter\n" output_string += "power = {}\n" . format ( self . power ) output_string += "\n\n[Control points]\n" output_string += "# This section describes the IDW control points.\n\n" output_string += "# original control points collects the coordinates\n" output_string += "# of the interpolation control points before the\n" output_string += "# deformation.\n" output_string += "original control points: " output_string += ( '   ' . join ( map ( str , self . original_control_points [ 0 ] ) ) + "\n" ) for points in self . original_control_points [ 1 : ] : output_string += 25 * ' ' + '   ' . join ( map ( str , points ) ) + "\n" output_string += "\n" output_string += "# deformed control points collects the coordinates\n" output_string += "# of the interpolation control points after the\n" output_string += "# deformation.\n" output_string += "deformed control points: " output_string += ( '   ' . join ( map ( str , self . original_control_points [ 0 ] ) ) + "\n" ) for points in self . deformed_control_points [ 1 : ] : output_string += 25 * ' ' + '   ' . join ( map ( str , points ) ) + "\n" with open ( filename , 'w' ) as f : f . write ( output_string )