示例#1
0
import time
import glob
import argparse
import os
from collections import defaultdict

import composition.support_functions.simfunctions as simfunctions
import composition.support_functions.paths as paths
from composition.support_functions.checkdir import checkdir
# from ShowerLLH_scripts.analysis.zfix import zfix


if __name__ == "__main__":
    # Setup global path names
    mypaths = paths.Paths()
    checkdir(mypaths.comp_data_dir)

    p = argparse.ArgumentParser(
        description='Runs extra modules over a given fileList')
    p.add_argument('-o', '--outfile', dest='outfile',
                   help='Output file')
    args = p.parse_args()

    dataframe_dict = defaultdict(list)

    # Get simulation information
    t_sim = time.time()
    print('Loading simulation information...')
    file_list = sorted(glob.glob(mypaths.comp_data_dir +
                          '/IT73_sim/files/sim_????.hdf5'))
    value_keys = ['IceTopMaxSignal',
                   dest='outdir',
                   default='/home/jbourbeau/public_html/figures/composition',
                   help='Output directory')
    p.add_argument('-e',
                   '--energy',
                   dest='energy',
                   default='MC',
                   choices=['MC', 'reco'],
                   help='Option for a variety of preset bin values')
    p.add_argument('--extended',
                   dest='extended',
                   default=False,
                   action='store_true',
                   help='Use extended energy range')
    args = p.parse_args()
    checkdir(args.outdir + '/')

    # Import ShowerLLH sim reconstructions and cuts to be made
    df, cut_dict = load_sim(return_cut_dict=True)
    selection_mask = np.array([True] * len(df))
    standard_cut_keys = [
        'reco_exists', 'reco_zenith', 'reco_IT_containment',
        'IceTopMaxSignalInEdge', 'IceTopMaxSignal', 'NChannels',
        'LF_InIce_containment'
    ]
    # standard_cut_keys = ['reco_exists', 'reco_zenith', 'reco_IT_containment',
    #                      'IceTopMaxSignalInEdge', 'IceTopMaxSignal', 'NChannels', 'InIce_containment']
    for key in standard_cut_keys:
        selection_mask *= cut_dict[key]

    df = df[selection_mask]