Esempio n. 1
0
def main():
    parser = argparse.ArgumentParser(description='Annotates logfiles with time, elevation, range')
    parser.add_argument('logfile', help='e.g. hsdrxmux.log')
    parser.add_argument('-g', '--groundstation', help='e.g. monterey, spokane', required=True)

    args = parser.parse_args()
    tles = tle_util.load_catalog("norad.tle")

    tle = tles[39429]
#    print "TLE:"
#    print tle
#    print

    log_entries=[]
    times=[]
    for row in open(args.logfile, "r"):
        times.append(float(row[2:17]))
        log_entries.append(row[18:])

    aers=eph_az_el_range(tle, gs_locs[args.groundstation], times)
    print "Time, Elevation, Range from " + args.groundstation + ", Log entry"
    for i, t in enumerate(times):
        print time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(round(t))) + \
          ", %4.1f, %4.0f, "%(aers[i][1], aers[i][2]) + log_entries[i],

    return 0
Esempio n. 2
0
def main():
    parser = argparse.ArgumentParser(
        description=
        'Pass prediction for ground station and satellite scheduling')
    parser.add_argument('-C',
                        '--catalog',
                        help='e.g. satcat.txt',
                        default='norad.tle')
    parser.add_argument('-c', '--catno', help='e.g. 39515', type=int)
    parser.add_argument('-D', '--delay', help='hours to skip', default=0)
    parser.add_argument('-d', '--duration', help='Duration in days', default=4)
    parser.add_argument('gs', help='e.g. spokane,monterey=20')

    args = parser.parse_args()
    tles = tle_util.load_catalog(args.catalog)

    if args.catno is None:
        if len(tles) > 1:
            print "More than one satellite in the catalog, therefore you must specify"
            print "which one to fit, using the '-c' option.  e.g. -c 39512"
            exit(1)
        else:
            tle = tles.values()[0]
    else:
        try:
            tle = tles[args.catno]
        except:
            print "Couldn't find " + str(args.catno) + " in the catalog."
            exit(1)

    print "TLE:"
    print tle
    print

    t_start = time.time() + 3600 * float(args.delay)
    t_end = t_start + 86400 * float(args.duration)
    stations = args.gs.split(',')
    all_passes = []
    for gs in stations:
        gss = gs.split('=')
        el_mask = 8
        if len(gss) == 2:
            el_mask = int(gss[1])
        passes = find_passes(tle, gss[0], t_start, t_end, el_mask=el_mask)
        all_passes += passes

    print "Combined pass list:"
    combined_passes = combine_passes(all_passes)
    if (len(combined_passes) > 19):
        combined_passes = combined_passes[0:19]

    print_passes(combined_passes)

    return 0
Esempio n. 3
0
def main():
    parser = argparse.ArgumentParser(description='Pass prediction for ground station and satellite scheduling')
    parser.add_argument('-C', '--catalog', help='e.g. satcat.txt', default='norad.tle')
    parser.add_argument('-c', '--catno', help='e.g. 39515', type=int)
    parser.add_argument('-D', '--delay', help='hours to skip', default=0)
    parser.add_argument('-d', '--duration', help='Duration in days', default=4)
    parser.add_argument('gs', help='e.g. spokane,monterey=20')


    args = parser.parse_args()
    tles = tle_util.load_catalog(args.catalog)


    if args.catno is None:
        if len(tles) > 1:
            print "More than one satellite in the catalog, therefore you must specify"
            print "which one to fit, using the '-c' option.  e.g. -c 39512"
            exit(1)
        else:
            tle = tles.values()[0]
    else:
        try:
            tle = tles[args.catno]
        except:
            print "Couldn't find " + str(args.catno) + " in the catalog."
            exit(1)

    print "TLE:"
    print tle
    print

    t_start = time.time() + 3600 * float(args.delay)
    t_end = t_start + 86400 * float(args.duration)
    stations = args.gs.split(',')
    all_passes=[]
    for gs in stations:
        gss = gs.split('=')
        el_mask = 8
        if len(gss) == 2:
            el_mask = int(gss[1])
        passes = find_passes(tle, gss[0], t_start, t_end, el_mask=el_mask);
        all_passes += passes

    print "Combined pass list:"
    combined_passes = combine_passes(all_passes)
    if (len(combined_passes) > 19):
        combined_passes = combined_passes[0:19]

    print_passes(combined_passes)

    return 0
