Loading pysen/inout/hdf.py +6 −4 Original line number Diff line number Diff line Loading @@ -215,12 +215,12 @@ def convert_to_hdf(filename, outdir, **kwargs): log = logging.getLogger() # basename = os.path.basename(filename) filetype = get_nsefiletype(filename) if filetype=='application/nse-echo-hdf': file_type = get_nsefiletype(filename) if file_type=='application/nse-echo-hdf': log.info('file %s already converted to HDF5', basename) return filename # outfile = make_h5filename(basename, outdir=outdir, filetype=filetype) outfile = make_h5filename(basename, outdir=outdir, filetype=file_type) log.info('converting %s to HDF5', basename) if not overwrite and is_file_newer(outfile, filename): log.info('file %s is newer than %s', outfile, filename) Loading @@ -229,9 +229,11 @@ def convert_to_hdf(filename, outdir, **kwargs): # convert to h5 converter = HdfConverter(version=version_info()) if data_type is None: # guess data type based on file reader = DATA_READER.get(filetype) reader = DATA_READER.get(file_type) else: # data type given reader = DATA_READER.get(data_type) if reader is None: raise RuntimeError(f"Don't know how to handle {file_type} file") converter.data = reader(filename) converter.write(outfile, mode=mode, compression=compression) return outfile Loading pysen/plot/nseplotlib.py +14 −2 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ def plot_atari(hdfile, iecho=None, **kwargs): p = ax.errorbar(cur[:nph], pha, yerr=epha, fmt='.', lw=1) dcol = p[0].get_color() ax.plot(xef, yef, '--') ax.axvline(phase0, color='blue', lw=1, ls='--', label=rf'{phase0:.4fA}' ) ax.axvline(phase0, color='blue', lw=1, ls='--', label=rf'{phase0:.4f}' ) ax.axvline(phase_ef, color='red', lw=2, ls='-', label=rf'({phase_ef:.4f}$\pm${phase_err:.2g})') Loading Loading @@ -671,8 +671,20 @@ def action_default(filenames, **kwargs): taus = kwargs.pop('taus') savefig = kwargs.pop('savefig') log = logging.getLogger() new_filenames = [] # FIX THIS MESSS for filename in filenames: try: outfile = convert_files(filename, converter='from_taco', **kwargs) new_filenames.extend(outfile) except (OSError,RuntimeError) as exc: log.error("%s",format(exc)) except KeyboardInterrupt: break try: for filename in convert_files(*filenames, converter='from_taco', **kwargs): for filename in new_filenames: basename = os.path.basename(filename) with h5py.File(filename, 'r') as hdf5file: action(hdf5file, taus, **kwargs) Loading Loading
pysen/inout/hdf.py +6 −4 Original line number Diff line number Diff line Loading @@ -215,12 +215,12 @@ def convert_to_hdf(filename, outdir, **kwargs): log = logging.getLogger() # basename = os.path.basename(filename) filetype = get_nsefiletype(filename) if filetype=='application/nse-echo-hdf': file_type = get_nsefiletype(filename) if file_type=='application/nse-echo-hdf': log.info('file %s already converted to HDF5', basename) return filename # outfile = make_h5filename(basename, outdir=outdir, filetype=filetype) outfile = make_h5filename(basename, outdir=outdir, filetype=file_type) log.info('converting %s to HDF5', basename) if not overwrite and is_file_newer(outfile, filename): log.info('file %s is newer than %s', outfile, filename) Loading @@ -229,9 +229,11 @@ def convert_to_hdf(filename, outdir, **kwargs): # convert to h5 converter = HdfConverter(version=version_info()) if data_type is None: # guess data type based on file reader = DATA_READER.get(filetype) reader = DATA_READER.get(file_type) else: # data type given reader = DATA_READER.get(data_type) if reader is None: raise RuntimeError(f"Don't know how to handle {file_type} file") converter.data = reader(filename) converter.write(outfile, mode=mode, compression=compression) return outfile Loading
pysen/plot/nseplotlib.py +14 −2 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ def plot_atari(hdfile, iecho=None, **kwargs): p = ax.errorbar(cur[:nph], pha, yerr=epha, fmt='.', lw=1) dcol = p[0].get_color() ax.plot(xef, yef, '--') ax.axvline(phase0, color='blue', lw=1, ls='--', label=rf'{phase0:.4fA}' ) ax.axvline(phase0, color='blue', lw=1, ls='--', label=rf'{phase0:.4f}' ) ax.axvline(phase_ef, color='red', lw=2, ls='-', label=rf'({phase_ef:.4f}$\pm${phase_err:.2g})') Loading Loading @@ -671,8 +671,20 @@ def action_default(filenames, **kwargs): taus = kwargs.pop('taus') savefig = kwargs.pop('savefig') log = logging.getLogger() new_filenames = [] # FIX THIS MESSS for filename in filenames: try: outfile = convert_files(filename, converter='from_taco', **kwargs) new_filenames.extend(outfile) except (OSError,RuntimeError) as exc: log.error("%s",format(exc)) except KeyboardInterrupt: break try: for filename in convert_files(*filenames, converter='from_taco', **kwargs): for filename in new_filenames: basename = os.path.basename(filename) with h5py.File(filename, 'r') as hdf5file: action(hdf5file, taus, **kwargs) Loading