Esempio n. 1
0
def entry():
    args = docopt(__doc__)
    files = args['<INPUT>']
    aux_basepath = convert_text(args['--aux_basepath'])
    max_events = convert_int(args['--max_events'])
    dark_filename = args['--dark']
    output = convert_text(args['--output'])
    output_path = os.path.dirname(output)
    if output_path != "" and not os.path.exists(output_path):
        raise IOError('Path ' + output_path +
                      'for output hillas does not exists \n')
    bad_pixels = convert_list_int(args['--bad_pixels'])
    integral_width = convert_int(args['--integral_width'])
    picture_threshold = convert_float(args['--picture_threshold'])
    boundary_threshold = convert_float(args['--boundary_threshold'])
    debug = args['--debug']
    parameters_filename = convert_text(args['--parameters'])
    template_filename = convert_text(args['--template'])
    nevent_plot = convert_int(args['--nevent_plot'])
    event_plot_filename = convert_text(args['--event_plot_filename'])
    disable_bar = args['--disable_bar']
    saturation_threshold = convert_float(args['--saturation_threshold'])
    threshold_pulse = convert_float(args['--threshold_pulse'])
    wdw_number = convert_int(args['--wdw_number'])
    apply_corr_factor = args['--apply_corr_factor']
    if aux_basepath is not None and aux_basepath.lower() == "search":
        input_dir = np.unique([os.path.dirname(file) for file in files])
        if len(input_dir) > 1:
            raise AttributeError(
                "Input files must be from the same directory " +
                "when searching for auxiliaries files")
        input_dir = input_dir[0]
        aux_basepath = input_dir.replace('/raw/', '/aux/')
        if not os.path.isdir(aux_basepath):
            aux_basepath = aux_basepath.replace('/SST1M_01', '/SST1M01')
        if not os.path.isdir(aux_basepath):
            raise AttributeError("Searching for auxiliaries files failed. " +
                                 "Please use --aux_basepath=PATH")
        print('expecting aux files in', aux_basepath)
    main_pipeline(
        files=files,
        aux_basepath=aux_basepath,
        max_events=max_events,
        dark_filename=dark_filename,
        integral_width=integral_width,
        debug=debug,
        parameters_filename=parameters_filename,
        hillas_filename=output,
        picture_threshold=picture_threshold,
        boundary_threshold=boundary_threshold,
        template_filename=template_filename,
        bad_pixels=bad_pixels,
        disable_bar=disable_bar,
        threshold_pulse=threshold_pulse,
        saturation_threshold=saturation_threshold,
        nevent_plot=nevent_plot,
        event_plot_filename=event_plot_filename,
        wdw_number=wdw_number,
        apply_corr_factor=apply_corr_factor,
    )
Esempio n. 2
0
def entry():
    args = docopt(__doc__)
    files = np.atleast_1d(args['<INPUTS>'])
    aux_basepath = convert_text(args['--aux_basepath'])
    if aux_basepath.lower() == "search":
        input_dir = np.unique([os.path.dirname(file) for file in files])
        if len(input_dir) > 1:
            raise AttributeError(
                "Input files must be from the same directory " +
                "when searching for auxiliaries files"
            )
        input_dir = input_dir[0]
        aux_basepath = input_dir.replace('/raw/', '/aux/')
        if not os.path.isdir(aux_basepath):
            aux_basepath = aux_basepath.replace('/SST1M_01', '/SST1M01')
        if not os.path.isdir(aux_basepath):
            raise AttributeError(
                "Searching for auxiliaries files failed. " +
                "Please use --aux_basepath=PATH"
            )
        print('expecting aux files in', aux_basepath)
    dark_histo_file = convert_text(args['--dark_hist'])
    param_file = convert_text(args['--parameters'])
    if param_file is None:
        param_file = resource_filename(
            'digicampipe',
            os.path.join(
                'tests',
                'resources',
                'calibration_20180814.yml'
            )
        )
    template_filename = convert_text(args['--template'])
    if template_filename is None:
        template_filename = resource_filename(
            'digicampipe',
            os.path.join(
                'tests',
                'resources',
                'pulse_template_all_pixels.txt'
            )
        )
    output = convert_text(args['--output'])
    max_events = convert_int(args['--max_events'])
    plot = convert_text(args['--plot'])
    norm = convert_text(args['--norm'])
    plot_baselines = args['--plot_baselines']
    bias_resistance = convert_float(args['--bias_resistance']) * u.Ohm
    cell_capacitance = convert_float(args['--cell_capacitance']) * u.Farad
    nsb_rate(
        files, aux_basepath, dark_histo_file, param_file, template_filename,
        output=output, norm=norm, plot_baselines=plot_baselines,
        plot=plot, bias_resistance=bias_resistance, max_events=max_events,
        stars=True, cell_capacitance=cell_capacitance
    )
