def compare_perturbers_orekit(): f, ax = plt.subplots(2, 1) sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) trySentinel1_compare( ax, sv, 'no solarsystem perturbers', C_D=2.3, C_R=1.0, radiation_pressure=True, solarsystem_perturbers=[], ) trySentinel1_compare( ax, sv, 'Moon + sun perturbers', C_D=2.3, C_R=1.0, radiation_pressure=True, solarsystem_perturbers=['Moon', 'Sun'], ) ax[0].set_title( 'Errors from propagation: Third body perturbations comparison') ax[0].set_ylabel('Position error [m]') ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]') ax[0].legend() plt.show()
def compare_grav_orekit(): f, ax = plt.subplots(2, 1) sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) trySentinel1_compare( ax, sv, 'Newtonian grav', C_D=2.3, C_R=1.0, radiation_pressure=True, earth_gravity='Newtonian', ) trySentinel1_compare( ax, sv, 'HolmesFeatherstone grav', C_D=2.3, C_R=1.0, radiation_pressure=True, earth_gravity='HolmesFeatherstone', ) ax[0].set_title('Errors from propagation: gravity model') ax[0].set_ylabel('Position error [m]') ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]') ax[0].legend() plt.show()
def compare_C_D_orekit(): sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) N = len(sv) t = 10 * np.arange(N) f, ax = plt.subplots(2, 1) trySentinel1_compare( ax, sv, 'C_D = 1.6', C_D=1.6, C_R=1.0, radiation_pressure=True, ) pv = trySentinel1_compare( ax, sv, 'C_D = 2.3', C_D=2.3, C_R=1.0, radiation_pressure=True, ) trySentinel1_compare( ax, sv, 'C_D = 3.0', C_D=3.0, C_R=1.0, radiation_pressure=True, ) ax[0].set_title('Errors from propagation: drag coefficient comparison') ax[0].set_ylabel('Position error [m]') ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]') ''' ax2 = ax[0].twinx() ax2.plot(t/3600., np.linalg.norm(pv[:3].T, axis=1), 'b.', alpha=0.25) ax2.set_ylabel('Orbital radius', color='b') ax2.tick_params('y', colors='b') ''' f.tight_layout() ax[0].legend() plt.show()
def compare_effects_orekit(): f, ax = plt.subplots(2, 1) sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) trySentinel1_compare( ax, sv, 'No tidal, No PR', C_D=2.3, C_R=1.0, frame_tidal_effects=False, radiation_pressure=False, ) trySentinel1_compare( ax, sv, 'No tidal, PR', C_D=2.3, C_R=1.0, frame_tidal_effects=False, radiation_pressure=True, ) trySentinel1_compare( ax, sv, 'Tidal, PR', C_D=2.3, C_R=1.0, frame_tidal_effects=True, radiation_pressure=True, ) ax[0].set_title('Errors from propagation: tidal and radiation effect') ax[0].set_ylabel('Position error [m]') ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]') ax[0].legend() plt.show()
def trySentinel1(**kw): p = PropagatorOrekit( in_frame='ITRF', out_frame='ITRF', frame_tidal_effects=True, #earth_gravity='Newtonian', #radiation_pressure=False, #solarsystem_perturbers=[], #drag_force=False, ) sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) x, y, z = sv[0].pos vx, vy, vz = sv[0].vel mjd0 = (sv[0]['utc'] - np.datetime64('1858-11-17')) / np.timedelta64( 1, 'D') N = len(sv) t = 10 * np.arange(N) kwargs = dict(m=2300., C_R=0., C_D=.0, A=4 * 2.3) kwargs.update(**kw) pv = p.get_orbit_cart(t, x, y, z, vx, vy, vz, mjd0, **kwargs) perr = np.linalg.norm(pv[:3].T - sv.pos, axis=1) verr = np.linalg.norm(pv[3:].T - sv.vel, axis=1) f, ax = plt.subplots(2, 1) ax[0].plot(t / 3600., perr) ax[0].set_title('Errors from propagation') ax[0].set_ylabel('Position error [m]') ax[1].plot(t / 3600., verr) ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]')
o_nept = dict() p_orekit = PropagatorOrekit o_orekit = dict( in_frame='TEME', out_frame='ITRF', ) props = [ (p_sgp4, o_sgp4), (p_nept, o_nept), # (p_orekit,o_orekit), ] # wtf is this? sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) sv = sv[:8641] x, y, z = sv[0].pos / 1e3 vx, vy, vz = sv[0].vel / 1e3 mjd0 = (sv[0]['utc'] - np.datetime64('1858-11-17')) / np.timedelta64(1, 'D') _alph = 0.75 N = len(sv) t = 10 * np.arange(N) fig, axs = plt.subplots(2, 1)
def trySentinel1_array(**kw): p = PropagatorOrekit( in_frame='ITRF', out_frame='ITRF', frame_tidal_effects=True, #earth_gravity='Newtonian', #radiation_pressure=False, #solarsystem_perturbers=[], #drag_force=False, ) sv, _, _ = over.read_poe( 'data/S1A_OPER_AUX_POEORB_OPOD_20150527T122640_V20150505T225944_20150507T005944.EOF' ) x, y, z = sv[0].pos vx, vy, vz = sv[0].vel mjd0 = (sv[0]['utc'] - np.datetime64('1858-11-17')) / np.timedelta64( 1, 'D') N = len(sv) t = 10 * np.arange(N) num = [] for _, item in kw.items(): num.append(len(item)) num = np.sum(num) / float(len(num)) if np.abs(num - np.round(num)) < 1e-9: num = int(num) else: raise Exception('All vectors not equal length') perr = np.empty((N, num), dtype=np.float64) verr = np.empty((N, num), dtype=np.float64) kwargs = dict(m=2300., C_R=0., C_D=.0, A=4 * 2.3) comm = MPI.COMM_WORLD rank = comm.rank pool = comm.size my_range = list(range(rank, num, pool)) for place, ind in enumerate(my_range): print('PID{}: {}/{} orbits done'.format(rank, place, len(my_range))) for key, item in kw.items(): kwargs.update({key: item[ind]}) pv = p.get_orbit_cart(t, x, y, z, vx, vy, vz, mjd0, **kwargs) perr[:, ind] = np.linalg.norm(pv[:3].T - sv.pos, axis=1) verr[:, ind] = np.linalg.norm(pv[3:].T - sv.vel, axis=1) if pool > 1: if rank == 0: print( '---> Thread {}: Receiving all results <barrier>'.format(rank)) for T in range(1, pool): for ind in range(T, num, pool): perr[:, ind] = comm.recv(source=T, tag=ind) verr[:, ind] = comm.recv(source=T, tag=ind * 10) else: print( '---> Thread {}: Distributing all filter results to thread 0 <barrier>' .format(rank)) for ind in my_range: comm.send(perr[:, ind], dest=0, tag=ind) comm.send(verr[:, ind], dest=0, tag=ind * 10) print('---> Distributing done </barrier>') if rank == 0: f, ax = plt.subplots(2, 1) for ind in range(num): ax[0].plot(t / 3600., perr[:, ind], '-b', alpha=0.01) ax[1].plot(t / 3600., verr[:, ind], '-b', alpha=0.01) ax[0].set_title('Errors from propagation') ax[0].set_ylabel('Position error [m]') ax[1].set_ylabel('Velocity error [m/s]') ax[1].set_xlabel('Time [h]') plt.show()