def object_visible(self, RSO_ID=[]): if not RSO_ID: print('RSO ID expected, but not supplied') return RSO_ID x_itrs = np.array([self.trans_matrix[self.i] @ self.x_true[self.i, j, :3] for j in RSO_ID]) el = np.array([ecef2aer(self.obs_lla, x, self.obs_itrs)[1] for x in x_itrs]) viz_bool = el >= self.obs_limit return viz_bool
def object_visibility(self): s = time.time() x_itrs = np.array([self.trans_matrix[self.i] @ self.x_true[self.i, j, :3] for j in range(self.m)]) el = np.array([ecef2aer(self.obs_lla, x, self.obs_itrs)[1] for x in x_itrs]) viz = el >= self.obs_limit e = time.time() self.runtime['object_visibility'] += e - s return viz
def hx_aer_erfa(x_gcrs, trans_matrix, observer_lla, observer_itrs, time=None): """ desc: measurement function - convert state into a measurement where measurements are [azimuth, elevation] :param x_gcrs: means for all objects at each time step :param trans_matrix: Transition matrix :param observer_lla: Observer coordinates :param observer_itrs: Observer coordinates in itrs (meters) :param time: :return: array[azimuth, elevation, slant] """ x_itrs = trans_matrix @ x_gcrs[:3] aer = ecef2aer(observer_lla, x_itrs, observer_itrs) return aer
y=xyz1[1] * u.m, z=xyz1[2] * u.m) target = SkyCoord(x=xyz2[0] * u.m, y=xyz2[1] * u.m, z=xyz2[2] * u.m, frame='itrs', representation_type='cartesian', obstime=t) # just for astropy AltAz_frame = AltAz(obstime=t, location=observer) results = target.transform_to(AltAz_frame) az1 = results.az.to_value(u.rad) alt1 = results.alt.to_value(u.rad) sr1 = results.distance.to_value(u.m) aer = ecef2aer(ecef2lla(xyz1), xyz2, xyz1) test3_error = [az1 - aer[0], alt1 - aer[1], sr1 - aer[2]] assert np.absolute(az1 - aer[0]) < 0.001, print( "Failed Test 3a: ECEF (ITRS) to Az transformation") assert np.absolute(alt1 - aer[1]) < 0.001, print( "Failed Test 3b: ECEF (ITRS) to El transformation") assert np.absolute(sr1 - aer[2]) < 0.001, print( "Failed Test 3c: ECEF (ITRS) to to Srange transformation") print("Test 3: ECEF (ITRS) to Az, El, Range error in rads,rads,meters: ", test3_error) # !------------ Test 4 - Time to generate cel2ter transformation t = datetime(year=2007, month=4, day=5, hour=12, minute=0, second=0) t = [t]