示例#1
0
def update(val):

    qwp_1 = slider_1.val
    hwp_2 = slider_2.val
    qwp_2 = slider_3.val
    hwp_3 = slider_4.val
    qwp_3 = slider_5.val
    delay_1 = slider_6.val
    delay_2 = slider_7.val
    ampl_1 = slider_8.val
    ampl_2 = slider_9.val
    ampl_3 = slider_10.val
    closeness = slider_13.val

    a = e_field.e_field_gen(3, False, ampl_1*FIELD_AMP, ampl_2*FIELD_AMP,
                            ampl_3*FIELD_AMP, 0,
                            delay_1/FUND_FREQ, delay_2/FUND_FREQ,
                            FUND_FREQ, 2*FUND_FREQ, 3*FUND_FREQ,
                            [[qwp_1], [hwp_2, qwp_2], [hwp_3, qwp_3]],
                            PL_FWHM, PL_FWHM, PL_FWHM,
                            b1='q', b2='hq', b3='hq')

    t = np.linspace(0, 5*PL_FWHM, 50)
    y_field = a[0](t)
    z_field = a[1](t)
    tot = np.sqrt(y_field**2 + z_field**2)
    times = t#[j for i,j in zip(tot,t) if i > FIELD_AMP_ION]
    b = ode.solve_path(a, times[0], times[0] + 2/(FUND_FREQ), True, False, closeness*1E-9)
    #print(b)
    plot(b,a)
示例#2
0
def update():

    qwp_1 = np.random.rand(1)[0] * 360
    hwp_2 = np.random.rand(1)[0] * 360
    qwp_2 = np.random.rand(1)[0] * 360
    hwp_3 = np.random.rand(1)[0] * 360
    qwp_3 = np.random.rand(1)[0] * 360
    delay_1 = (np.random.rand(1)[0] - 0.5) * 4
    delay_2 = (np.random.rand(1)[0] - 0.5) * 4
    ampl_1 = np.random.rand(1)
    ampl_2 = np.random.rand(1)
    ampl_3 = np.random.rand(1)
    closeness = np.random.rand(1)

    a = e_field.e_field_gen(3,
                            True,
                            ampl_1 * FIELD_AMP,
                            ampl_2 * FIELD_AMP,
                            ampl_3 * FIELD_AMP,
                            0,
                            delay_1 / FUND_FREQ,
                            delay_2 / FUND_FREQ,
                            FUND_FREQ,
                            2 * FUND_FREQ,
                            3 * FUND_FREQ,
                            [[qwp_1], [hwp_2, qwp_2], [hwp_3, qwp_3]],
                            PL_FWHM,
                            PL_FWHM,
                            PL_FWHM,
                            b1='q',
                            b2='hq',
                            b3='hq')

    t = np.linspace(-5 * PL_FWHM, 5 * PL_FWHM, 50)
    y_field = a[0](t)
    z_field = a[1](t)
    tot = np.sqrt(y_field**2 + z_field**2)
    times = [j for i, j in zip(tot, t) if i > FIELD_AMP_ION]
    b = ode.solve_path(a, times[0], times[-1], True, True, closeness * 1E-9)
    plot(b)
示例#3
0
                            FUND_FREQ,
                            2 * FUND_FREQ,
                            3 * FUND_FREQ, [[45], [0, 0], [0, 0]],
                            PL_FWHM,
                            PL_FWHM,
                            PL_FWHM,
                            b1='q',
                            b2='hq',
                            b3='hq')

    t = np.linspace(-5 * PL_FWHM, 5 * PL_FWHM, 50)
    y_field = a[0](t)
    z_field = a[1](t)
    tot = np.sqrt(y_field**2 + z_field**2)
    times = t  #[j for i,j in zip(tot,t) if i > FIELD_AMP_ION]
    b = ode.solve_path(a, times[0], times[0] + 2 / (FUND_FREQ), True, False,
                       closeness * 1E-9)
    #print(b)
    #    plot(b,a)
    plot(b[2:4], b[0], b[1], b[4], b[5], field=a)
    #    plot(a)

    #end
    slider_1.on_changed(update)
    slider_2.on_changed(update)
    slider_3.on_changed(update)
    slider_4.on_changed(update)
    slider_5.on_changed(update)
    slider_6.on_changed(update)
    slider_7.on_changed(update)
    slider_8.on_changed(update)
    slider_9.on_changed(update)
示例#4
0
                            0 * FIELD_AMP,
                            ampl_3 * FIELD_AMP,
                            0,
                            delay_1 / FUND_FREQ,
                            delay_2 / FUND_FREQ,
                            FUND_FREQ,
                            2 * FUND_FREQ,
                            3 * FUND_FREQ,
                            [[qwp_1], [hwp_2, qwp_2], [hwp_3, qwp_3]],
                            PL_FWHM,
                            PL_FWHM,
                            PL_FWHM,
                            b1='q',
                            b2='hq',
                            b3='hq')

    t = np.linspace(-5 * PL_FWHM, 5 * PL_FWHM, 50)
    y_field = a[0](t)
    z_field = a[1](t)
    tot = np.sqrt(y_field**2 + z_field**2)
    times = [j for i, j in zip(tot, t) if i > FIELD_AMP_ION]
    b = ode.solve_path(a, times[0], times[-1], True, True, closeness * 1E-9)
    plot(b)
    #    plot(b[1:-2], b[0], times, b[-1], b[-2])
    #    plot(a)

    plt.show()

    for i in range(10):
        update()
                            FUND_FREQ,
                            2 * FUND_FREQ,
                            3 * FUND_FREQ, [[0], [0, 0], [0, 0]],
                            PL_FWHM,
                            PL_FWHM,
                            PL_FWHM,
                            b1='q',
                            b2='hq',
                            b3='hq')

    t = np.linspace(-5 * PL_FWHM, 5 * PL_FWHM, 50)
    y_field = a[0](t)
    z_field = a[1](t)
    tot = np.sqrt(y_field**2 + z_field**2)
    times = t  #[j for i,j in zip(tot,t) if i > FIELD_AMP_ION]
    b = ode.solve_path(a, 0, 0 + 1 / (FUND_FREQ), True, False,
                       closeness * 1E-9)
    #print(b)
    #    plot(b,a)
    plot(b[0][:, 0], b[1], a)
    #    plot(a)

    #end
    slider_1.on_changed(update)
    slider_2.on_changed(update)
    slider_3.on_changed(update)
    slider_4.on_changed(update)
    slider_5.on_changed(update)
    slider_6.on_changed(update)
    slider_7.on_changed(update)
    slider_8.on_changed(update)
    slider_9.on_changed(update)