示例#1
0
import itertools
from fastespy.plotting import plot_2d_hist, new_cmap, plot_scatter_w_hist
from fastespy.analysis import init_logging
from fastespy import functions
import glob
import matplotlib.pyplot as plt

if __name__ == '__main__':
    usage = "usage: %(prog)s -i indir -o outdir "
    description = "Plot some results on pulse fit results"

    parser = argparse.ArgumentParser(usage=usage, description=description)
    parser.add_argument('-i', '--indir', required=True, help='Path with cobmined npy files for all triggers')
    parser.add_argument('-o', '--outdir', required=True, help='Path to output file')
    args = parser.parse_args()
    init_logging("INFO", color=True)

    # First, we get the data path where
    # the collected results from the pulse shape fit that were read
    # in with `read_result_pulse_shape_triggered.py` are stored.

    file_list = glob.glob(os.path.join(args.indir, "*.npy"))
    if not len(file_list):
        raise ValueError("No files found")

    for i, result_file in enumerate(file_list):
        logging.info("Reading {0:s}".format(result_file))
        r = np.load(result_file, allow_pickle=True).flat[0]
        if not i:
            result = r
        else:
    parser.add_argument('--istart',
                        help='Start at this trigger window',
                        type=int)
    parser.add_argument('--istop', help='Stop this trigger window', type=int)
    parser.add_argument('--buildtrigger',
                        help='build own trigger windows'
                        '(i.e. this is a long-term measurement)',
                        type=int,
                        default=0)
    parser.add_argument('--channel',
                        help='Alazar card channel used',
                        type=int,
                        default=0)

    args = parser.parse_args()
    init_logging("WARNING", color=True)

    data = readconvertedpickle(args.infile, channel=args.channel)

    print("There are {0:n} trigger events in data file".format(len(data)))

    outdir = os.path.join(
        os.path.dirname(args.infile),
        "dvdtthr{0:.0f}_vthr{1:.0f}".format(args.dvdt_thr, args.v_thr * 1e3))

    if not os.path.isdir(outdir):
        os.mkdir(outdir)

    # loop through trigger events
    for idata, d in enumerate(data):