def main(): parser = OptionParser(usage=usage) parser.add_option('-o', '--output', metavar='filename', action='store', dest='output_filename', default=None, help=helps['output_filename']) parser.add_option('--rc', type='str', metavar='key=val,...', action='callback', dest='rc', callback=parse_rc, default={}, help=helps['rc']) parser.add_option('-n', '--no-show', action='store_true', dest='no_show', default=False, help=helps['no_show']) options, args = parser.parse_args() if len(args) == 1: filename = args[0] else: parser.print_help() return log, info = read_log(filename) plt.rcParams.update(options.rc) plot_log(1, log, info) if options.output_filename: plt.savefig(options.output_filename) if not options.no_show: plt.show()
def main(): parser = ArgumentParser(description=__doc__, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-o', '--output', metavar='filename', action='store', dest='output_filename', default=None, help=helps['output_filename']) parser.add_argument('--rc', type=str, metavar='key=val,...', action=ParseRc, dest='rc', default={}, help=helps['rc']) parser.add_argument('-n', '--no-show', action='store_true', dest='no_show', default=False, help=helps['no_show']) parser.add_argument('filename') options = parser.parse_args() filename = options.filename log, info = read_log(filename) plt.rcParams.update(options.rc) plot_log(1, log, info) if options.output_filename: plt.savefig(options.output_filename) if not options.no_show: plt.show()
def main(): parser = ArgumentParser(description=__doc__, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-g', '--groups', metavar='int[,int,...]', action='store', dest='groups', default=None, help=helps['groups']) parser.add_argument('-o', '--output', metavar='filename', action='store', dest='output_filename', default=None, help=helps['output_filename']) parser.add_argument('--rc', type=str, metavar='key:val,...', action=ParseRc, dest='rc', default={}, help=helps['rc']) parser.add_argument('-n', '--no-show', action='store_true', dest='no_show', default=False, help=helps['no_show']) parser.add_argument('filename') options = parser.parse_args() filename = options.filename if options.groups is not None: options.groups = [int(ii) for ii in options.groups.split(',')] log, info = read_log(filename) plt.rcParams.update(options.rc) plot_log(None, log, info, groups=options.groups) if options.output_filename: plt.savefig(options.output_filename) if not options.no_show: plt.show()
def test_log_rw(self): from sfepy.base.base import Output from sfepy.base.log import read_log, write_log log, info = read_log(self.log_filename) output = Output('', filename=os.path.join(self.options.out_dir, 'test_log2.txt'), quiet=True) write_log(output, log, info) log2, info2 = read_log(self.log_filename) ok = True _ok = info == info2 if not _ok: self.report('headers are not equal!') self.report(info) self.report(info2) ok = ok and _ok for key, val2 in log2.items(): val = log[key] _ok = nm.allclose(val[0], val2[0], rtol=0.0, atol=1e-14) if not _ok: self.report('x values are not equal!') self.report(val[0]) self.report(val2[0]) ok = ok and _ok _ok = nm.allclose(val[1], val2[1], rtol=0.0, atol=1e-14) if not _ok: self.report('y values are not equal!') self.report(val[1]) self.report(val2[1]) ok = ok and _ok _ok = nm.allclose(val[2], val2[2], rtol=0.0, atol=1e-14) if not _ok: self.report('vlines are not equal!') self.report(val[2]) self.report(val2[2]) ok = ok and _ok return ok
def main(): parser = ArgumentParser(description=__doc__, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-g', '--groups', metavar='int[,int,...]', action='store', dest='groups', default=None, help=helps['groups']) parser.add_argument('-o', '--output', metavar='filename', action='store', dest='output_filename', default=None, help=helps['output_filename']) parser.add_argument('--rc', type=str, metavar='key:val,...', action=ParseRc, dest='rc', default={}, help=helps['rc']) parser.add_argument('--no-legends', action='store_false', dest='show_legends', default=True, help=helps['no_legends']) parser.add_argument('-n', '--no-show', action='store_true', dest='no_show', default=False, help=helps['no_show']) parser.add_argument('filename') options = parser.parse_args() filename = options.filename if options.groups is not None: options.groups = [int(ii) for ii in options.groups.split(',')] log, info = read_log(filename) plt.rcParams.update(options.rc) plot_log(None, log, info, groups=options.groups, show_legends=options.show_legends) if options.output_filename: plt.savefig(options.output_filename) if not options.no_show: plt.show()
def main(): parser = ArgumentParser(description=__doc__, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-g', '--groups', metavar='int[,int,...]', action='store', dest='groups', default=None, help=helps['groups']) parser.add_argument('-o', '--output', metavar='filename', action='store', dest='output_filename', default=None, help=helps['output_filename']) parser.add_argument('--rc', type=str, metavar='key:val,...', action=ParseRc, dest='rc', default={}, help=helps['rc']) parser.add_argument('--no-legends', action='store_false', dest='show_legends', default=True, help=helps['no_legends']) parser.add_argument('--nbins', metavar='nx1,ny1,...', action='store', dest='nbins', default=None, help=helps['nbins']) parser.add_argument('--swap-axes', action='store_true', dest='swap_axes', default=False, help=helps['swap_axes']) parser.add_argument('-n', '--no-show', action='store_true', dest='no_show', default=False, help=helps['no_show']) parser.add_argument('filename') options = parser.parse_args() filename = options.filename if options.groups is not None: options.groups = [int(ii) for ii in options.groups.split(',')] if options.nbins is not None: aux = [int(ii) if ii != 'None' else None for ii in options.nbins.split(',')] xnbins, ynbins = aux[::2], aux[1::2] else: xnbins = ynbins = None log, info = read_log(filename) plt.rcParams.update(options.rc) plot_log(None, log, info, groups=options.groups, xnbins=xnbins, ynbins=ynbins, show_legends=options.show_legends, swap_axes=options.swap_axes) if options.output_filename: plt.savefig(options.output_filename) if not options.no_show: plt.show()