Write the parameters to a file as a human-readable series of dicts.

        :type filename: str
        :param filename: File to write to
        :type append: bool
        :param append: Append to already existing file or over-write.
977220
def write(self, filename, append=True):
        
        header = ' '.join(['# User:', getpass.getuser(),
                           '\n# Creation date:', str(UTCDateTime()),
                           '\n# EQcorrscan version:',
                           str(eqcorrscan.__version__),
                           '\n\n\n'])
        if append:
            f = open(filename, 'a')
        else:
            f = open(filename, 'w')
            f.write(header)
        parameters = self.__dict__
        f.write(str(parameters))
        f.write('\n')
        f.close()
        return
713204
def writeToFile(self, filename, saveOpts=False):
        '''
        
        '''
        try:
            if not filename.endswith('.%s' % self.ftype):
                filename += '.%s' % self.ftype
            s = {'coeffs': self.coeffs}
            if saveOpts:
                s['opts'] = self.opts
#             else:
#                 s['opts':{}]
            np.savez(filename, **s)
            return filename
        except AttributeError:
            raise Exception(
                'need to calibrate camera before calibration can be saved to file')
1326266
def write_config(filename, config, mode="w"):
    '''
    '''
    with open(filename, mode) as filey:
        config.write(filey)
    return filename
3331
def make_filenames(self, **kwargs):
        
        out_dict = dict(ft1file=self.ft1file(**kwargs),
                        ltcube=self.ltcube(**kwargs),
                        ccube=self.ccube(**kwargs),
                        bexpcube=self.bexpcube(**kwargs),
                        srcmaps=self.srcmaps(**kwargs),
                        mcube=self.mcube(**kwargs))
        return out_dict
1266230
def to_file(self, filename):
		
		with open(filename, 'wb') as f:
			f.write(self.to_bytes())
129628
def write_file(filename, string):
    """"""
    import sys
    #ugly fix, hopefully we can find a better one
    if sys.version_info[0] >= 3:
        with open(filename, 'w', encoding="utf-8") as f:
            f.write(string)
    else:
        with open(filename, 'w') as f:
            f.write(string.encode("utf-8"))
994016
def write_to_disk(filename, delete=False, content=get_time()):
    
    if not os.path.exists(os.path.dirname(filename)):
        return
    if delete:
        if os.path.lexists(filename):
            os.remove(filename)
    else:
        with open(filename, 'wb') as f:
            f.write(content.encode('utf-8'))
232367
def write_file_lines(self, filename, contents):
        
        with open(filename, 'wb') as f:
            self.log.debug(contents)
            f.writelines(contents)
250180
def toFile(self, filename):
        
        start = _time()
        fd = _open(filename, "w")

        savedData = [self.string, self.unit, self.voc, self.vocSize, self.SA, self.features]

        for featureName in self.features:
            featureValues = getattr(self, "_%s_values" % featureName)
            featureDefault = getattr(self, "%s_default" % featureName)

            savedData.append((featureValues, featureDefault))

        fd.write(_dumps(savedData, _HIGHEST_PROTOCOL))
        fd.flush()
        try:
            self.sizeOfSavedFile = getsize(fd.name)
        except OSError:  # if stdout is used
            self.sizeOfSavedFile = "-1"
        self.toFileTime = _time() - start
        if _trace: print >> _stderr, "toFileTime %.2fs" % self.toFileTime

        if _trace: print >> _stderr, "sizeOfSavedFile %sb" % self.sizeOfSavedFile
        fd.close()
1210706
def write(self, filename):
        """"""
        if file_exists(filename):
            return filename
        out_files = [filename, filename + ".rownames", filename + ".colnames"]
        with file_transaction(out_files) as tx_out_files:
            with open(tx_out_files[0], "wb") as out_handle:
                scipy.io.mmwrite(out_handle, scipy.sparse.csr_matrix(self.matrix))
            pd.Series(self.rownames).to_csv(tx_out_files[1], index=False)
            pd.Series(self.colnames).to_csv(tx_out_files[2], index=False)
        return filename
42909
def save_params_to_file(self, fname: str):
        
        if self.aux_params is not None:
            utils.save_params(self.params.copy(), fname, self.aux_params.copy())
        else:
            utils.save_params(self.params.copy(), fname)
        logging.info('Saved params to "%s"', fname)
437298
def write_file(writer, filename):
  """"""
  for line in txt_line_iterator(filename):
    writer.write(line)
    writer.write("\n")
466260
def write(self, filename):
        
        ext = os.path.splitext(filename)[1]
        writer = open(filename, 'w')
        if ext == '.py':
            writer.write(pprint.pformat(self))
        elif ext == '.yaml':
            writer.write(yaml.dump(self))
        else:
            writer.close()
            raise Exception('Unrecognized config format: %s'%ext)
        writer.close()
1240270
def save_parameters(self, filename):
        
        params = self._collect_params_with_prefix()
        if self.pret_word_embs:  # don't save word embeddings inside model
            params.pop('pret_word_embs.weight', None)
        arg_dict = {key: val._reduce() for key, val in params.items()}
        ndarray.save(filename, arg_dict)
294240
def create_file(self, fileName, contents=""):
        
        with open(fileName, "w") as written_file:
            written_file.write(contents)
360584
def save_to_file(destination_filename, append=False):
    

    def decorator_fn(f):
        @wraps(f)
        def wrapper_fn(*args, **kwargs):
            res = f(*args, **kwargs)

            makedirs(os.path.dirname(destination_filename))
            mode = "a" if append else "w"
            with open(destination_filename, mode) as text_file:
                text_file.write(res)

            return res

        return wrapper_fn

    return decorator_fn
547440
def append_onto_file(self, file_name, msg):
        
        with open(file_name, "a") as heart_file:
            heart_file.write(msg)
            heart_file.close()