def test_eci_aer(useastropy): t = '2013-01-15T12:00:05' aer1 = pm.eci2aer(*eci0, 42, -100, 0, t, useastropy=useastropy) assert aer1 == approx([83.73050, -6.614478, 1.473510e6], rel=0.001) assert pm.aer2eci(*aer1, 42, -100, 0, t, useastropy=useastropy) == approx(eci0, rel=0.001) with pytest.raises(ValueError): pm.aer2eci(aer1[0], aer1[1], -1, 42, -100, 0, t, useastropy=useastropy)
def test_eci_aer(useastropy): pytest.importorskip("numpy") t = "2013-01-15T12:00:05" aer1 = pm.eci2aer(*eci0, 42, -100, 0, t, useastropy=useastropy) assert aer1 == approx([83.73050, -6.614478, 1.473510e6], rel=0.001) assert pm.aer2eci(*aer1, 42, -100, 0, t, useastropy=useastropy) == approx(eci0, rel=0.001) with pytest.raises(ValueError): pm.aer2eci(aer1[0], aer1[1], -1, 42, -100, 0, t, useastropy=useastropy)
def test_aer2eci(use_astropy): # test coords from Matlab aer2eci pytest.importorskip("numpy") if use_astropy: pytest.importorskip("astropy") aer = [162.55, 55.12, 384013940.9] lla = [28.4, -80.5, 2.7] t = datetime(1969, 7, 20, 21, 17, 40) eci = pm.aer2eci(*aer, *lla, t, use_astropy=use_astropy) rel = 0.001 if use_astropy else 0.06 assert eci == approx([-3.8454e8, -0.5099e8, -0.3255e8], rel=rel) with pytest.raises(ValueError): pm.aer2eci(aer[0], aer[1], -1, *lla, t)
def test_eci_vallado(): t = '2013-01-15T12:00:05' lla = pm.eci2geodetic(eci0, t, useastropy=False) assert lla == approx(lla0, rel=0.2) eci1 = pm.eci2ecef(eci0, t, useastropy=False) assert eci1 == approx( [649012.04640917, -4697980.55129606, 4250818.82815207], rel=0.001) assert pm.ecef2eci(eci1, t, useastropy=False) == approx(eci0, rel=0.001) aer1 = pm.eci2aer(eci0, 42, -100, 0, t, useastropy=False) assert aer1 == approx([83.73050, -6.614478, 1.473510e6], rel=0.001) assert pm.aer2eci(*aer1, 42, -100, 0, t, useastropy=False) == approx(eci0, rel=0.001) with pytest.raises(ValueError): pm.aer2eci(aer1[0], aer1[1], -1, 42, -100, 0, t, useastropy=False)
def eci_position_from_pulse(pulse, lat, long, alt): time, az, el, r = pulse.split("\t") t = datetime.strptime(time, "%Y-%m-%d-%H:%M:%S.%f-%Z") # az: azimuth (degrees) # el: elevation (degrees) # r: range (km -> m) x, y, z = pm.aer2eci(float(az), float(el), float(r) * 1000, lat, long, alt, t, deg=True) return [x, y, z], t
def test_eci_astropy(): pytest.importorskip('astropy') t = '2013-01-15T12:00:05' lla = pm.eci2geodetic(eci0, t) assert lla == approx(lla0, rel=0.2) eci1 = pm.eci2ecef(eci0, t) assert eci1 == approx( [649012.04640917, -4697980.55129606, 4250818.82815207]) assert pm.ecef2eci(eci1, t) == approx(eci0) aer1 = pm.eci2aer(eci0, 42, -100, 0, t) assert aer1 == approx([83.73050, -6.614478, 1.473510e6]) assert pm.aer2eci(*aer1, 42, -100, 0, t) == approx(eci0) with pytest.raises(ValueError): pm.aer2eci(aer1[0], aer1[1], -1, 42, -100, 0, t)