Пример #1
0
    def plot_graph(self, index):
        gpx = self.get_gpx(index)
        points = gpx.track.track_segment

        plot = Plotter(points)
        result = plot.setup()
        if result:
            plot.plot()
        else:
            self.show_warning("Нехватает данных о высоте!")
Пример #2
0
                   selection_mc     = selection_mc,
                   selection_tight  = selection_tight,
                   pandas_selection = pandas_selection,
                   lumi             = 59700.,

                   model            = '/'.join([env['NN_DIR'], 'trainings', training, 'net_model_weighted.h5'           ]), 
                   transformation   = '/'.join([env['NN_DIR'], 'trainings', training, 'input_tranformation_weighted.pck']),
                   features         = '/'.join([env['NN_DIR'], 'trainings', training, 'input_features.pck'              ]),

                   process_signals  = False, # switch off for control regions
                   mini_signals     = False, # process only the signals that you'll plot
                   plot_signals     = False, 
                   blinded          = False,

                   datacards        = ['hnl_m_12_lxy_lt_0p5', 'hnl_m_12_lxy_0p5_to_1p5', 'hnl_m_12_lxy_1p5_to_4p0', 'hnl_m_12_lxy_mt_4p0'], # FIXME! improve this to accept wildcards / regex

                   mc_subtraction   = True,
                   
                   dir_suffix       = 'check_alt_prompt_estimate',
                   
                   relaxed_mc_scaling = 0.05,
                   )

if __name__ == '__main__':
    plotter.plot()
    # save the plotter and all
    save_plotter_and_selections(plotter, selection, selection_mc, selection_tight)
    pass
    

Пример #3
0
def task1(original_signal: Signal,
          original_freq,
          carrier_freq,
          global_pref=None,
          k=64,
          noise_freq=None):
    Plotter.plot(original_signal, _title_pref=global_pref)
    Plotter.fourier_transform(original_signal, _title_pref=global_pref)

    modulated_signal = DoubleSideband(original_signal, carrier_freq)
    if noise_freq is not None:
        modulated_signal = modulated_signal + Sine(noise_freq,
                                                   amplitude=amplitude,
                                                   t_start=0,
                                                   t_end=1,
                                                   discretization=10000)
    Plotter.plot(modulated_signal, t_end=0.1, _title_pref=global_pref)
    Plotter.fourier_transform(modulated_signal, _title_pref=global_pref)

    signal_fft = abs(fftshift(fft(modulated_signal.get_y())))
    signal_fft = 2 * signal_fft / len(signal_fft)
    f_fft = fftshift(
        fftfreq(len(modulated_signal.get_x()),
                abs(modulated_signal.get_x()[1] -
                    modulated_signal.get_x()[0])))
    if noise_freq is None:
        print(
            find_freqs(signal_fft[len(signal_fft) // 2 - 1:],
                       f_fft[len(f_fft) // 2 - 1:], 3))
    else:
        print(
            find_freqs(signal_fft[len(signal_fft) // 2 - 1:],
                       f_fft[len(f_fft) // 2 - 1:], 4))

    discrete_signal = Discrete(modulated_signal,
                               k,
                               signal_min=min(modulated_signal.get_y()),
                               signal_max=max(modulated_signal.get_y()))
    Plotter.plot(discrete_signal, t_end=0.1, _title_pref=global_pref)

    detected_signal = Detect(discrete_signal, carrier_freq, filter_freq=30)
    Plotter.plot(detected_signal, t_end=0.1, _title_pref=global_pref)
    Plotter.fourier_transform(detected_signal, _title_pref=global_pref)

    signal_fft = abs(fftshift(fft(detected_signal.get_y())))
    signal_fft = 2 * signal_fft / len(signal_fft)
    f_fft = fftshift(
        fftfreq(len(detected_signal.get_x()),
                abs(detected_signal.get_x()[1] - detected_signal.get_x()[0])))
    print(
        find_freqs(signal_fft[len(signal_fft) // 2 - 1:],
                   f_fft[len(f_fft) // 2 - 1:], 2))

    detected_signal2 = Detect(detected_signal, original_freq, filter_freq=7)
    Plotter.plot(detected_signal2, _title_pref=global_pref)
    Plotter.fourier_transform(detected_signal2, _title_pref=global_pref)

    lbound = max(detected_signal2.get_y()) / pow(10, 3 / 20)
    print("lbound: %d" % lbound)
    sig_out = np.ones(len(detected_signal2.get_x()))
    for i in range(0, len(detected_signal2.get_x())):
        if detected_signal2.get_y()[i] <= lbound:
            sig_out[i] = 0
        else:
            break

    k = 1
    while sig_out[k] == 0:
        k = k + 1
        if k == sig_out.__len__() - 1:
            break
    print('delay: %f' % detected_signal2.get_x()[k])
    pyplot.plot(detected_signal.get_x(), sig_out, '.')
    # pyplot.xlim(0, 1000)
    pyplot.show()