Example #1
0
def nut_diff_stats(DIF_file):
    '''
    '''

    # Load data
    ep_mjd, dX, dXerr, dY, dYerr = get_res_nut(DIF_file)
    epo = (ep_mjd - 51544.5) / 365.25 + 2000.0

    data_dir, data_fil = path.split(DIF_file)

    # Plot
    # plot_res(epo, dX, "dX", "mas", data_dir)
    # plot_res(epo, dY, "dY", "mas", data_dir)

    errorbarplot_res(epo, dX, dXerr, "X_p", "mas", data_dir, label="dX")
    errorbarplot_res(epo, dY, dYerr, "Y_p", "mas", data_dir, label="dY")

    # Statistical calculation
    LOG_file = data_fil.replace(".nut_c04_dif", "_nut_c04_dif.log")
    flog = open("%s/logs/%s" % (data_dir, LOG_file), "w")

    # print("dX (mas):", file=flog)
    # stats_calc(epo, dX, dXerr, flog)

    # print("dY (mas):", file=flog)
    # stats_calc(epo, dY, dYerr, flog)

    # Modified in 30 Jan 2018
    print("dX (uas):", file=flog)
    stats_calc(epo, dX * 1000, dXerr * 1000, flog)

    print("dY (uas):", file=flog)
    stats_calc(epo, dY * 1000, dYerr * 1000, flog)

    flog.close()

    # Post-1993.0 data
    tb = 1993.0
    [epo_ts, dX_ts, dXerr_ts, dY_ts,
     dYerr_ts] = nut_cut(epo, dX, dXerr, dY, dYerr, tb)
    # Statistical calculation
    LOG_file = data_fil.replace(".nut_c04_dif",
                                "_nut_c04_post%.0f_dif.log" % tb)
    flog = open("%s/logs/%s" % (data_dir, LOG_file), "w")
    print("Use post %.1f data" % tb, file=flog)
    print("dX (uas):", file=flog)
    stats_calc(epo_ts, dX_ts * 1000, dXerr_ts * 1000, flog)

    print("dY (uas):", file=flog)
    stats_calc(epo_ts, dY_ts * 1000, dYerr_ts * 1000, flog)

    flog.close()
Example #2
0
def nut_diff_stats(DIF_file, lab):
    '''
    '''

    # Load data
    ep_mjd, dX, dXerr, dY, dYerr = get_res_nut(DIF_file)
    epo = (ep_mjd - 51544.5) / 365.25 + 2000.0

    data_dir, data_fil = path.split(DIF_file)

    # Statistical calculation
    flog = open("%s/%s_nut.log" % (data_dir, lab), "w")

    # Statistics for all-time series
    print("For all-time:", file=flog)
    print("dX (uas):", file=flog)
    stats_calc(epo, dX, dXerr, flog)

    print("dY: (uas)", file=flog)
    stats_calc(epo, dY, dYerr, flog)

    # Statistics for post-1995.0 series
    splitpoint = 1995.
    print("For post-%.1f:" % splitpoint, file=flog)

    con = (epo >= splitpoint)
    epon = epo[con]
    dXn = dX[con]
    dXerrn = dXerr[con]
    dYn = dY[con]
    dYerrn = dYerr[con]

    print("dX (uas):", file=flog)
    slope, intercept = stats_calc(epon, dXn, dXerrn, flog)
    errorbarplot_res(epo, dX, dXerr, "$\Delta$dX", "$\mu$as",
                     path.dirname(data_dir), "%s_ddX" % lab, slope, intercept)

    print("dY: (uas)", file=flog)
    slope, intercept = stats_calc(epon, dYn, dYerrn, flog)
    errorbarplot_res(epo, dY, dYerr, "$\Delta$dY", "$\mu$as",
                     path.dirname(data_dir), "%s_ddY" % lab, slope, intercept)

    # Plot
    # plot_res(epo, dX, "dX", "mas", data_dir)
    # plot_res(epo, dY, "dY", "mas", data_dir)

    # errorbarplot_res(epo, dX, dXerr, "$\Delta$dX", "$\mu$as",
    #                  path.dirname(data_dir), "%s_ddX" % lab)
    # errorbarplot_res(epo, dY, dYerr, "$\Delta$dY", "$\mu$as",
    #                  path.dirname(data_dir), "%s_ddY" % lab)

    flog.close()
