コード例 #1
0
ファイル: test_time.py プロジェクト: skulumani/astro
def test_dayofyr2mdhms_january():
    yr = 2017
    days = 1.5

    expected_output = (1, 1, 12, 0, 0)
    actual_output = time.dayofyr2mdhms(yr, days)
    np.testing.assert_array_almost_equal(actual_output, expected_output)
コード例 #2
0
def test_dayofyr2mdhms_january():
    yr = 2017
    days = 1.5

    expected_output = (1, 1, 12, 0, 0)
    actual_output = time.dayofyr2mdhms(yr, days)
    np.testing.assert_array_almost_equal(actual_output, expected_output)
コード例 #3
0
ファイル: test_time.py プロジェクト: skulumani/astro
    def test_jan_1(self):
        yrmdhms = (2000, 1, 1, 0, 0, 0)
        days = time.finddays(yrmdhms[0], yrmdhms[1], yrmdhms[2], yrmdhms[3], yrmdhms[4], yrmdhms[5])
        mdhms = time.dayofyr2mdhms(yrmdhms[0], 1)

        np.testing.assert_allclose(days, 1)
        np.testing.assert_allclose(mdhms, yrmdhms[1:])
コード例 #4
0
ファイル: satellite.py プロジェクト: skulumani/astro
    def __init__(self, elements):
        # now do some conversions of the TLE components
        epoch_year = (2000 + elements.epoch_year
                      if elements.epoch_year < 70
                      else 1900 + elements.epoch_year)

        # working units
        nddot6 = elements.nddot_over_6 * (2 * np.pi) * (sec2day**3)
        ndot2 = elements.ndot_over_2 * (2 * np.pi) * (sec2day**2)
        inc0 = elements.inc * deg2rad
        raan0 = elements.raan * deg2rad
        argp0 = elements.argp * deg2rad
        mean0 = elements.ma * deg2rad
        n0 = elements.mean_motion * 2 * np.pi * sec2day
        ecc0 = elements.ecc
        epoch_day = elements.epoch_day

        # calculate perturbations raan, argp, ecc
        raandot, argpdot, eccdot, adot = j2dragpert(inc0, ecc0, n0, ndot2)

        # calculate epoch julian date
        mo, day, hour, mn, sec = time.dayofyr2mdhms(epoch_year, epoch_day)
        epoch_jd, _ = time.date2jd(epoch_year, mo, day, hour, mn, sec)

        # store with class
        self.satname = elements.satname
        self.satnum = elements.satnum
        self.tle = elements
        self.ndot2 = ndot2
        self.nddot6 = nddot6
        self.inc0 = inc0
        self.raan0 = raan0
        self.ecc0 = ecc0
        self.argp0 = argp0
        self.mean0 = mean0
        self.n0 = n0
        self.epoch_jd = epoch_jd
        self.epoch_year = epoch_year
        self.epoch_day = epoch_day

        self.raandot = raandot
        self.argpdot=argpdot
        self.eccdot = eccdot
        self.adot = adot
コード例 #5
0
    def __init__(self, elements):
        # now do some conversions of the TLE components
        epoch_year = (2000 + elements.epoch_year if elements.epoch_year < 70
                      else 1900 + elements.epoch_year)

        # working units
        nddot6 = elements.nddot_over_6 * (2 * np.pi) * (sec2day**3)
        ndot2 = elements.ndot_over_2 * (2 * np.pi) * (sec2day**2)
        inc0 = elements.inc * deg2rad
        raan0 = elements.raan * deg2rad
        argp0 = elements.argp * deg2rad
        mean0 = elements.ma * deg2rad
        n0 = elements.mean_motion * 2 * np.pi * sec2day
        ecc0 = elements.ecc
        epoch_day = elements.epoch_day

        # calculate perturbations raan, argp, ecc
        raandot, argpdot, eccdot, adot = j2dragpert(inc0, ecc0, n0, ndot2)

        # calculate epoch julian date
        mo, day, hour, mn, sec = time.dayofyr2mdhms(epoch_year, epoch_day)
        epoch_jd, _ = time.date2jd(epoch_year, mo, day, hour, mn, sec)

        # store with class
        self.satname = elements.satname
        self.satnum = elements.satnum
        self.tle = elements
        self.ndot2 = ndot2
        self.nddot6 = nddot6
        self.inc0 = inc0
        self.raan0 = raan0
        self.ecc0 = ecc0
        self.argp0 = argp0
        self.mean0 = mean0
        self.n0 = n0
        self.epoch_jd = epoch_jd
        self.epoch_year = epoch_year
        self.epoch_day = epoch_day

        self.raandot = raandot
        self.argpdot = argpdot
        self.eccdot = eccdot
        self.adot = adot
