Beispiel #1
0
def scratch(date):
    import toolkit as tk
    mwf = 18.5101e9 * 2
    print(tk.wlen_to_step(0.26 + 6, mwf))
    print(tk.wlen_to_step(0.00824283455081 + 6.5, mwf))
    print(tk.wlen_to_step(0.00824283455081 + 6, mwf))
    return
Beispiel #2
0
def scratch(date):
    from scipy.special import jv
    import toolkit as tk
    phase = 0.2
    mwf = 18.5106e9 * 2
    print(tk.wlen_to_step(phase + 6, mwf))
    print(tk.wlen_to_step(phase + 6.5, mwf))
    print(jv(0, 1)**2 * 944)
    return
Beispiel #3
0
def find_delay_mins(date):
    import os
    import numpy as np
    import matplotlib.pyplot as plt
    import toolkit as tk
    instrs = [
              # ["3_delay_diode.txt", "MW = -10 dB", 0],
              [ "4_delay_diode.txt", "MW = - 6 dB", 0],
              [ "6_delay_diode.txt", "MW = - 8 dB", 1],
              [ "7_delay_diode.txt", "MW = -10 dB", 2],
              [ "5_delay_diode.txt", "MW = -12 dB", 3],
              [ "8_delay_diode.txt", "MW = -16 dB", 4],
              [ "9_delay_diode.txt", "MW = -20 dB", 5],
              ["10_delay_diode.txt", "MW = -26 dB", 6],
              ["11_delay_diode.txt", "MW = -32 dB", 7]
              # ["12_delay_diode.txt", "MW = -38 dB", 8]
             ]
    fig, axes = plt.subplots(nrows=len(instrs), sharex=True, sharey=True)
    xkey = 'd'
    ykey = 'nsig_rm'
    ykey2 = 'nsig'
    nave = 4
    mwf = 18.5096e9*2  # Hz after doubler.
    fold = 1
    blink = False
    smins = []
    smaxs = []
    for instr in instrs:
        [fname, label, ax] = instr
        ax = axes[ax]
        fname = os.path.join("..", date, fname)
        data = tk.delay_load(fname)
        data, popt, pconv = tk.transform_delay(data, mwf, nave, xkey, fold,
                                               blink)
        data.plot(x='d', y='nsig', ax=ax, label=label)
        data.plot(x='d', y='fit', ax=ax, label="fit")
        step_min = tk.wlen_to_step(6 + popt[2], mwf)
        smins = smins + [step_min]
        step_max = tk.wlen_to_step(6.5 + popt[2], mwf)
        smaxs = smaxs + [step_max]
        print("\n", fname, "\t", label, "\n", step_min, "\t", step_max, "\n",
              tk.step_to_wlen(step_min, mwf), "\t",
              tk.step_to_wlen(step_max, mwf), "\n", popt[1])
        for step in [step_min, step_max]:
            ax.axvline(step, c='k', ls='solid', lw=2)
    for ax in axes:
        for step in smins:
            ax.axvline(step, c='grey', ls='dashed')
        for step in smaxs:
            ax.axvline(step, c='grey', ls='dashed')
    sm_m = np.mean(smins)
    sm_s = np.std(smins)
    print("\n", "mean min", "\n", sm_m, " +/- ", sm_s, "\n",
          tk.step_to_wlen(sm_m, mwf), " +/- ",
          tk.step_to_wlen(sm_s, mwf))
    return
Beispiel #4
0
def delays(date):
    import os
    import matplotlib.pyplot as plt
    import toolkit as tk
    fig, ax = plt.subplots(nrows=1, sharex=True, sharey=True)
    instrs = [["1_delay_diode.txt", "PM = 1.0", ax]]
    xkey = 'd'
    ykey = 'nsig_rm'
    ykey2 = 'nsig'
    nave = 4
    mwf = 18.5117e9 * 2  # Hz after doubler.
    fold = 1
    blink = False
    for instr in instrs:
        [fname, label, ax] = instr
        fname = os.path.join("..", date, fname)
        data = tk.delay_load(fname)
        data, popt, pconv = tk.transform_delay(data, mwf, nave, xkey, fold,
                                               blink)
        data.plot(x='d', y='nsig', ax=ax, label=label)
        print(popt[2], tk.wlen_to_step(6 + popt[2], mwf))
        # args = (fname, xkey, ykey, ykey2, mwf, nave, ax, label, fold, blink)
        # data, popt, pcov = tk.delay_plot(*args)
        # if popt[1] > 0:
        #     phi1 = (popt[2] + 0.5)%1.0
        # else:
        #     phi1 = (popt[2])%1.0
        # print("Step at minimum = ", 100e3 + tk.wlen_to_step(phi1, mwf))
    # minima = mins_by_eye()
    # for minimum in minima:
    #     ax.axvline(minimum, c='grey', linestyle='dashed')
    return
Beispiel #5
0
def scratch(date):
    mwf = 18511.0e6 * 2
    steps = tk.wlen_to_step(1, mwf)
    print(steps)
    print(100e3 - 2 * steps, 100e3 + 2 * steps)
    coeff = 1.0
    print("j_0({0})^2 = ".format(coeff), jv(0, coeff)**2)
    return
Beispiel #6
0
def delay_short(date):
    import os
    import numpy as np
    import matplotlib.pyplot as plt
    import pandas as pd
    import toolkit as tk
    fname = "6_delay_diode.txt"
    label = "MW = 9.0 dB, PM = 38.0 dB"
    fig, ax = plt.subplots()
    xkey = 'wlen_fold'
    ykey = 'nsig_fold'
    ykey2 = 'nsig'
    nave = 4
    mwf = 18.5119e9 * 2  # Hz after doubler.
    fold = 1
    blink = False
    fname = os.path.join("..", date, fname)
    data, popt, pcov = tk.delay_plot(fname,
                                     xkey,
                                     ykey,
                                     ykey2,
                                     mwf,
                                     nave,
                                     ax,
                                     label,
                                     fold=fold,
                                     blink=blink)
    obs = {
        "mw": 9,
        "pm": 38,
        "a0": popt[0],
        "a1": popt[1],
        "a2": popt[3],
        "a3": popt[5],
        "a4": popt[7]
    }
    stepmin = tk.wlen_to_step(popt[2] + 6, mwf)
    stepmax = tk.wlen_to_step(popt[2] + 6.5, mwf)
    print("step_min = ", stepmin)
    print("step_max = ", stepmax)
    ax.axvline(tk.step_to_wlen(stepmin, mwf) % 1, c='grey', ls='dashed')
    ax.axvline(tk.step_to_wlen(stepmax, mwf) % 1, c='grey', ls='dashed')
    return