Loading pysen/config.py +4 −5 Original line number Diff line number Diff line Loading @@ -330,8 +330,9 @@ def coverage(lmax, qmin, **kwargs): results['tau_max'] = tau_max results.update(_write_ql_min_max(qmin, lmax, dlam)) out.write('q=({qmin:.3f},{qmax:.3f}), ' 'lambda=({lmin:.2f},{lmax:.2f})\n' 'lambda=({lmin:.2f},{lmax:.2f}) ' .format(**results)) out.write( "tau=({0:.1f},{1:.1f})ns\n".format(tau_min, tau_max) ) plot_data = [] for it1, it2 in zip(tbin1, tbin2): l1 = l_binning(lmax, it1, dlam=dlam, nt=ntbin) Loading Loading @@ -364,10 +365,8 @@ def coverage(lmax, qmin, **kwargs): t1, t2 = tau_limits(lq/q, mode) limits.append((q, t1, t2)) results['info'] = ( "q={0:.3f}/A, lambda={1:.2f}A, " "phi={2:.1f}deg, tau_range=({3:.1f},{4:.1f})ns" .format(qmin, lmax, degrees(theta0), tau_min, tau_max) ) results['info'] = ( "q={0:.3f}/A, lambda={1:.2f}A, phi={2:.1f}deg" .format(qmin, lmax, degrees(theta0)) ) results['limits'] = limits results['details'] = out.getvalue() return results pysen/inout/hdf.py +2 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,9 @@ def convert_to_hdf(filename, outdir, data_type='echo', **kwargs): if t_out > t_src: _log.info('file %s is newer than %s', outfile, filename) return outfile converter = HdfConverter(outfile, mode=mode, version=version_info()) reader = data_reader.get(data_type, None) data = reader(filename) converter = HdfConverter(outfile, mode=mode, version=version_info()) converter.write(data, compression=compression, schema=schema) return outfile Loading @@ -219,7 +219,7 @@ def xyz_to_hdf(filename, outdir, **kwargs): outfile, _ = os.path.splitext(os.path.basename(filename)) outfile = os.path.join(outdir, outfile + ".h5") converter = HdfConverter(outfile, mode=mode, version=version_info()) data = read_xyz(filename) converter = HdfConverter(outfile, mode=mode, version=version_info()) converter.write(data, compression=compression, schema=schema) return outfile pysen/inout/reader.py +1 −1 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ def read_sample_info(fdesc): continue result.update(parse_keywords(line)) if not comment: raise RuntimeError('Sample comment missing') raise RuntimeError('sample comment is missing') for cline in comment: if cline.startswith('automatic_date'): result.update(parse_keywords(cline, mode=4)) Loading pysen/plot/nseplot.py +16 −11 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ nseplot: command line interface to pysen modules import os.path import argparse import functools import logging import h5py import numpy as np Loading @@ -26,6 +27,7 @@ def action_default(filenames, **kwargs): tau = kwargs.pop('tau') outdir = kwargs.pop('outdir') savefig = kwargs.pop('savefig') log = logging.getLogger() for filename in filenames: try: basename , ext = os.path.splitext(os.path.basename(filename)) Loading @@ -35,8 +37,8 @@ def action_default(filenames, **kwargs): action(hdf5file, tau, **kwargs) if savefig: plt.savefig(basename+'-'+savefig) except FileNotFoundError as exc: print(exc) except (OSError,KeyError,RuntimeError) as exc: log.error("%s",format(exc)) # action_echo = functools.partial(action_default, action=plot_echo) action_atari = functools.partial(action_default, action=plot_atari) Loading Loading @@ -362,21 +364,23 @@ def add_qtau_options(subparser, parents=None): help='set instrument position: (default %(default)s)') pars.add_argument('--mode', '-m', dest='mode', choices=INST_MODES, help='set instrument (default %(default)s)') pars.add_argument('--taus', metavar='tau', type=float, nargs='*', help='select list of taus') pars.add_argument('--tbins', metavar='tbin', type=int, nargs='*', help='select list of tbins') pars.add_argument('--taus', metavar='tau', type=float, nargs='*', action='extend', help='select list of taus') pars.add_argument('--tbins', metavar='tbin', type=int, nargs='*', action='extend', help='select list of tbins') grp = pars.add_argument_group('presentation options') grp.add_argument('--title', dest='title', help='set plot title') grp.add_argument('--full', '-F', dest='full', action='store_true', help='full detecor coverage (default: only for the center)') grp.add_argument('--no-errors', '-e', dest='errors', action='store_false', grp.add_argument('--no-errors', '-E', dest='errors', action='store_false', help='do not plot errors on q/tau averages') grp.add_argument('--no-center', '-c', dest='center', action='store_false', help='TBD') grp.add_argument('--no-legend', dest='legend', action='store_false', help='do not show plot legend') #grp.add_argument('--no-center', dest='center', action 'store_false', # help='TBD') grp.add_argument('--color-map', '-C', dest='cmap', metavar='map', help='set colormap to use (default=%(default)s)') grp.add_argument('--title', dest='title', help='set plot title') help='select colormap to use (default=%(default)s)') Loading @@ -403,11 +407,12 @@ def main(): parser = argparse.ArgumentParser(description=description) parser.set_defaults(loglevel=DEFAULT_LOG_LEVEL) parser.add_argument('--version', '-V', action='version', version='%(prog)s pysen={version}'.format(version=version(full=True))) subparsers = parser.add_subparsers(dest='plot', required=True, help='plot command', description=None) parser.add_argument('--commands', action='version', version='waka') parser.add_argument('--version', '-V', action='version', version='%(prog)s pysen={version}'.format(version=version(full=True))) # echo plot add_echo_options(subparsers, parents=[pars_com, pars_tof, pars_pix]) # atari plot Loading pysen/plot/nseplotlib.py +1 −1 Original line number Diff line number Diff line Loading @@ -526,7 +526,7 @@ def plot_echo(hdfile, iecho=0, **kwargs): res['dn'] = np.average(dn), np.sqrt(np.sum(dn)/len(dn)) R = 2*res['amplitude'][0]/( res['up'][0] - res['dn'][0] ) resolution.append((tau0, R)) log.info("%g %g",tau0,R) log.info("tau={0:.3g}ns R={1:.3g}".format(tau0,R)) # if resolution_plot: continue Loading Loading
pysen/config.py +4 −5 Original line number Diff line number Diff line Loading @@ -330,8 +330,9 @@ def coverage(lmax, qmin, **kwargs): results['tau_max'] = tau_max results.update(_write_ql_min_max(qmin, lmax, dlam)) out.write('q=({qmin:.3f},{qmax:.3f}), ' 'lambda=({lmin:.2f},{lmax:.2f})\n' 'lambda=({lmin:.2f},{lmax:.2f}) ' .format(**results)) out.write( "tau=({0:.1f},{1:.1f})ns\n".format(tau_min, tau_max) ) plot_data = [] for it1, it2 in zip(tbin1, tbin2): l1 = l_binning(lmax, it1, dlam=dlam, nt=ntbin) Loading Loading @@ -364,10 +365,8 @@ def coverage(lmax, qmin, **kwargs): t1, t2 = tau_limits(lq/q, mode) limits.append((q, t1, t2)) results['info'] = ( "q={0:.3f}/A, lambda={1:.2f}A, " "phi={2:.1f}deg, tau_range=({3:.1f},{4:.1f})ns" .format(qmin, lmax, degrees(theta0), tau_min, tau_max) ) results['info'] = ( "q={0:.3f}/A, lambda={1:.2f}A, phi={2:.1f}deg" .format(qmin, lmax, degrees(theta0)) ) results['limits'] = limits results['details'] = out.getvalue() return results
pysen/inout/hdf.py +2 −2 Original line number Diff line number Diff line Loading @@ -205,9 +205,9 @@ def convert_to_hdf(filename, outdir, data_type='echo', **kwargs): if t_out > t_src: _log.info('file %s is newer than %s', outfile, filename) return outfile converter = HdfConverter(outfile, mode=mode, version=version_info()) reader = data_reader.get(data_type, None) data = reader(filename) converter = HdfConverter(outfile, mode=mode, version=version_info()) converter.write(data, compression=compression, schema=schema) return outfile Loading @@ -219,7 +219,7 @@ def xyz_to_hdf(filename, outdir, **kwargs): outfile, _ = os.path.splitext(os.path.basename(filename)) outfile = os.path.join(outdir, outfile + ".h5") converter = HdfConverter(outfile, mode=mode, version=version_info()) data = read_xyz(filename) converter = HdfConverter(outfile, mode=mode, version=version_info()) converter.write(data, compression=compression, schema=schema) return outfile
pysen/inout/reader.py +1 −1 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ def read_sample_info(fdesc): continue result.update(parse_keywords(line)) if not comment: raise RuntimeError('Sample comment missing') raise RuntimeError('sample comment is missing') for cline in comment: if cline.startswith('automatic_date'): result.update(parse_keywords(cline, mode=4)) Loading
pysen/plot/nseplot.py +16 −11 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ nseplot: command line interface to pysen modules import os.path import argparse import functools import logging import h5py import numpy as np Loading @@ -26,6 +27,7 @@ def action_default(filenames, **kwargs): tau = kwargs.pop('tau') outdir = kwargs.pop('outdir') savefig = kwargs.pop('savefig') log = logging.getLogger() for filename in filenames: try: basename , ext = os.path.splitext(os.path.basename(filename)) Loading @@ -35,8 +37,8 @@ def action_default(filenames, **kwargs): action(hdf5file, tau, **kwargs) if savefig: plt.savefig(basename+'-'+savefig) except FileNotFoundError as exc: print(exc) except (OSError,KeyError,RuntimeError) as exc: log.error("%s",format(exc)) # action_echo = functools.partial(action_default, action=plot_echo) action_atari = functools.partial(action_default, action=plot_atari) Loading Loading @@ -362,21 +364,23 @@ def add_qtau_options(subparser, parents=None): help='set instrument position: (default %(default)s)') pars.add_argument('--mode', '-m', dest='mode', choices=INST_MODES, help='set instrument (default %(default)s)') pars.add_argument('--taus', metavar='tau', type=float, nargs='*', help='select list of taus') pars.add_argument('--tbins', metavar='tbin', type=int, nargs='*', help='select list of tbins') pars.add_argument('--taus', metavar='tau', type=float, nargs='*', action='extend', help='select list of taus') pars.add_argument('--tbins', metavar='tbin', type=int, nargs='*', action='extend', help='select list of tbins') grp = pars.add_argument_group('presentation options') grp.add_argument('--title', dest='title', help='set plot title') grp.add_argument('--full', '-F', dest='full', action='store_true', help='full detecor coverage (default: only for the center)') grp.add_argument('--no-errors', '-e', dest='errors', action='store_false', grp.add_argument('--no-errors', '-E', dest='errors', action='store_false', help='do not plot errors on q/tau averages') grp.add_argument('--no-center', '-c', dest='center', action='store_false', help='TBD') grp.add_argument('--no-legend', dest='legend', action='store_false', help='do not show plot legend') #grp.add_argument('--no-center', dest='center', action 'store_false', # help='TBD') grp.add_argument('--color-map', '-C', dest='cmap', metavar='map', help='set colormap to use (default=%(default)s)') grp.add_argument('--title', dest='title', help='set plot title') help='select colormap to use (default=%(default)s)') Loading @@ -403,11 +407,12 @@ def main(): parser = argparse.ArgumentParser(description=description) parser.set_defaults(loglevel=DEFAULT_LOG_LEVEL) parser.add_argument('--version', '-V', action='version', version='%(prog)s pysen={version}'.format(version=version(full=True))) subparsers = parser.add_subparsers(dest='plot', required=True, help='plot command', description=None) parser.add_argument('--commands', action='version', version='waka') parser.add_argument('--version', '-V', action='version', version='%(prog)s pysen={version}'.format(version=version(full=True))) # echo plot add_echo_options(subparsers, parents=[pars_com, pars_tof, pars_pix]) # atari plot Loading
pysen/plot/nseplotlib.py +1 −1 Original line number Diff line number Diff line Loading @@ -526,7 +526,7 @@ def plot_echo(hdfile, iecho=0, **kwargs): res['dn'] = np.average(dn), np.sqrt(np.sum(dn)/len(dn)) R = 2*res['amplitude'][0]/( res['up'][0] - res['dn'][0] ) resolution.append((tau0, R)) log.info("%g %g",tau0,R) log.info("tau={0:.3g}ns R={1:.3g}".format(tau0,R)) # if resolution_plot: continue Loading