コード例 #1
0
def test_is_sun_sync_returns_true_for_sun_sync_orbit():
    pred1 = J2Predictor.sun_synchronous(alt_km=500, ecc=0)
    pred2 = J2Predictor.sun_synchronous(alt_km=500, inc_deg=97)
    pred3 = J2Predictor.sun_synchronous(ecc=0, inc_deg=97)

    assert is_sun_synchronous(pred1)
    assert is_sun_synchronous(pred2)
    assert is_sun_synchronous(pred3)
コード例 #2
0
    def test_sun_sync_from_eccentricity_and_inclination(self):
        # Vallado 3rd edition, example 11-2
        expected_sma = 7346.846

        pred = J2Predictor.sun_synchronous(ecc=0.2, inc_deg=98.6)
        self.assertAlmostEqual(pred.get_position().osculating_elements[0],
                               expected_sma,
                               places=1)
コード例 #3
0
    def test_sun_sync_from_altitude_and_inclination(self):
        # Hardcoded from our implementation
        expected_ecc = 0.14546153131334466

        pred = J2Predictor.sun_synchronous(alt_km=475, inc_deg=97)
        self.assertAlmostEqual(pred.get_position().osculating_elements[1],
                               expected_ecc,
                               places=14)
コード例 #4
0
    def test_sun_sync_from_altitude_and_eccentricity(self):
        # Vallado 3rd edition, example 11-2
        expected_inc = 98.6

        pred = J2Predictor.sun_synchronous(alt_km=800, ecc=0)
        self.assertAlmostEqual(pred.get_position().osculating_elements[2],
                               expected_inc,
                               places=2)
コード例 #5
0
    def test_sun_sync_delta_true_anomaly_non_circular(self):
        date = dt.datetime.today().date()
        ltan_h = 12
        expected_ref_epoch = dt.datetime(date.year, date.month, date.day, 12)

        for expected_ta_deg in [-30, 30]:
            pred = J2Predictor.sun_synchronous(
                alt_km=475, ecc=0.1455, date=date, ltan_h=ltan_h, ta_deg=expected_ta_deg
            )

            ta_deg = pred.get_position(expected_ref_epoch).osculating_elements[5]
            self.assertAlmostEqual(ta_deg, expected_ta_deg % 360, places=12)
コード例 #6
0
    def test_sun_sync_delta_true_anomaly_non_circular(self):
        date = dt.datetime.today().date()
        ltan_h = 12
        expected_ref_epoch = dt.datetime(date.year, date.month, date.day, 12)

        for ta_deg in [-30, 30]:
            pred = J2Predictor.sun_synchronous(
                alt_km=475, ecc=0.1455, date=date, ltan_h=ltan_h, ta_deg=ta_deg
            )

            self.assertEqual(pred._ta, ta_deg)
            self.assertEqual(pred._epoch, expected_ref_epoch)
コード例 #7
0
def test_eclipse_corner_case():
    # See https://github.com/satellogic/orbit-predictor/issues/96
    start = dt.datetime(2020, 9, 1)
    end = dt.datetime(2020, 9, 2)
    pred = J2Predictor.sun_synchronous(
        alt_km=470.0,
        ecc=0.001,
        ltan_h=19,
        ta_deg=0,
        date=start,
    )
    eclipses = list(pred.eclipses_since(when_utc=start, limit_date=end))

    assert len(eclipses) == 16