def dlmwrite(file, data, delim="\t", newln=bf.newlineChar(), head="", foot="", commentStr="", append="off", format="%.5g"): if append == "on": fid = open(file, 'ab') np.savetxt(fid, data, fmt=format, delimiter=delim, newline=newln, header=head, footer=foot, comments=commentStr) fid.close() else: np.savetxt(file, data, fmt=format, delimiter=delim, newline=newln, header=head, footer=foot, comments=commentStr)
def universalplotS33Header(): fileHead = ['tau_um', 'dStar100_nm', 'dStar100Dev', 's33', 'dev_s33', 'hkl'] return bf.stringList2string(fileHead, delim='\t') + bf.newlineChar()
def universalplotHeader(): fileHead = ['tau_um', 's11-s33', 'dev_s11', 's22-s33', 'dev_s22', 's13', 'dev_s13', 's23', 'dev_s23', 'hkl', 'psi'] return bf.stringList2string(fileHead, delim='\t') + bf.newlineChar()
def sin2PsiHeader(): fileHead = ['hkl', 'tau_um', 'dStar100_nm', 'dStar100Dev', 's11-s33', 'dev_s11', 's22-s33', 'dev_s22', 's13', 'dev_s13', 's23', 'dev_s23', 's12', 'dev_s12', 's33', 'dev_s33', 'IBs_keV'] return bf.stringList2string(fileHead, delim='\t') + bf.newlineChar()
def writeLine(fileId, data): fileId.write(data + bf.newlineChar())