コード例 #6
0
def test_dayofyr2mdhms_end():
    yr = 2006
    day = 180
    expected_output = (6, 29, 0, 0, 0)
    actual_output = time.dayofyr2mdhms(yr, day)
    np.testing.assert_allclose(actual_output, expected_output)
コード例 #7
0
        """TLE Initial Info Sorted"""
        i_0 = np.deg2rad(tles[count].inc)
        raan_0 = np.deg2rad(tles[count].raan)
        e_0 = tles[count].ecc
        w_0 = np.deg2rad(tles[count].argp)
        M_0 = np.deg2rad(tles[count].ma)
        n_0 = tles[count].mean_motion * 2 * np.pi / 86400
        nrate_0 = tles[count].ndot_over_2 * 2 * np.pi / 7464960000

        a_0 = (mu / (n_0**2))**(1 / 3)
        p_0 = a_0 * (1 - (e_0**2))

        epoch_year = tles[count].epoch_year + century
        epoch_dayfrac = tles[count].epoch_day

        epoch_mon, epoch_day, epoch_hr, epoch_min, epoch_sec = time.dayofyr2mdhms(
            epoch_year, epoch_dayfrac)
        JD_epoch = time.date2jd(epoch_year, epoch_mon, epoch_day, epoch_hr,
                                epoch_min, epoch_sec)[0]

        jump = (JD_i - JD_epoch) * 86400
        """Compute Constants of Perturbations"""
        raan_dot, w_dot, e_dot = PREDICT.j2dragpert(i_0, e_0, p_0, n_0,
                                                    nrate_0)
        """Jump to Start Time"""
        import pdb
        pdb.set_trace()
        n_s, e_s, raan_s, w_s, theta_s, M_s = PREDICT.update(
            jump, n_0, nrate_0, e_0, e_dot, raan_0, raan_dot, w_0, w_dot, M_0)
        i_s = i_0
        """Loop Times"""
        stp = JD_i
コード例 #8
0
ファイル: test_time.py プロジェクト: skulumani/astro
def test_dayofyr2mdhms_leap():
    yr = 2000
    days = 31+29
    expected_date = (2, 29, 0, 0, 0)
    actual_output = time.dayofyr2mdhms(yr, days)
    np.testing.assert_allclose(actual_output, expected_date)
コード例 #9
0
ファイル: test_time.py プロジェクト: skulumani/astro
def test_vallado_312_dayofyear():
    expected_mdhms = (3, 18, 12, 13, 59.99808)
    actual_mdhms = time.dayofyr2mdhms(2001, 77.5097222)
    np.testing.assert_allclose(actual_mdhms, expected_mdhms)
コード例 #10
0
ファイル: test_time.py プロジェクト: skulumani/astro
def test_dayofyr2mdhms_vallado_311():
    actual_yr, actual_days = 1992, 129.0
    actual_mo, actual_day, actual_hr, actual_min, actual_sec = 5, 8, 0, 0, 0

    actual_mdhms = time.dayofyr2mdhms(1992, 129)
    np.testing.assert_allclose(actual_mdhms, (actual_mo, actual_day, actual_hr, actual_min, actual_sec))
コード例 #11
0
ファイル: test_time.py プロジェクト: skulumani/astro
def test_dayofyr2mdhms_end():
    yr = 2006
    day = 180
    expected_output = (6, 29, 0, 0, 0)
    actual_output = time.dayofyr2mdhms(yr, day)
    np.testing.assert_allclose(actual_output, expected_output)
コード例 #12
0
"""Example for reading and using the TLE module
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from astro import tle, time
import numpy as np

filename = './data/example_tle.txt'

tles = tle.get_tle(filename)

# iterate over the tles list
for tle in tles:
    print('---------------------TLE Data from {}--------------------------'.format(tle.satname))
    yr = 2000+ tle.epoch_year
    mo, day, hr, mn, sec = time.dayofyr2mdhms(yr, tle.epoch_day)
    print('Epoch : {} JD'.format(time.date2jd(yr, mo, day, hr, mn, sec)[0]))