Пример #1
0
                   help='Detector configuration [IT73|IT81]')
    p.add_argument(
        '-o',
        '--outdir',
        dest='outdir',
        default='/home/jbourbeau/public_html/figures/ShowerLLH/qualitycuts',
        help='Output directory')
    p.add_argument('-b',
                   '--bintype',
                   dest='bintype',
                   default='logdist',
                   choices=['standard', 'nozenith', 'logdist'],
                   help='Option for a variety of preset bin values')
    args = p.parse_args()

    sim_reco = load_sim(config=args.config, bintype=args.bintype)
    standard_mask = sim_reco['cuts']['llh']

    eff_area, eff_area_error, energy_midpoints = get_effective_area(
        sim_reco, standard_mask, args.bintype)
    # Plot effective area
    fig, ax = plt.subplots()
    ax.errorbar(energy_midpoints, eff_area, yerr=eff_area_error, marker='.')
    intercept = line_fit(eff_area, eff_area_error, energy_midpoints)
    print('Maximum effective area = {}'.format(intercept))
    high_energy_mask = (energy_midpoints >= 10**6.2)
    high_energies = energy_midpoints[high_energy_mask]
    ax.plot([high_energies[0], high_energies[-1]], [intercept, intercept],
            marker='None',
            linestyle='-',
            color='k')
Пример #2
0
                   '--classifier',
                   dest='classifier',
                   default='RF',
                   choices=['RF', 'KN'],
                   help='Option to specify classifier used')
    p.add_argument('--outdir',
                   dest='outdir',
                   default='/home/jbourbeau/public_html/figures/composition',
                   help='Output directory')
    args = p.parse_args()

    # Throughout this code, X will represent features while y will represent
    # class labels

    # Load and preprocess training data
    df = load_sim()
    feature_list = np.array([
        'reco_log_energy', 'ShowerPlane_cos_zenith', 'InIce_log_charge',
        'NChannels', 'NStations', 'reco_radius', 'reco_InIce_containment',
        'log_s125'
    ])
    num_features = len(feature_list)
    X_train_std, X_test_std, y_train, y_test = get_train_test_sets(
        df, feature_list)

    pipeline = get_pipeline(args.classifier)

    train_sizes, train_scores, test_scores =\
        learning_curve(estimator=pipeline,
                       X=X_train_std,
                       y=y_train,
Пример #3
0
    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]

    MC_proton_mask = (df.MC_comp == 'P')
    MC_iron_mask = (df.MC_comp == 'Fe')