Example #3
0
def eop_diff_stats(DIF_file, lab):
    '''
    '''

    data_dir, data_fil = path.split(DIF_file)

    # Load data
    ep_mjd, dX, dXerr, dY, dYerr, dU, dUerr = get_res_eop(DIF_file)
    epo = (ep_mjd - 51544.5) / 365.25 + 2000.0

    # Plot
    # plot_res(epo, dX, "Xp", "mas", data_dir)
    # plot_res(epo, dY, "Yp", "mas", data_dir)
    # plot_res(epo, dU, "UT1-UTC", "ms", data_dir)

    # errorbarplot_res(epo, dX, dXerr, "$\Delta$Xp", "uas",
    #                  path.dirname(data_dir), "%s_dXp" % lab)
    # errorbarplot_res(epo, dY, dYerr, "$\Delta$Yp", "uas",
    #                  path.dirname(data_dir), "%s_dYp" % lab)
    # errorbarplot_res(epo, dU, dUerr, "$\Delta$UT1-UTC", "ms",
    #                  path.dirname(data_dir), "%s_dU" % lab)

    # errorbarplot_res(epo, dX, dXerr, "$\Delta$Xp", "uas",
    #                  path.dirname(data_dir), "%s_dXp" % lab,
    #                  -0.241, 1.796)
    # errorbarplot_res(epo, dY, dYerr, "$\Delta$Yp", "uas",
    #                  path.dirname(data_dir), "%s_dYp" % lab,
    #                  0.097, 2.172)
    # errorbarplot_res(epo, dU, dUerr, "$\Delta$UT1-UTC", "ms",
    #                  path.dirname(data_dir), "%s_dU" % lab,
    #                  9.492e-3, 116.766e-3)

    # Statistical calculation
    flog = open("%s/%s_eop.log" % (data_dir, lab), "w")

    # Statistics for all-time series
    print("For all-time:", file=flog)
    print("X pole (uas):", file=flog)

    print("Y pole: (uas)", file=flog)
    stats_calc(epo, dY, dYerr, flog)

    print("UT1-UTC (us):", file=flog)
    stats_calc(epo, dU * 1000, dUerr * 1000, flog)

    # Statistics for post-1995.0 series
    splitpoint = 1995.
    print("For post-%.1f:" % splitpoint, file=flog)

    con = (epo >= splitpoint)
    epon = epo[con]
    dXn = dX[con]
    dXerrn = dXerr[con]
    dYn = dY[con]
    dYerrn = dYerr[con]
    dUn = dU[con]
    dUerrn = dUerr[con]

    print("X pole (uas):", file=flog)
    stats_calc(epon, dXn, dXerrn, flog)
    slope, intercept = stats_calc(epo, dX, dXerr, flog)

    errorbarplot_res(epo, dX, dXerr, "$\Delta$Xp", "$\mu$as",
                     path.dirname(data_dir), "%s_dXp" % lab, slope, intercept)

    print("Y pole: (uas)", file=flog)
    slope, intercept = stats_calc(epon, dYn, dYerrn, flog)

    errorbarplot_res(epo, dY, dYerr, "$\Delta$Yp", "$\mu$as",
                     path.dirname(data_dir), "%s_dYp" % lab, slope, intercept)

    print("UT1-UTC (us):", file=flog)
    # slope, intercept = stats_calc(epon, dUn * 1000, dUerrn * 1000,
    #                               flog)
    # It seems no need to multiply a 1000 because the unit for UT1 is
    # already uas.
    slope, intercept = stats_calc(epon, dUn, dUerrn, flog)

    errorbarplot_res(epo, dU, dUerr, "$\Delta$UT1-UTC", "ms",
                     path.dirname(data_dir), "%s_dU" % lab, slope / 1.e3,
                     intercept / 1.e3)
    flog.close()
