Exemplo n.º 1
0
Arquivo: HW5.py Projeto: mfkiwl/RFLab
from readyuma import mean2eccentric, broadcast2pos, read_GPSyuma
import pandas as pd
from hw5_helpers import *
from matplotlib.dates import (YEARLY, DateFormatter, rrulewrapper,
                              RRuleLocator, drange)

MY_SATT = "G02"
# MY_SATT = "G30"
PRN = int(MY_SATT[1:len(MY_SATT)])

##############################################################################################################
# Part 1
# Starting point: Choose a good PRN from the RINEX obs file to work with for this assignment.
header, almanac_data = parse_rinex_nav_file('brdc2450.20n')  # Grab data
# print(almanac_data)
_, obs_data = parse_rinex_obs_file("nist2450.20o")  # Grab even more data

base = np.datetime64("2020-09-01T00:00:00")  # Weird Time Thing
seconds = (obs_data[MY_SATT].time - base) / 1e6 + 172800  # Weird Time Thing
weekComp = np.ones(len(seconds)) * 2121  # Weird Time Thing

_, sattPos, _, _ = broadcast2posM(
    almanac_data,
    np.array([weekComp, seconds.astype(float)]).transpose(),
    PRN)  # Grab Satellite Position Using Revised Broadcast2Pos
rxPos = get_nistECEF()  # Grabs ECEF coords of NIST Location
azelrange_rx2satt = pd.DataFrame(azelrange(rxPos, sattPos),
                                 columns=['Azimuth', 'Elevation', 'Range'
                                          ])  # Az/El/Range between sat and rx

# Create a time vector just including the times for which you have an observation for the satellite.
Exemplo n.º 2
0
# # ASEN 5090 Assignment 6
import numpy
from numpy import array, datetime64, exp, sin, tan
from datetime import datetime
from coordinate_utilities import ecef2sky, geo2ecef
from orbit_utilities import parse_yuma_almanacs, compute_ecef_position_from_gps_almanac
from rinex_utilities import parse_rinex_obs_file
import matplotlib.pyplot as plt

# Yuma URL:  http://www.celestrak.com/GPS/almanac/Yuma/2017/almanac.yuma.week0906.061440.txt
almanac_filename = 'almanac.yuma.week0906.061440.txt'
with open(almanac_filename, 'r') as f:
    almanacs = parse_yuma_almanacs(f.readlines())

# CDDIS FTP path:  ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2017/001/17o/
header, rinex = parse_rinex_obs_file('./nist0010.17o')

prn = 24
sat_id = 'G{0:02}'.format(prn)

almanac = almanacs[prn]
sat = rinex['G24']

gpst_epoch = datetime(1980, 1, 6, 0, 0, 0,
                      0)  # Jan 6th, 00:00:00 (midnight) with microseconds
start_of_day_utc = datetime(2017, 1, 1)

# Compute the GPST time for the start of the day by taking the difference between the GPST epoch
# and the start of day in terms of seconds.
gpst_start_of_day = (datetime64(start_of_day_utc) -
                     datetime64(gpst_epoch)).astype('timedelta64[s]')
Exemplo n.º 3
0
import numpy as np
from numpy import array, datetime64, exp, where, diff, nan, concatenate, ndarray
from types import SimpleNamespace
from datetime import datetime, timezone, time
import scipy.constants as constants
import pandas as pd
from rinex_utilities import parse_rinex_obs_file
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
from SatClass import Satellite

# CDDIS FTP path:  ftp://cddis.gsfc.nasa.gov/gnss/data/daily/2017/223/17o/
rinex_filename1 = './nist2320.17o'  # August 20th 2017
rinex_filename2 = './nist2330.17o'  # August 21st 2017
header1, observations1 = parse_rinex_obs_file(rinex_filename1)
header2, observations2 = parse_rinex_obs_file(rinex_filename2)

fL1 = 1.57542e9
fL2 = 1.2276e9
c = 299792458

kappa = (constants.elementary_charge ** 2)/(8 * (constants.pi ** 2) * constants.epsilon_0 * constants.electron_mass)
kappa = float("{0:.5g}".format(kappa))
print(kappa)

def plot_TECu_two_days(Satellite):
    time1, y1, time2, y2 = Satellite.get_two_day_plot_items()

    # Cleaning up these arrays since they wrap around and draw a line across
    # the entire plot
Exemplo n.º 4
0
# # plt.plot(timevec, PRN1pose[:,0],'g-')
# # plt.plot(timevec, PRN1pose[:,1], 'b-')
# # plt.plot(timevec, PRN1pose[:,2], 'r-')

# [diction, dfyuma] =read_GPSyuma('YUMA245.ALM')

# h, posAlm = broadcast2pos(dfyuma,np.array([weeks,timevec]).transpose(),5 )
# plt.plot(timevec,posAlm[:,0]-PRN1pose[:,0],'g--')
# plt.plot(timevec,posAlm[:,1]-PRN1pose[:,1], 'b--')
# plt.plot(timevec,posAlm[:,2]-PRN1pose[:,2], 'r--')

# plt.show()
formatter = DateFormatter("%d %h %H:%M ")
fig = plt.figure()
axpr = fig.add_subplot(111)
head, obs_data = parse_rinex_obs_file("nist2450.20o")
print(obs_data["G05"])
base = np.datetime64("2020-09-01T00:00:00")
seconds = (obs_data["G05"].time - base) / 1e6 + 172800
weekComp = np.ones(len(seconds)) * 2121
#print(seconds.astype(int))

h, PRN1pose = broadcast2posM(
    a,
    np.array([weekComp, seconds.astype(float)]).transpose(), 5)
aer2 = pd.DataFrame(azelrange(vec1_ECEF, PRN1pose),
                    columns=['Azimuth', 'Elevation', 'Range'])
Ex1 = np.zeros(len(seconds))
for i in range(len(seconds)):
    Ex1[i] = ExpectedRange(PRN1pose[i, :], vec1_ECEF, seconds[i].astype(float),
                           a)
Exemplo n.º 5
0
directory = "%s_pickles\\" % base_station  # NIST_pickles
filepath = "%s2450.20o" % base_station
# filepath = 'usn82450.20o'

prefit_residuals = []
postfit_residuals = []
elevation_values = []
relative_positionENU = []
dop_values = []

c = 299792458
current_time = 172800
century = 2000
header, almanac_data = parse_rinex_nav_file('brdc2450.20n')  # Grab data
# _, obs_data = parse_rinex_obs_file("nist2450.20o") # Grab even more data
_, obs_data = parse_rinex_obs_file(filepath)  # Grab even more data

init_guess_NIST = get_nistECEF()  # Grabs ECEF coords of NIST Location
init_guess_USN8 = get_usn8ECEF()  # Grabs ECEF coords of NIST Location

lati, longi, _ = ECEFtolla(init_guess_NIST)
nist_conversion_matrix = ECEF_ENU_Transform(lati, longi)
lati, longi, alt = ECEFtolla(init_guess_USN8)
usn8_conversion_matrix = ECEF_ENU_Transform(lati, longi)

# print(nist_conversion_matrix)
# print(usn8_conversion_matrix)

with open(filepath, 'r') as f:
    lines = list(f.readlines())
for i, line in enumerate(lines):