Esempio n. 4
0
def main():
    parser = argparse.ArgumentParser(
        description='Orbit determination based on LST ranging')
    parser.add_argument('catalog', help='e.g. satcat.txt')
    parser.add_argument('-c', '--catno', type=int, help='e.g. 39512')
    parser.add_argument('ranges',
                        nargs='+',
                        help='e.g. monterey=dove2-ranges-monterey.txt')
    parser.add_argument('-M',
                        '--mean-anom',
                        help='fit the mean anomaly (M).',
                        const='M',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-r',
                        '--raan',
                        help='fit the right ascension of ascending node (☊)',
                        const='☊',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-a',
                        '--argpe',
                        help='fit the argument of periapsis (ω)',
                        const='ω',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-i',
                        '--inc',
                        help='fit the inclination',
                        const='i',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-n',
                        '--mean-motion',
                        help='fit the mean motion',
                        const='n',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-e',
                        '--ecc',
                        help='fit the eccentricity',
                        const='e',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-b',
                        '--bstar',
                        help='fit the drag term',
                        const='b',
                        action='append_const',
                        dest='fitvars')
    parser.add_argument('-f',
                        '--full',
                        help='fit all elements',
                        const=['M', '☊', 'ω', 'i', 'n', 'e', 'b'],
                        action='store_const',
                        dest='fitvars')

    args = parser.parse_args()
    tles = tle_util.load_catalog(args.catalog)

    if args.catno is None:
        if len(tles) > 1:
            print "More than one satellite in the catalog, therefore you must specify"
            print "which one to fit, using the '-c' option.  e.g. -c 39512"
            exit(1)
        else:
            tle = tles.values()[0]
    else:
        try:
            tle = tles[args.catno]
        except:
            print "Couldn't find '" + str(args.catno) + "' in the catalog."
            exit(1)

    print "Initial TLE:"
    print tle

    obs = []
    for rangeset in args.ranges:
        print rangeset
        [gs_locname, rangefile] = rangeset.split('=')
        obs.append((gs_locs[gs_locname], load_ranges(rangefile)))

    print "Loaded %s ranges" % [len(trs) for (gs, trs) in obs]
    print "Initial RMS error: %.1f km" % rms_error(tle, obs)

    if args.fitvars is None:
        args.fitvars = ['M']

    plot_tle_obs(tle, obs, 'r')

    new_tle = optimize(tle, obs, freevars=set(args.fitvars))

    plot_tle_obs(new_tle, obs, 'g')
    fig = plt.gcf()
    fig.set_size_inches(18.5, 10.5)
    plt.savefig("plot.png")
    plt.close()

    if (str(new_tle) == str(tle)):
        print "TLE unchanged, it is:"
        print tle
        return 1
    else:
        print "Improved TLE:"
        print new_tle
        return 0
    return 0
Esempio n. 5
0
def main():
    parser = argparse.ArgumentParser(description='Orbit determination based on LST ranging')
    parser.add_argument('catalog', help='e.g. satcat.txt')
    parser.add_argument('-c', '--catno', type=int, help='e.g. 39512')
    parser.add_argument('ranges', nargs='+', help='e.g. monterey=dove2-ranges-monterey.txt')
    parser.add_argument('-M', '--mean-anom', help='fit the mean anomaly (M).', const='M',
                        action='append_const', dest='fitvars')
    parser.add_argument('-r', '--raan', help='fit the right ascension of ascending node (☊)', const='☊',
                        action='append_const', dest='fitvars')
    parser.add_argument('-a', '--argpe', help='fit the argument of periapsis (ω)', const='ω',
                        action='append_const', dest='fitvars')
    parser.add_argument('-i', '--inc', help='fit the inclination', const='i',
                        action='append_const', dest='fitvars')
    parser.add_argument('-n', '--mean-motion', help='fit the mean motion', const='n',
                        action='append_const', dest='fitvars')
    parser.add_argument('-e', '--ecc', help='fit the eccentricity', const='e',
                        action='append_const', dest='fitvars')
    parser.add_argument('-b', '--bstar', help='fit the drag term', const='b',
                        action='append_const', dest='fitvars')
    parser.add_argument('-f', '--full', help='fit all elements', const=['M','☊','ω','i','n','e','b'],
                        action='store_const', dest='fitvars')

    args = parser.parse_args()
    tles = tle_util.load_catalog(args.catalog)

    if args.catno is None:
        if len(tles) > 1:
            print "More than one satellite in the catalog, therefore you must specify"
            print "which one to fit, using the '-c' option.  e.g. -c 39512"
            exit(1)
        else:
            tle = tles.values()[0]
    else:
        try:
            tle = tles[args.catno]
        except:
            print "Couldn't find '" + str(args.catno) + "' in the catalog."
            exit(1)

    print "Initial TLE:"
    print tle

    obs = []
    for rangeset in args.ranges:
        print rangeset
        [gs_locname, rangefile] = rangeset.split('=')
        obs.append((gs_locs[gs_locname], load_ranges(rangefile)))

    print "Loaded %s ranges" % [ len(trs) for (gs, trs) in obs ]
    print "Initial RMS error: %.1f km" % rms_error(tle, obs)

    if args.fitvars is None:
        args.fitvars = ['M']

    plot_tle_obs(tle, obs, 'r')

    new_tle = optimize(tle, obs, freevars = set(args.fitvars))

    plot_tle_obs(new_tle, obs, 'g')
    fig = plt.gcf()
    fig.set_size_inches(18.5,10.5)
    plt.savefig("plot.png")
    plt.close()

    if (str(new_tle) == str(tle)):
        print "TLE unchanged, it is:"
        print tle
        return 1
    else:
        print "Improved TLE:"
        print new_tle
        return 0
    return 0