Example #4
0
def eop_diff_stats(DIF_file):
    '''
    '''

    data_dir, data_fil = path.split(DIF_file)

    # Load data
    ep_mjd, Xp, Xperr, Yp, Yperr, UT, UTerr = get_res_eop(DIF_file)
    epo = (ep_mjd - 51544.5) / 365.25 + 2000.0

    # Plot
    # plot_res(epo, Xp, "Xp", "mas", data_dir)
    # plot_res(epo, Yp, "Yp", "mas", data_dir)
    # plot_res(epo, UT, "UT1-UTC", "ms", data_dir)

    errorbarplot_res(epo, Xp, Xperr, "Xp", "mas", data_dir, label='Xp')
    errorbarplot_res(epo, Yp, Yperr, "Yp", "mas", data_dir, label='Yp')
    errorbarplot_res(epo, UT, UTerr, "UT1-UTC", "ms", data_dir, label='UT1')

    # Statistical calculation
    LOG_file = data_fil.replace(".eop_c04_dif", "_eop_c04_dif.log")
    flog = open("%s/logs/%s" % (data_dir, LOG_file), "w")

    # print("X pole (mas):", file=flog)
    # stats_calc(epo, Xp, Xperr, flog)

    # print("Y pole: (mas)", file=flog)
    # stats_calc(epo, Yp, Yperr, flog)

    # Modified in 30 Jan 2018
    print("X pole (uas):", file=flog)
    stats_calc(epo, Xp * 1000, Xperr * 1000, flog)

    print("Y pole (uas):", file=flog)
    stats_calc(epo, Yp * 1000, Yperr * 1000, flog)

    print("UT1-UTC (us):", file=flog)
    stats_calc(epo, UT * 1000, UTerr * 1000, flog)

    flog.close()

    # Post-1993.0 data
    tb = 1993.0
    [epo_ts, Xp_ts, Xperr_ts, Yp_ts, Yperr_ts, UT_ts,
     UTerr_ts] = eop_cut(epo, Xp, Xperr, Yp, Yperr, UT, UTerr, tb)
    # Statistical calculation
    LOG_file = data_fil.replace(".eop_c04_dif",
                                "_eop_c04_post%.0f_dif.log" % tb)
    flog = open("%s/logs/%s" % (data_dir, LOG_file), "w")
    print("Use post %.1f data" % tb, file=flog)
    print("X pole (uas):", file=flog)
    stats_calc(epo_ts, Xp_ts * 1000, Xperr_ts * 1000, flog)

    print("Y pole (uas):", file=flog)
    stats_calc(epo_ts, Yp_ts * 1000, Yperr_ts * 1000, flog)

    print("UT1-UTC (us):", file=flog)
    stats_calc(epo_ts, UT_ts * 1000, UTerr_ts * 1000, flog)

    flog.close()
def nutation_offset_stat(EOB_file):
    '''
    '''

    # Load data
    # dbname, epo, obsnum, dX, dXerr, dY, dYerr = read_nut(NUT_file)
    [
        dbname, obsnum, tag_eop, Xp, Xp_err, Yp, Yp_err, U, U_err, XR, XR_err,
        YR, YR_err, UR, UR_err, corXY, corXU, corYU, corXUR, corYUR, corUUR,
        tag_nut, dX, dX_err, dY, dY_err, cordXdY
    ] = read_eob(EOB_file)
    epo = (tag_nut - 51544.5) / 365.25 + 2000.0

    data_dir, data_fil = path.split(EOB_file)

    # Plot
    # plot_res(epo, dX, "dX", "mas", data_dir)
    # plot_res(epo, dY, "dY", "mas", data_dir)

    errorbarplot_nut(epo, dX, dX_err, dY, dY_err, data_dir)

    # Statistical calculation
    # LOG_file = data_fil.replace(".nut", "_nut.log")
    LOG_file = data_fil.replace(".eob", "_nut.log")
    flog = open("%s/logs/%s" % (data_dir, LOG_file), "w")

    # units are changed on 31 JAN 2018.
    dX, dX_err = dX * 1.e3, dX_err * 1.e3
    dY, dY_err = dY * 1.e3, dY_err * 1.e3

    # Statistics for all-time series
    print("For all-time:", file=flog)
    # units are changed on 31 JAN 2018.
    # print("dX (mas):", file=flog)
    print("dX (uas):", file=flog)
    stats_calc(epo, dX, dX_err, flog)

    # units are changed on 31 JAN 2018.
    # print("dY: (mas)", file=flog)
    print("dY: (uas)", file=flog)
    stats_calc(epo, dY, dY_err, flog)

    # Statistics for post-1995.0 series
    splitpoint = 1993.
    print("For post-%.1f:" % splitpoint, file=flog)

    con = (epo >= splitpoint)
    epo = epo[con]
    dX = dX[con]
    dX_err = dX_err[con]
    dY = dY[con]
    dY_err = dY_err[con]

    # units are changed on 31 JAN 2018.
    # print("dX (mas):", file=flog)
    print("dX (uas):", file=flog)
    stats_calc(epo, dX, dX_err, flog)

    # units are changed on 31 JAN 2018.
    # print("dY: (mas)", file=flog)
    print("dY: (uas)", file=flog)
    stats_calc(epo, dY, dY_err, flog)

    flog.close()