def error_sweeps(sweep_points=[1, 3, 10, 50, 100]): """ Answer the question: what measurement strategy is the best? """ h = h5py.File("master/drag_info.h5", "r") radar_e3d = rl.eiscat_3d(beam='interp', stage=1) # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, treshhold=0.01, # min diam min_inc=50, prop_time=48.0, ) t_sample = n.linspace(0, 24 * 3600.0, num=1000) for o in pop_e3d.object_generator(): # get drag info idx = n.where(h["oid"].value == o.oid)[0] o.alpha = h["alpha"].value[idx] o.t1 = h["t1"].value[idx] o.beta = h["beta"].value[idx] for spi, sp in enumerate(sweep_points): print(spi) all_t_obs, all_n_tracklets, all_t_means, all_t_lens = get_t_obs( o, radar_e3d, n_tracklets=50, track_length=3600.0, n_points=sp, h0=-48.0, h1=24 + 48, sort_by_length=False) error_cov, range_0 = linearized_errors(o, radar_e3d, all_t_obs, include_drag=True) mean_error, last_error, max_error = sample_orbit(o, error_cov, all_t_obs, plot=True, t_obs=t_sample) print("n_points %d n_tracklets %d mean_error %f" % (sp, all_n_tracklets, mean_error))
SNRs = [1.0, 10.0] for SNR_lim in SNRs: for radar in radars: radar.set_SNR_limits(SNR_lim, SNR_lim) ofname = master_in[:-4]\ + '_' + radar.name.replace(' ', '_')\ + '_' + default_propagator.__name__\ + '_' + str(int(np.round(radar.min_SNRdb))) + 'SNRdB'\ + '.h5' print('Output file: {}'.format(ofname)) pop = plib.filtered_master_catalog_factor( radar=radar, treshhold=0.01, min_inc=50, prop_time=48.0, ) plot_title = 'Detectable population: {} using {} with {} limit'.format( radar.name, default_propagator.__name__, str(int(np.round(radar.min_SNRdb))) + ' SNRdB') opts = {} opts['title'] = plot_title opts['xlabel'] = "Apogee [km]" opts['ylabel'] = "Count" opts['show'] = False print('Population size "{}": {}'.format(pop.name, len(pop)))
# For each detectable object: # - calculate number of passes over 24 hours # - calculate mean time between passes over 24 hours (24.0/N_passes) # - estimate amount of time that it takes to decorrelate # - save info n_passes_per_day, max_spacing, mean_spacing, is_maintainable # plot results for population radar = rlib.eiscat_3d(beam='interp', stage=1) base = '/home/danielk/IRF/E3D_PA/FP_sims/' # space object population pop_e3d = plib.filtered_master_catalog_factor( radar = radar, detectability_file = base + 'celn_20090501_00_EISCAT_3D_PropagatorSGP4_10SNRdB.h5', treshhold = 0.01, min_inc = 50, prop_time = 48.0, ) hour = 3600.0*24.0 pop_e3d.delete(slice(None, 3)) stop_t = 24.0*hour pass_dt = [] pass_dt_div = [] for space_o in pop_e3d.object_generator(): print(space_o) pass_struct = strack.get_passes(space_o, radar, 0.0*hour, stop_t)
def catalogue_maintenance(mean_error_threshold=100.0): """ figure out: - what are times of observations of objects - how many pulses are needed in order to maintain the objects - store results This can be used to "design" measurements for catalog objects. """ h = h5py.File("master/drag_info.h5", "r") radar_e3d = rl.eiscat_3d(beam='interp', stage=1) # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, treshhold=0.01, # min diam min_inc=50, prop_time=48.0, ) objs = [] for o in pop_e3d.object_generator(): objs.append(o) all_ids = [] t = n.linspace(-12 * 3600, (24 + 12) * 3600, num=1000) for oi in range(comm.rank, len(objs), comm.size): o = objs[oi] all_ids.append(o.oid) # get drag info idx = n.where(h["oid"].value == o.oid)[0] o.alpha = h["alpha"].value[idx] o.t1 = h["t1"].value[idx] o.beta = h["beta"].value[idx] for n_points in [1, 3, 10]: t_obs, n_tracklets, t_means, t_lens = get_t_obs( o, radar_e3d, n_tracklets=100, track_length=3600.0, n_points=n_points, h0=-12, h1=24 + 12, sort_by_length=True) error_cov, range_0 = linearized_errors(o, radar_e3d, t_obs, include_drag=True) mean_error, last_error, max_error = sample_orbit( o, error_cov, t_means, plot_t_means=t_obs, plot=True, use_atmospheric_errors=True, save_if_okay=False, fname="tracks/track-%d.png" % (o.oid), mean_error_threshold=mean_error_threshold, t_obs=t) print( "rank %d oid %d a %1.0f n_passes per day %f n_points %d mean_error %f (m)" % (comm.rank, o.oid, o.a, n_tracklets / 2.0, n_points, mean_error)) ho = h5py.File("tracks/track-%d.h5" % (o.oid), "w") ho["t_obs"] = t_obs ho["n_points"] = n_points ho["n_tracklets"] = n_tracklets ho["t_means"] = t_means ho["t_lens"] = t_lens ho["mean_error"] = mean_error ho["last_error"] = last_error ho["max_error"] = max_error ho.close() if mean_error < mean_error_threshold: break
def initial_discovery(beam_width=1.0): """ Simulate the process of object acquisition into a catalog. """ lost_threshold = 10e3 mean_error_threshold = 100.0 h = h5py.File("master/drag_info.h5", "r") radar_e3d = rl.eiscat_3d(beam='interp', stage=1) # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, treshhold=0.01, # min diam min_inc=50, prop_time=48.0, ) t = n.linspace(0, 24 * 3600, num=1000) mean_error_l = [] oid_l = [] n_tracklets_l = [] n_tracklets_per_day_l = [] n_points_l = [] o_idx_c = 0 objs = [] okay_ids = [] okay_errs = [] all_ids = [] for o in pop_e3d.object_generator(): objs.append(o) for oi in range(comm.rank, len(objs), comm.size): o = objs[oi] all_ids.append(o.oid) # get drag info idx = n.where(h["oid"].value == o.oid)[0] o.alpha = h["alpha"].value[idx] o.t1 = h["t1"].value[idx] o.beta = h["beta"].value[idx] n_tracklets = 0 # get measurement times try: all_t_obs, all_n_tracklets, all_t_means, all_t_lens = get_t_obs( o, radar_e3d, n_tracklets=24, track_length=3600.0, n_points=1, h0=0.0, h1=48, sort_by_length=False) ho = h5py.File("iods/iods_info_%02d.h5" % (comm.rank), "w") ho["okay"] = okay_ids ho["okay_errs"] = okay_errs ho["all"] = all_ids ho.close() for ti, t0 in enumerate(all_t_means): print("initial discovery simulation oid %d, iod %d" % (o.oid, ti)) t_obs, n_tracklets, t_means, t_lens = get_t_obs( o, radar_e3d, n_tracklets=1, track_length=3600.0, n_points=1, h0=t0 / 3600 - 1.0, h1=49, sort_by_length=False) initial_t0 = t_obs[0] # change epoch to discovery, so that at detection t=0 o2 = change_of_epoch_test(o, t_obs[0], plot=False) o2.alpha = o.alpha o2.t1 = o.t1 o2.beta = o.beta o2.oid = o.oid # drag not important for a < 10 minute interval error_cov, range_0 = linearized_errors(o2, radar_e3d, t_obs - initial_t0, include_drag=False) lost_threshold = range_0 * n.sin( n.pi * beam_width / 180.0) * 1e3 print("range_0 %f km lost_threshold %f (m)" % (range_0, lost_threshold)) mean_error, last_error, max_error = sample_orbit( o2, error_cov, t_means - initial_t0, plot_t_means=t_obs - initial_t0, plot=True, t_obs=n.linspace(0, t_lens[0], num=200), use_atmospheric_errors=False, fname="iods/iod_%d_%03d_00.png" % (o.oid, ti), max_error=lost_threshold) if last_error > lost_threshold: print("object lost") continue t_obs_next, n_tracklets_next, t_means_next, t_lens_next = get_t_obs( o, radar_e3d, n_tracklets=24, track_length=3600.0, n_points=1, h0=initial_t0 / 3600.0 + 1.0, h1=48 + initial_t0 / 3600.0, sort_by_length=False, n_points0=50) for nti in range(n_tracklets_next): next_pass_hour = (t_obs_next[nti] - initial_t0) / 3600.0 t_obs, n_tracklets, t_means, t_lens = get_t_obs( o, radar_e3d, n_tracklets=nti + 1, track_length=3600.0, n_points=10, h0=initial_t0 / 3600.0 - 1.0, h1=49 + initial_t0 / 3600.0, half_track=True, sort_by_length=False, n_points0=50) error_cov, range_0 = linearized_errors(o2, radar_e3d, t_obs - initial_t0, include_drag=True) mean_error, last_error, max_error = sample_orbit( o2, error_cov, t_means - initial_t0, plot_t_means=t_obs - initial_t0, plot=True, t_obs=n.linspace(0, next_pass_hour * 3600.0, num=1000), fname="iods/iod_%d_%03d_%02d.png" % (o.oid, ti, nti + 1), max_error=lost_threshold, use_atmospheric_errors=True) print("%d th pass %f mean_error %f" % (nti + 1, next_pass_hour, mean_error)) if last_error > lost_threshold: print("object lost") break print(nti) if nti == (n_tracklets_next - 1) and (n_tracklets_next > 2): okay_ids.append(o.oid) okay_errs.append(mean_error) print("object acquired") break except: print("problem.") pass
} elif prop == 'Orekit': _prop = propagator_orekit.PropagatorOrekit _opts = { 'in_frame': 'TEME', 'out_frame': 'ITRF', } branch_name = 'MASTER2009_' + prop + '_' + tx_power + '_' + freq #load the input population pop = plib.filtered_master_catalog_factor( radar=radar, treshhold=0.001, min_inc=50, prop_time=48.0, propagator=_prop, propagator_options=_opts, detectability_file=sim_root + '/' + branch_name + '.h5', ) sim = Simulation(radar=radar, population=pop, root=sim_root, scheduler=schlib.dynamic_scheduler, simulation_name='TSR fence beampark of MASTER2009') sim.observation_parameters( duty_cycle=0.125, SST_fraction=1.0, tracking_fraction=0.0,
('/home/danielk/IRF/E3D_PA/FP_sims/TSR_fence_beampark/MASTER2009_SGP4_500kW_1.2GHz', 0.001), ('/home/danielk/IRF/E3D_PA/FP_sims/TSR_beampark/MASTER2009_SGP4_100kW_1.2GHz', 0.001), ('/home/danielk/IRF/E3D_PA/FP_sims/TSR_beampark/MASTER2009_SGP4_500kW_1.2GHz', 0.01), ] for sim_path, th in sims_plot: branch = sim_path.split('/')[-1] sim_name = sim_path.split('/')[-2] sim_root = '/'.join(sim_path.split('/')[:-1]) fname = sim_root + '/' + branch + '/catalogue_data.h5' pop = plib.filtered_master_catalog_factor( radar = None, treshhold = th, min_inc = 50, prop_time = 48.0, detectability_file = sim_root + '/' + branch + '.h5', ) cat = Catalogue.from_file(pop, fname) _tr_scan = np.logical_and(cat.tracks['type'] == 'scan', cat.tracks['tracklet']) tracks_scan = cat.tracks[_tr_scan] detected = np.full((len(pop),), False, dtype=np.bool) if len(tracks_scan) > 0: detection_rates = cat.tracks[_tr_scan]['t0']
import antenna_library as alib import rewardf_library as rflib import dpt_tools as dpt _plot_out = '/ZFS_DATA/SORTSpp/FP_sims/plots' radar_e3d = rlib.eiscat_3d(beam='interp', stage=1) radar_e3d.set_FOV(max_on_axis=90.0, horizon_elevation=30.0) radar_e3d.set_SNR_limits(min_total_SNRdb=10.0, min_pair_SNRdb=1.0) radar_e3d.set_TX_bandwith(bw=1.0e6) pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, treshhold=0.01, min_inc=50, prop_time=48.0, ) sims_plot = [ # ('/ZFS_DATA/SORTSpp/FP_sims/E3D_scanning', 'scheduler_2d', pop_e3d), ] tsr_branches = [ 'MASTER2009_' + 'SGP4' + '_' + '500kW' + '_' + '1.2GHz', #'MASTER2009_' + 'SGP4' + '_' + '500kW' + '_' + '2.4GHz', #'MASTER2009_' + 'SGP4' + '_' + '100kW' + '_' + '1.2GHz', ] #initialize the radar setup radar = rlib.tromso_space_radar()
plt.ylabel("Position error standard deviation (m)") plt.show() if __name__ == "__main__": h = h5py.File("master/drag_info.h5", "r") dx = 0.1 dvx = 0.01 dc = 0.01 radar_e3d = rl.eiscat_3d(beam='interp', stage=1) # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, treshhold=0.01, # min diam min_inc=50, prop_time=48.0, ) t = n.linspace(0, 24 * 3600, num=1000) for o in pop_e3d.object_generator(): # get drag info idx = n.where(h["oid"].value == o.oid)[0] o.alpha = h["alpha"].value[idx] o.t1 = h["t1"].value[idx] o.beta = h["beta"].value[idx] t_obs, n_tracklets, t_means = get_t_obs(o, radar_e3d, n_tracklets=20, track_length=3600.0,
radar_e3d = rlib.eiscat_3d(beam='interp', stage=1) from propagator_orekit import PropagatorOrekit from propagator_neptune import PropagatorNeptune base = '/home/danielk/IRF/E3D_PA/FP_sims/' # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=radar_e3d, detectability_file=base + 'celn_20090501_00_EISCAT_3D_PropagatorSGP4_10SNRdB.h5', treshhold=0.01, min_inc=50, prop_time=48.0, #propagator = PropagatorNeptune, #propagator_options = { #}, propagator=PropagatorOrekit, propagator_options={ 'in_frame': 'EME', 'out_frame': 'ITRF', }, ) oids = [] taus = [] offsets = [] t1s = [] alphas = [] n_passes = [] mean_time_between_passes = [] t = n.linspace(0, 24 * 3600, num=10000)
master_in = "./master/celn_20090501_00.sim" base_pop = plib.master_catalog_factor( input_file=master_in, treshhold=0.01, seed=65487945, ) for ofname, title, fname in detects: if os.path.exists(ofname): print('Output file: {}'.format(ofname)) pop = plib.filtered_master_catalog_factor( radar=None, detectability_file=ofname, treshhold=0.01, min_inc=50, prop_time=48.0, ) plot_title = 'Detectable population: {}'.format(title) opts = {} opts['title'] = plot_title opts['xlabel'] = "Apogee [km]" opts['ylabel'] = "Count" opts['show'] = False print('Population size "{}": {}'.format(pop.name, len(pop))) fig_d, ax_d = pop.plot_distribution('d',
#!/usr/bin/env python import radar_library as rl # radar network definition import population_library as plib import matplotlib.pyplot as plt e3d = rl.eiscat_3d(beam='interp', stage=1) e3d_module = rl.eiscat_3d_module(beam='gauss') # space object population pop_e3d = plib.filtered_master_catalog_factor( radar=e3d, treshhold=0.01, # min diam min_inc=50, detectability_file= "master/celn_20090501_00_EISCAT_3D_PropagatorSGP4_10SNRdB.h5", prop_time=48.0, ) # space object population pop_e3d_mod = plib.filtered_master_catalog_factor( radar=e3d_module, treshhold=0.01, # min diam min_inc=50, detectability_file= "master/celn_20090501_00_EISCAT_3D_module_PropagatorSGP4_10SNRdB.h5", prop_time=48.0, ) module = False if module: name = "E3D Module"