Exemplo n.º 1
0
    def test_vector_conversions(self):
        def same_seq(seq1, seq2):
            self.assertEqual(len(seq1), len(seq2))
            for i in range(len(seq1)):
                self.assertEqual(seq1[i], seq2[i])

        list = [1.1, 2.2, 3.3]
        v = gpstk.seqToVector(list)
        self.assertIsInstance(v, gpstk.vector_double)
        same_seq(list, v)

        list = [1.1, 2.2, 3.3]
        v = gpstk.seqToVector(list, outtype='vector_double')
        self.assertIsInstance(v, gpstk.vector_double)
        same_seq(list, v)

        list = ['bar!', 'foo?']
        v = gpstk.seqToVector(list)
        self.assertIsInstance(v, gpstk.vector_string)
        same_seq(list, v)

        v = gpstk.vector_int()
        v.push_back(3)
        v.push_back(5)
        list = gpstk.vectorToSeq(v)
        same_seq(list, v)

        list = [1.1, 2.2, 3.3]
        self.assertRaises(TypeError, gpstk.seqToVector, list, 'vector_doesnotexist')

        list = [1, 2.2, 'c']  # mismatching types not allowed
        self.assertRaises(TypeError, gpstk.seqToVector, list)
Exemplo n.º 2
0
    def test_vector_conversions(self):
        def same_seq(seq1, seq2):
            self.assertEqual(len(seq1), len(seq2))
            for i in range(len(seq1)):
                self.assertEqual(seq1[i], seq2[i])

        list = [1.1, 2.2, 3.3]
        v = gpstk.seqToVector(list)
        self.assertIsInstance(v, gpstk.vector_double)
        same_seq(list, v)

        list = [1.1, 2.2, 3.3]
        v = gpstk.seqToVector(list, outtype='vector_double')
        self.assertIsInstance(v, gpstk.vector_double)
        same_seq(list, v)

        list = ['bar!', 'foo?']
        v = gpstk.seqToVector(list)
        self.assertIsInstance(v, gpstk.vector_string)
        same_seq(list, v)

        v = gpstk.vector_int()
        v.push_back(3)
        v.push_back(5)
        list = gpstk.vectorToSeq(v)
        same_seq(list, v)

        list = [1.1, 2.2, 3.3]
        self.assertRaises(TypeError, gpstk.seqToVector, list, 'vector_doesnotexist')

        list = [1, 2.2, 'c']  # mismatching types not allowed
        self.assertRaises(TypeError, gpstk.seqToVector, list)

        list = [1000L, 2000L]  # PyLongs are not templated
        self.assertRaises(TypeError, gpstk.seqToVector, list)
Exemplo n.º 3
0
def compute_raim_position(gps_week, gps_sow, prns, prns_pos, pranges,  bcestore):
    if len(prns)==0 or len(prns_pos)==0:
       return np.array([0,0,0])
    t = gpstk.GPSWeekSecond(gps_week, gps_sow).toCommonTime()
    prnList = [gpstk.SatID(int(i[3:])) for i in prns]
    satVector = gpstk.seqToVector(list(prnList), outtype='vector_SatID')
    rangeVector = gpstk.seqToVector([float(i) for i in pranges])
    noTropModel = gpstk.ZeroTropModel()
    raimSolver = gpstk.PRSolution2()
    raimSolver.RAIMCompute(t, satVector, rangeVector, bcestore, noTropModel)   
    r = np.array([raimSolver.Solution[0], raimSolver.Solution[1], raimSolver.Solution[2]])
    return r
Exemplo n.º 4
0
def compute_raim_position(gps_week, gps_sow, prns, prns_pos, pranges,
                          bcestore):
    if len(prns) == 0 or len(prns_pos) == 0:
        return np.array([0, 0, 0])
    t = gpstk.GPSWeekSecond(gps_week, gps_sow).toCommonTime()
    prnList = [gpstk.SatID(int(i[3:])) for i in prns]
    satVector = gpstk.seqToVector(list(prnList), outtype='vector_SatID')
    rangeVector = gpstk.seqToVector([float(i) for i in pranges])
    noTropModel = gpstk.ZeroTropModel()
    raimSolver = gpstk.PRSolution2()
    raimSolver.RAIMCompute(t, satVector, rangeVector, bcestore, noTropModel)
    r = np.array([
        raimSolver.Solution[0], raimSolver.Solution[1], raimSolver.Solution[2]
    ])
    return r
Exemplo n.º 5
0
        # more dispersion.
        raimSolver.RMSLimit = 3e6


        # In order to compute positions we need the current time, the
        # vector of visible satellites, the vector of corresponding
        # ranges, the object containing satellite ephemerides, and a
        # pointer to the tropospheric model to be applied

        time = obsObj.time

        # the RAIMComputer method of PRSolution2 accepts a vector<SatID> as its
        # 2nd argument, but the list is of RinexSatID, which is a subclass of SatID.
        # Since C++ containers are NOT covariant, it is neccessary to change the
        # output to a vector or SatID's rather thta a vector of RinexSatID's.
        satVector = gpstk.seqToVector(prnList, outtype='vector_SatID')
        rangeVector = gpstk.seqToVector(rangeList)
        raimSolver.RAIMCompute(time, satVector, rangeVector, ephStore, tropModel)

        # Note: Given that the default constructor sets public
        # attribute "Algebraic" to FALSE, a linearized least squares
        # algorithm will be used to get the solutions.
        # Also, the default constructor sets ResidualCriterion to true,
        # so the rejection criterion is based on RMS residual of fit,
        # instead of RMS distance from an a priori position.


        if raimSolver.isValid():
            # Vector "Solution" holds the coordinates, expressed in
            # meters in an Earth Centered, Earth Fixed (ECEF) reference
            # frame. The order is x, y, z  (as all ECEF objects)