Esempio n. 3
0
def entry():
    args = docopt(__doc__)
    baseline_histo_file = args['<INPUT>']
    dark_histo_file = convert_text(args['--dark_hist'])
    param_file = convert_text(args['--parameters'])
    template_filename = convert_text(args['--template'])
    plot = convert_text(args['--plot'])
    bias_resistance = convert_float(args['--bias_resistance']) * u.Ohm
    cell_capacitance = convert_float(args['--cell_capacitance']) * u.Farad
    nsb_rate(
        baseline_histo_file, dark_histo_file, param_file, template_filename,
        plot=plot, bias_resistance=bias_resistance,
        cell_capacitance=cell_capacitance
    )
Esempio n. 4
0
def entry():
    args = docopt(__doc__)
    files = args['<INPUT>']
    ac_levels = convert_list_int(args['--ac_levels'])
    dc_levels = convert_list_int(args['--dc_levels'])
    if len(dc_levels) == 1:
        dc_levels = [
            dc_levels[0],
        ] * len(ac_levels)
    assert len(ac_levels) == len(files)
    max_events = convert_int(args['--max_events'])
    delay_step_ns = convert_float(args['--delay_step_ns'])
    time_range_ns = convert_list_float(args['--time_range_ns'])
    normalize_range = convert_list_int(args['--normalize_range'])
    sampling_ns = 4
    parameters = convert_text(args['--parameters'])
    template = convert_text(args['--template'])
    output = convert_text(args['--output'])
    if parameters is None:
        parameters = parameters_default
    if template is None:
        template = template_default
    main(files=files,
         ac_levels=ac_levels,
         dc_levels=dc_levels,
         max_events=max_events,
         delay_step_ns=delay_step_ns,
         time_range_ns=time_range_ns,
         sampling_ns=sampling_ns,
         normalize_range=normalize_range,
         parameters=parameters,
         template=template,
         adc_noise=1.,
         output=output)
def entry():
    args = docopt(__doc__)
    files = args['<INPUT>']
    if len(files) == 1:
        # allow for the input filename to contain a wildcard "*"
        files = glob(files[0])
    print('files:', files)
    summary_filename = convert_text(args['--plot_summary'])
    resolution_filename = convert_text(args['--plot_resolution'])
    offset_filename = convert_text(args['--plot_offset'])
    legend = convert_text(args['--legend'])
    rms_difference_filename = convert_text(args['--plot_rms_difference'])
    n_pe = convert_float(args['--n_pe_rms_difference'])
    with TemporaryDirectory() as temp_dir:
        data_combined = os.path.join(temp_dir, 'time_resolution_test.npz')
        combine(files, data_combined)
        if summary_filename is not None:
            plot_all(data_combined, legend=legend)
            if summary_filename.lower() != "show":
                plt.savefig(summary_filename)
                print(summary_filename, 'created')
            else:
                plt.show()
            plt.close()
        if offset_filename is not None:
            plot_offset(data_combined, legend=legend)
            if offset_filename.lower() != "show":
                plt.savefig(offset_filename)
                print(offset_filename, 'created')
            else:
                plt.show()
            plt.close()
        if resolution_filename is not None:
            plot_resol(data_combined, legend=legend)
            if resolution_filename.lower() != "show":
                plt.savefig(resolution_filename)
                print(resolution_filename, 'created')
            else:
                plt.show()
            plt.close()
        if rms_difference_filename is not None:
            plot_rms_difference(data_combined, n_pe=n_pe)
            if rms_difference_filename.lower() != "show":
                plt.savefig(rms_difference_filename)
                print(rms_difference_filename, 'created')
            else:
                plt.show()
            plt.close()