def test_options_more_solarsystem(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(
             solarsystem_perturbers=['Moon', 'Sun', 'Jupiter', 'Saturn'], ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
 def test_raise_bodies(self):
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(solarsystem_perturbers=['THIS DOES NOT EXIST'
                                                   ], ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
 def test_options_frames(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(
             in_frame='ITRS',
             out_frame='GCRS',
         ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
 def test_options_gravity_order(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(
             earth_gravity='HolmesFeatherstone',
             gravity_order=(3, 3),
         ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
    def test_raise_sc_params_missing(self):
        p = Orekit(
            orekit_data=self.orekit_data,
            settings=dict(
                radiation_pressure=True,
                drag_force=True,
            ),
        )
        with self.assertRaises(Exception):
            init__ = self.init_data.copy()
            del init__['C_R']

            ecefs = p.propagate(self.t0, **init__)

        with self.assertRaises(Exception):
            init__ = self.init_data.copy()
            del init__['C_D']

            ecefs = p.propagate(self.t0, **init__)
 def test_raise_models(self):
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(earth_gravity='THIS DOES NOT EXIST', ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(atmosphere='THIS DOES NOT EXIST', ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(solar_activity='THIS DOES NOT EXIST', ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
 def test_options_tolerance(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(position_tolerance=1.0, ),
     )
     ecefs1 = p.propagate(self.t0, **self.init_data)
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(position_tolerance=100.0, ),
     )
     ecefs2 = p.propagate(self.t0, **self.init_data)
     nt.assert_array_almost_equal(ecefs2, ecefs1, decimal=1)
 def test_raise_frame(self):
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(in_frame='THIS DOES NOT EXIST', ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
     with self.assertRaises(Exception):
         p = Orekit(
             orekit_data=self.orekit_data,
             settings=dict(out_frame='THIS DOES NOT EXIST', ),
         )
         ecefs = p.propagate(self.t0, **self.init_data)
示例#9
0
'''
import numpy as np

from sorts.profiling import Profiler
from sorts.propagator import Orekit

p = Profiler()
p.start('total')

orekit_data = '/home/danielk/IRF/IRF_GITLAB/orekit_build/orekit-data-master.zip'

prop = Orekit(
    orekit_data=orekit_data,
    settings=dict(
        in_frame='ITRS',
        out_frame='GCRS',
        drag_force=False,
        radiation_pressure=False,
    ),
    profiler=p,
)

print(prop)

state0 = np.array(
    [-7100297.113, -3897715.442, 18568433.707, 86.771, -3407.231, 2961.571])
t = np.linspace(0, 3600 * 24.0 * 2, num=5000)
mjd0 = 53005

states = prop.propagate(t, state0, mjd0, A=1.0, C_R=1.0, C_D=1.0)

p.stop('total')
示例#10
0
 def test_options_gravity_kep(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(earth_gravity='Newtonian', ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
示例#11
0
================================
'''

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

from sorts.propagator import Orekit

orekit_data = '/home/danielk/IRF/IRF_GITLAB/orekit_build/orekit-data-master.zip'

prop = Orekit(
    orekit_data = orekit_data, 
    settings=dict(
        in_frame='Orekit-ITRF',
        out_frame='Orekit-EME',
        drag_force = False,
        radiation_pressure = False,
    )
)

print(prop)

state0 = np.array([-7100297.113,-3897715.442,18568433.707,86.771,-3407.231,2961.571])
t = np.linspace(0,3600*24.0*2,num=5000)
mjd0 = 53005

states = prop.propagate(t, state0, mjd0, A=1.0, C_R = 1.0, C_D = 1.0)


fig = plt.figure(figsize=(15,15))
示例#12
0
 def test_options_integrator(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(integrator='GraggBulirschStoer', ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
示例#13
0
 def test_options_drag_off(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(drag_force=False, ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
示例#14
0
 def test_options_tidal(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(frame_tidal_effects=True, ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
示例#15
0
    def test_get_orbit_kep(self):
        p = Orekit(orekit_data=self.orekit_data)

        ecefs = p.propagate(self.t, **self.init_data)
        self.assertEqual(ecefs.shape, (6, len(self.t)))
示例#16
0
def determine_orbit(sources, start, propagator, epoch, mcmc=False, **kwargs):

    ret = dict()

    samples = kwargs.get('samples', int(1e5))

    logger = sorts.profiling.get_logger('od', term_level=logging.CRITICAL)

    if propagator.lower() == 'orekit':
        from sorts.propagator import Orekit

        prop = Orekit(
            orekit_data=kwargs['orekit_data'],
            settings=dict(
                in_frame='TEME',
                out_frame='ITRS',
                drag_force=kwargs.get('drag_force', False),
                radiation_pressure=False,
            ),
            logger=logger,
        )
        params = dict()
        variables = ['x', 'y', 'z', 'vx', 'vy', 'vz']
        # step_arr = kwargs.get('step', np.array([1e3,1e3,1e3,1e1,1e1,1e1], dtype=np.float64))
        step_arr = kwargs.get('step', np.ones((6, ), dtype=np.float64) * 0.1)

        prior = None

    elif propagator.lower() == 'mean-elements':
        prop = SGP4(
            settings=dict(
                in_frame='TEME',
                out_frame='ITRS',
            ),
            logger=logger,
        )
        params = dict(SGP4_mean_elements=True)
        variables = ['a', 'e', 'i', 'raan', 'aop', 'mu']
        # step_arr = kwargs.get('step', np.array([1e3,1e-2,1.,1.,1.,1.], dtype=np.float64))
        step_arr = kwargs.get('step', np.ones((6, ), dtype=np.float64) * 0.1)
        prior = [
            dict(
                variables=['e'],
                distribution='uniform',
                params=dict(
                    loc=1e-12,
                    scale=1.0 - 2e-12,
                ),
            ),
        ]

    elif propagator.lower() == 'sgp4':
        prop = SGP4(
            settings=dict(
                in_frame='TEME',
                out_frame='ITRS',
            ),
            logger=logger,
        )
        params = dict(SGP4_mean_elements=False)
        variables = ['x', 'y', 'z', 'vx', 'vy', 'vz']
        # step_arr = kwargs.get('step', np.array([1e3,1e3,1e3,1e1,1e1,1e1], dtype=np.float64))
        step_arr = kwargs.get('step', np.ones((6, ), dtype=np.float64) * 0.1)

        prior = None

    else:
        raise ValueError(f'Propagator "{propagator}" not recognized.')

    params.update(kwargs.get('params', {}))
    dtype = [(name, 'float64') for name in variables]

    if isinstance(epoch, Time):
        epoch0 = epoch
    else:
        epoch0 = Time(epoch, format='datetime64', scale='utc')

    state0_named = np.empty((1, ), dtype=dtype)
    step = np.empty((1, ), dtype=dtype)

    for ind, name in enumerate(variables):
        state0_named[name] = start[ind]
        step[name] = step_arr[ind]

    ret['state0_named'] = state0_named
    ret['step'] = step
    ret['variables'] = variables

    input_data_state = {
        'sources': sources,
        'Models': [CameraStation] * len(sources),
        'date0': epoch0.datetime64,
        'params': params,
    }

    post_init = OptimizeLeastSquares(
        data=input_data_state,
        variables=variables,
        state_variables=variables,
        start=state0_named,
        prior=prior,
        propagator=prop,
        method='Nelder-Mead',
        options=dict(
            maxiter=10000,
            disp=False,
            xatol=1e-3,
        ),
    )

    post_init.run()

    ret['post_init'] = post_init

    if mcmc:
        post = MCMCLeastSquares(
            data=input_data_state,
            variables=variables,
            state_variables=variables,
            start=post_init.results.MAP,
            prior=prior,
            propagator=prop,
            method='SCAM',
            proposal='LinSigma',
            method_options=dict(
                accept_max=0.6,
                accept_min=0.3,
                adapt_interval=1000,
            ),
            steps=samples,
            step=step,
            tune=1000,
        )

        post.run()
    else:
        post = post_init

    ret['post'] = post

    return ret
示例#17
0
 def test_options_rad_off(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(radiation_pressure=False, ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)
示例#18
0
 def test_options_jpliau(self):
     p = Orekit(
         orekit_data=self.orekit_data,
         settings=dict(constants_source='JPL-IAU', ),
     )
     ecefs = p.propagate(self.t0, **self.init_data)