def aer_obs(self, obs): i = self.i for j in range(self.m): obs[4*j: 4*j + 3] = hx(self.x_filter[i, j, :3], self.trans_matrix[i], self.obs_lla, self.obs_itrs) obs[4*j + 3] = np.trace(self.P_filter[i, j]) obs = np.nan_to_num(obs, copy=False, nan=0.001, posinf=0.001, neginf=0.001) return obs
def aer_true_all(self): s = time.time() aer = [] for i in range(self.n): for j in range(self.m): aer.append(hx(self.x_true[i, j, :3], self.trans_matrix[i], self.obs_lla, self.obs_itrs)) aer = np.array(aer) aer = np.reshape(aer, (self.n, self.m, 3)) e = time.time() self.runtime['all_true_obs'] += e - s return aer
candidates = [] seed = 0 random_state = np.random.RandomState(seed) for i in tqdm(range(samples)): regime = random_state.choice(a=['LEO', 'MEO', 'GEO', 'Tundra', 'Molniya'], p=[1 / 3, 1 / 3, 1 / 9, 1 / 9, 1 / 9]) accepted = False while not accepted: candidate = init_state_vec(orbits=[regime], random_state=random_state) x_gcrs = [fx(candidate, step_size * i) for i in range(n)] x_itrs = [x_gcrs[i][:3] @ trans_matrix[i] for i in range(n)] x_lla = np.array([ecef2lla(x_itrs[i]) for i in range(n)]) candidate_elevation = [ hx(x_gcrs=x_gcrs[i][:3], **hx_kwargs[i])[1] for i in range(n) ] visibility = candidate_elevation >= obs_limit gaps = [ sum(1 for _ in group) for key, group in itertools.groupby((visibility - 1) * -1) if key ] if np.all(x_lla[:, 2] > 300 * 1000): if not gaps == []: if sum(visibility[0:int(first_window * 60 / step_size)]) > 0: if np.max(gaps) < max_gap * 60 * 60 / step_size: candidates.append(candidate) accepted = True else: if np.all(visibility): candidates.append(candidate)
]) observer_lat = np.radians(38.828198) observer_lon = np.radians(-77.305352) observer_alt = np.float64(20.0) # in meters observer_lla = np.array([observer_lat, observer_lon, observer_alt]) observer_itrs = lla2ecef(observer_lla) # meter t = datetime(year=2007, month=4, day=5, hour=12, minute=0, second=0) trans_matrix = gcrs2irts_matrix_b(t, eop) hx_args1 = (trans_matrix, observer_lla, observer_itrs) hx_args2 = (t, observer_lla, None, observer_itrs) z1 = hx(x, *hx_args1) z2 = hx2(x, *hx_args2) hx_error = z2 - z1 print("Test 10a: hx error in azimuth (arc seconds) = ", np.degrees(hx_error[0]) * 60 * 60) print("Test 10b: hx error in elevation (arc seconds) = ", np.degrees(hx_error[1]) * 60 * 60) print("Test 10c: hx error in slant range (meters) = ", hx_error[2]) # resolved Issue opened with AstroPy at https://github.com/astropy/astropy/issues/10407 # !------------ Test 11 - Az El Updates from filterpy.kalman import MerweScaledSigmaPoints as MerweScaledSigmaPoints from filterpy.kalman.UKF import UnscentedKalmanFilter as UnscentedKalmanFilter