예제 #1
0
 def test_tx_prior_week(self) -> None:
     # transmitted at 0.01 second before start of week
     tx_ = pd.DataFrame({
         'week': [1999],
         'day': [6],
         'time': [cn.nanos_in_day - 1 * 10**7]
     })
     tx_gps = tm.gpsweek_to_gps(tx_.week, tx_.day,
                                tx_.time).convert_dtypes()
     input_ = self.input
     input_.loc[:, 'ReceivedSvTimeNanos'] = tm.gpsweek_to_gps(
         0, 0, tx_.day * cn.nanos_in_day + tx_.time)
     output = log.process_raw(input_)
     pt.assert_extension_array_equal(output.tx.array,
                                     tx_gps.array,
                                     check_exact=True)
예제 #2
0
    def setUp(self):
        # received 0.1 second after start of week
        rx_ = pd.DataFrame({'week': [2000], 'day': [0], 'time': [1 * 10**8]})
        # transmitted at 0.01 second after start of week
        tx_ = pd.DataFrame({'week': [2000], 'day': [0], 'time': [1 * 10**7]})

        d = {
            'ConstellationType': [1],
            'Svid': [1],
            'TimeNanos': tm.gpsweek_to_gps(rx_.week, rx_.day, rx_.time),
            'FullBiasNanos': [0],
            'ReceivedSvTimeNanos': tm.gpsweek_to_gps(0, tx_.day, tx_.time),
            'State': [9]
        }
        self.input = pd.DataFrame(d)
        self.tx_gps = tm.gpsweek_to_gps(tx_.week, tx_.day,
                                        tx_.time).convert_dtypes()
        self.rx = rx_
예제 #3
0
 def test_period_start_time(self) -> None:
     import numpy as np
     rx = self.input.TimeNanos[0]
     state = 9
     constellation = 'G'
     expected = tm.gpsweek_to_gps(self.rx.week, pd.Series([0]),
                                  pd.Series([0]))
     pt.assert_series_equal(log.period_start_time(
         pd.Series([rx]), pd.Series([state]), pd.Series([constellation])),
                            expected,
                            check_names=False,
                            check_dtype=False)
예제 #4
0
 def test_rx(self) -> None:
     output = log.process_raw(self.input)
     expected = tm.gpsweek_to_gps(self.rx.week, self.rx.day, self.rx.time)
     pt.assert_extension_array_equal(output.rx.array,
                                     expected.array,
                                     check_exact=True)
예제 #5
0
 def test_gps_gpsweek(self) -> None:
     ns = pd.Series([604800*2000 * 10**9 + 1 * 10 ** 7],index=[2],name='foo').convert_dtypes()
     ts = pd.DataFrame({'week':[2000],'day':[0],'time':[1 * 10 ** 7]},index=[2]).convert_dtypes()
     pt.assert_frame_equal(tm.gps_to_gpsweek(ns),ts,check_exact=True)
     pt.assert_series_equal(tm.gpsweek_to_gps(ts.week,ts.day,ts.time),ns,check_exact=True,check_names=False)
예제 #6
0
 def test_gps_gpsweek(self) -> None:
     ns = pd.Series([604800*2000 * 10**9 + 1 * 10 ** 7,pd.NA],dtype='Int64')
     ts = pd.DataFrame({'week':[2000,pd.NA],'day':[0,pd.NA],'time':[1 * 10 ** 7,pd.NA]},dtype='Int64')
     pt.assert_frame_equal(tm.gps_to_gpsweek(ns).astype('float64'),ts.astype('float64'),check_exact=True)
     pt.assert_extension_array_equal(tm.gpsweek_to_gps(ts.week,ts.day,ts.time).array,ns.array,check_exact=True)