def test_get_passes(self): pass_struct = simulate_tracking.get_passes( self.o, self.radar, t0=0.0, t1=self.T, max_dpos=1e3, logger=None, plot=False, ) assert 't' in pass_struct assert 'snr' in pass_struct assert len(pass_struct['t']) == len(self.radar._tx) assert len(pass_struct['snr']) == len(self.radar._tx) assert len(pass_struct['t'][0]) == 1 assert len(pass_struct['snr'][0]) == 1 assert len(pass_struct['t'][0][0]) == 2 assert len(pass_struct['snr'][0][0][0]) == 2 ecef = self.o.get_orbit(pass_struct['snr'][0][0][0][1]) rel_vec = ecef.T - self.radar._rx[ 0].ecef #check that its above the radar at max self.assertLess(n.linalg.norm(rel_vec) - (7500e3 - wgs84_a), 1.0) #1m self.assertLess(n.abs(pass_struct['t'][0][0][0] - self.rise_T), self.T / self.num * 20.0) self.assertLess(n.abs(pass_struct['t'][0][0][1] - self.fall_T), self.T / self.num * 20.0)
def test_get_passes_many_tx(self): pass_struct = simulate_tracking.get_passes( self.o, self.big_radar, t0=0.0, t1=self.T, max_dpos=1e3, logger=None, plot=False, ) assert 't' in pass_struct assert 'snr' in pass_struct assert len(pass_struct['t']) == len(self.big_radar._tx) assert len(pass_struct['snr']) == len(self.big_radar._tx) assert len(pass_struct['t'][0]) == 1 assert len(pass_struct['snr'][0]) == 1 assert len(pass_struct['snr'][0][0]) == len(self.big_radar._rx) assert len(pass_struct['t'][0][0]) == 2 assert len(pass_struct['snr'][0][0][0]) == 2 for ind, times in enumerate( pass_struct['snr'][0][0] ): #they are in series along lat line and thus the times should be in decreeing order if ind == 0: last_time = times[1] else: assert last_time > times[1] assert times[ 0] > 0.0, 'snr should always be above 0 in this situation' self.assertLess(n.abs(pass_struct['t'][0][0][0] - self.rise_T), self.T / self.num * 20.0) self.assertLess(n.abs(pass_struct['t'][0][0][1] - self.fall_T), self.T / self.num * 20.0) self.assertLess(n.abs(pass_struct['t'][1][0][0] - self.rise_T), 600.0) #should be close to same rise fall time self.assertLess(n.abs(pass_struct['t'][1][0][1] - self.fall_T), 600.0) ecef = self.o.get_orbit(pass_struct['snr'][0][0][2][1]) rel_vec = ecef.T - self.big_radar._rx[ 2].ecef #check that its above the radar at max self.assertLess(n.linalg.norm(rel_vec) - (7500e3 - wgs84_a), 1) #1m
def test_get_angles(self): pass_struct = simulate_tracking.get_passes( self.o, self.radar, t0=0.0, t1=self.T, max_dpos=1e3, logger=None, plot=False, ) t, angles = simulate_tracking.get_angles(pass_struct, self.o, self.radar, dt=0.1) self.assertLess(n.min(angles[0]), 0.1)
passes = [None]*len(pop) t0 = time.time() cnt = 0 for ind, sobj in enumerate(gen): if ind in my_inds: cnt += 1 t_elaps = time.time() - t0 print('Object {} of {}: {} h elapsed, estimated time left {} h'.format( ind, len(pop), t_elaps/3600.0, t_elaps/float(cnt)*(len(my_inds) - cnt)/3600.0, )) pass_struct = simulate_tracking.get_passes(sobj, radar, 0.0, SIM_TIME, t_samp=60.0) passes[ind] = pass_struct if comm.rank == 0: for thr_id in range(1,comm.size): for ind in range(thr_id, len(pop), comm.size): passes[ind] = comm.recv(source=thr_id, tag=ind) else: for ind in my_inds: comm.send(passes[ind], dest=0, tag=ind) if comm.rank == 0: with open(sim_root + '/passes.pickle','wb') as pickle_out: pickle.dump(passes, pickle_out) # analysis here
#space_o.diam=0.1 space_o = so.space_object(a=7000, e=0.0, i=72, raan=0, aop=0, mu0=0, C_D=2.3, A=1.0, m=1.0, diam=0.1) det_times = st.get_passes(space_o, radar, 0 * 3600, 2 * 3600, max_dpos=50.0, debug=False) t_up = det_times['t'][0][0][0] t_down = det_times['t'][0][0][1] t_max = det_times['snr'][0][0][0][1] t = n.linspace(t_up, t_down, num=100) ecefs = space_o.get_state(t) print('---> PASS %.2f h to %.2f h' % (n.min(t) / 3600.0, n.max(t) / 3600.0)) all_snrs = st.get_track_snr(t, space_o, radar) all_snrs = 10.0 * n.log10(n.array(all_snrs)) #st.plot_snr(t,all_snrs,radar)
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) plist = pass_struct["t"][0] dt = [] for ind in range(len(plist)): if ind > 0: dt.append(plist[ind][0] - plist[ind-1][0]) if len(plist) > 0: pass_dt_div.append(stop_t/float(len(plist))) else: pass_dt_div.append(np.nan) if len(dt) > 0: pass_dt.append(np.mean(dt)) else:
def create_measurements(o, radar, t0=0, track_length=1000.0, n_tracklets=2, n_meas=10, debug=False, max_time=24 * 3 * 3600.0): obs = st.get_passes(o, radar, t0, t0 + max_time, max_dpos=100.0, debug=False) t = n.array(obs["t"]) snr = n.array(obs["snr"]) n_tx = len(radar._tx) n_rx = len(radar._rx) n_passes = t.shape[1] if debug: print("n_passes %d" % (n_passes)) max_track_length = n.max(t[:, :, 1] - t[:, :, 0]) min_track_length = n.min(t[:, :, 1] - t[:, :, 0]) if debug: print("maximum track length %1.2f (s)" % (max_track_length)) print("minimum track length %1.2f (s)" % (min_track_length)) # what tracklets do we measure # each tracklet is specified with a vector of times tracklets = [] # these are the possible observations # for each transmitter for txi in range(n_tx): # for each pass for pi in range(n_passes): rise_t = t[txi, pi, 0] set_t = t[txi, pi, 1] max_track_length = set_t - rise_t this_track_length = n.min([track_length, max_track_length]) # how many measurements can be made for this pass if debug: print( "tx %d pass %d rise %1.2f (s) set %1.2f (s) max track length %1.2f (s) track length %1.2f (s) n_meas %d" % (txi, pi, rise_t, set_t, max_track_length, this_track_length, n_meas)) # peak snr time mean_obs_t = 0.0 # for each receiver for rxi in range(n_rx): peak_snr = snr[txi, pi, rxi, 0] peak_t = snr[txi, pi, rxi, 1] mean_obs_t += peak_t if debug: print(" rx %d peak_snr %1.2f (dB) peak snr time %1.2f" % (rxi, 10.0 * n.log10(peak_snr), peak_t)) # the time of peak SNR mean_obs_t = mean_obs_t / float(n_rx) # times of observation m_idx = n.arange(n_meas, dtype=n.float) if n_meas == 1: obs_time = n.array([mean_obs_t]) else: obs_time = n.linspace( n.max([peak_t - track_length / 2.0, rise_t + 0.1]), n.min([peak_t + track_length / 2.0, set_t - 0.1]), num=n_meas) # make sure they fit the rise and set times for object good_idx = n.where((obs_time > rise_t) & (obs_time < set_t))[0] obs_time = obs_time[good_idx] if len(tracklets) < n_tracklets: tracklets.append(obs_time) print("found %d tracklets" % (len(tracklets))) return (tracklets)
# SORTS imports CORE import population as p #SORTS Libraries import radar_library as rl import radar_scan_library as rslib import scheduler_library as sch import antenna_library as alib import space_object as so import simulate_tracking #initialize the radar setup radar = rl.eiscat_3d() radar.set_FOV(max_on_axis=25.0, horizon_elevation=30.0) radar.set_SNR_limits(min_total_SNRdb=10.0, min_pair_SNRdb=0.0) radar.set_TX_bandwith(bw = 1.0e6) radar.set_beam('TX', alib.e3d_array_beam_stage1(opt='dense') ) radar.set_beam('RX', alib.e3d_array_beam() ) o = so.space_object( a=7000, e=0.0, i=72, raan=0, aop=0, mu0=0, C_D=2.3, A=1.0, diam=0.7, m=1.0, ) #Get detections for 1 d det_times = simulate_tracking.get_passes(o, radar, 0, 24.*3600., max_dpos=50.0) simulate_tracking.print_passes(det_times)
#az_points = n.arange(0,360,45).tolist() + [0.0]; #el_points = [90.0-n.arctan(50.0/300.0)*180.0/n.pi, 90.0-n.arctan(n.sqrt(2)*50.0/300.0)*180.0/n.pi]*4+[90.0]; #radar_scan = rslib.n_const_pointing_model(az_points,el_points,len(az_points),dwell_time = 0.4) radar_scan = rslib.beampark_model(az=0.0,el=90.0) radar_scan.set_radar_location(radar) radar.set_scan(radar_scan) obs_par = sch.calculate_observation_params( \ duty_cycle = 0.25, \ SST_f = 1.0, \ tracking_f = 0.0, \ coher_int_t=0.2) sch.configure_radar_to_observation(radar,obs_par,'scan') # get all IODs for one object during 24 hours o=so.space_object(a=7000,e=0.0,i=72,raan=0,aop=0,mu0=0,C_D=2.3,A=1.0,m=1.0,diam=0.1) det_times=st.get_passes(o,radar,69*3600.,70*3600.,max_dpos=50.0) #['t'][tx 0][pass 2][above horizon time = 0, below = 1] ts,angs = st.get_angles(det_times,o,radar) #st.plot_angles(ts,angs) st.print_passes(det_times) tresh = 10.0 #DETECTION LIMIT IN COHERRENTLY INTEGRATED SNR rem_t = 10.0 #HARD REMOVAL LIMIT IN SUBGROUP SNR simulate_full_scaning_snr_curve(radar,o,det_times,tresh,rem_t,obs_par,groups=54, plot = True, verbose=True)