Example #1
0
def calculate(processor,
              interp_multiplier,
              ignore_calib,
              plot_fkt,
              correction_factor=1):
    x, y, laser_x, laser_y = processor.get_data(interp_multiplier)

    calibrator = Calibrator(laser_x, laser_y, interp_multiplier, plot_fkt)
    delta, dt_max = calibrator.get_calibration(x)

    print(len(x))
    if not ignore_calib:
        _x = x + delta

        x = np.linspace(_x[0], _x[-1], len(_x))
        y = Utils.interpolate(x, _x, y)

        x = x * correction_factor

    # t in seconds
    t = x * dt_max
    dt = t[1] - t[0]

    t_max = len(t)

    print(len(t))
    print(1 / t_max)

    l, y_trans = FourierTransformer().transform(y, dt, t_max)

    # /   y_trans = list(reversed(y_trans))

    return l, y_trans