Ejemplo n.º 1
0
def run_freq_step_scan(config):

    # compute number of iterations for frequency step size scan
    n_freq_step = round(
        (config['upper_freq_step_size'] - config['lower_freq_step_size']) /
        config['freq_step_size_increment']) + 1

    # append results in output text file
    config['append_results'] = True

    # loop over the t0 parameters
    for idx_freq in range(0, n_freq_step):

        # set freq step size
        config['freq_step_size'] = round(
            config['lower_freq_step_size'] +
            idx_freq * config['freq_step_size_increment'], 3)

        # check that the number of frequency bins is an integer factor of the freq step size
        freq_window = int(config['upper_freq'] - config['lower_freq'])
        if not ((freq_window / config['freq_step_size']).is_integer()):
            continue

        # disable saving plots
        config['print_plot'] = False

        # instantiate fast rotation class
        fr = fastrotation.FastRotation(config)
        # class method returns numpy arrays of the fast rotation signal
        opt_tS, opt_tM, n_positron_hits, bin_center, bin_content = fr.produce()

        save_default_tM = config['tM']
        save_default_tS = config['tS']

        config['tS'] = round(opt_tS, 6)
        config['tM'] = round(opt_tM, 6)

        # instantiate t0 optimization class
        t0 = t0optimization.Optimize_t0(config, bin_center, bin_content)
        # iterative optimization of t0 (2 iterations are usually enough)
        opt_t0, chi2, noise, fit_boundary1, fit_boundary2 = t0.run_t0_optimization(
        )

        if (config['fix_t0']):
            opt_t0 = config['fixed_t0_value']

        # re-enable saving plots
        config['print_plot'] = True

        # produce results
        results = fourier.Fourier(config, bin_center, bin_content, opt_t0,
                                  noise, fit_boundary1, fit_boundary2,
                                  n_positron_hits)
        results.run()

        del fr, t0, results

        config['tM'] = save_default_tM
        config['tS'] = save_default_tS
Ejemplo n.º 2
0
def run_background_removal_threshold_scan(config):

    # compute number of iterations for frequency step size scan
    n_step = round((config['upper_background_removal_threshold'] -
                    config['lower_background_removal_threshold']) /
                   config['background_removal_threshold_step_size']) + 1

    # append results in output text file
    config['append_results'] = True

    config['remove_background'] = True

    # disable saving plots
    config['print_plot'] = False

    # instantiate fast rotation class
    fr = fastrotation.FastRotation(config)
    # class method returns numpy arrays of the fast rotation signal
    opt_tS, opt_tM, n_positron_hits, bin_center, bin_content = fr.produce()

    save_default_tM = config['tM']
    save_default_tS = config['tS']

    config['tS'] = round(opt_tS, 6)
    config['tM'] = round(opt_tM, 6)

    # instantiate t0 optimization class
    t0 = t0optimization.Optimize_t0(config, bin_center, bin_content)
    # iterative optimization of t0 (2 iterations are usually enough)
    opt_t0, chi2, noise, fit_boundary1, fit_boundary2 = t0.run_t0_optimization(
    )

    if (config['fix_t0']):
        opt_t0 = config['fixed_t0_value']

    # re-enable saving plots
    config['print_plot'] = True

    # loop over the t0 parameters
    for idx_noise in range(0, n_step):

        # set noise threshold
        config['background_removal_threshold'] = round(
            config['lower_background_removal_threshold'] +
            idx_noise * config['background_removal_threshold_step_size'], 3)

        # produce results
        results = fourier.Fourier(config, bin_center, bin_content, opt_t0,
                                  noise, fit_boundary1, fit_boundary2,
                                  n_positron_hits)
        results.run()

        del results

    del fr, t0
Ejemplo n.º 3
0
def run_stat_fluc(config):

    # append results in output text file
    config['append_results'] = True

    # disable saving plots
    config['print_plot'] = False

    for i in range(config['n_stat_fluctuation']):

        # instantiate fast rotation class
        fr = fastrotation.FastRotation(config)
        # class method returns numpy arrays of the fast rotation signal
        opt_tS, opt_tM, n_positron_hits, bin_center, bin_content = fr.produce()

        save_default_tM = config['tM']
        save_default_tS = config['tS']

        config['tS'] = round(opt_tS, 6)
        config['tM'] = round(opt_tM, 6)

        # instantiate t0 optimization class
        t0 = t0optimization.Optimize_t0(config, bin_center, bin_content)
        # iterative optimization of t0 (2 iterations are usually enough)
        opt_t0, chi2, noise, fit_boundary1, fit_boundary2 = t0.run_t0_optimization(
        )

        if (config['fix_t0']):
            opt_t0 = config['fixed_t0_value']

        config['print_plot'] = True

        results = fourier.Fourier(config, bin_center, bin_content, opt_t0,
                                  noise, fit_boundary1, fit_boundary2,
                                  n_positron_hits)
        results.run()

        config['print_plot'] = False

        del fr, t0, results

        config['tM'] = save_default_tM
        config['tS'] = save_default_tS
Ejemplo n.º 4
0
def run_default(config):

    # instantiate fast rotation class
    fr = fastrotation.FastRotation(config)
    # class method returns numpy arrays of the fast rotation signal
    opt_tS, opt_tM, n_positron_hits, bin_center, bin_content = fr.produce()

    config['tS'] = round(opt_tS, 6)
    config['tM'] = round(opt_tM, 6)

    # instantiate t0 optimization class
    t0 = t0optimization.Optimize_t0(config, bin_center, bin_content)
    # iterative optimization of t0 (2 iterations are usually enough)
    opt_t0, chi2, noise, fit_boundary1, fit_boundary2 = t0.run_t0_optimization(
    )

    if (config['fix_t0']):
        opt_t0 = config['fixed_t0_value']

    results = fourier.Fourier(config, bin_center, bin_content, opt_t0, noise,
                              fit_boundary1, fit_boundary2, n_positron_hits)
    results.run()