Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit e9367a2

Browse files
valeri-atamanioukRoman Gezikov
authored andcommitted
iqgen: updated cython bindings for l1ca
Updated cython bindings for GPS L1 C/A message generation.
1 parent 04dee12 commit e9367a2

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

python/swiftnav/bits.pyx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,23 @@
1212
Bit field packing, unpacking and utility functions.
1313
1414
"""
15-
15+
from swiftnav.bits cimport parity as c_parity
1616

1717
def parity(x):
18-
raise NotImplementedError
18+
'''
19+
Cython wrapper for parity function
20+
21+
Parameters
22+
----------
23+
x : int
24+
Value for parity computation
25+
26+
Returns
27+
-------
28+
int
29+
Parity value: 1 or 0.
30+
'''
31+
return c_parity(x)
1932

2033
def getbitu(buff, pos, length):
2134
raise NotImplementedError

python/swiftnav/ephemeris.pyx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ cdef class Ephemeris:
2424

2525
def __init__(self, **kwargs):
2626
memset(&self._thisptr, 0, sizeof(ephemeris_t))
27-
self._thisptr.sid = kwargs.pop('sid')
28-
self._thisptr.toe = kwargs.pop('toe')
29-
self._thisptr.ura = kwargs.pop('ura')
30-
self._thisptr.fit_interval = kwargs.pop('fit_interval')
31-
self._thisptr.valid = kwargs.pop('valid')
32-
self._thisptr.healthy = kwargs.pop('healthy')
27+
28+
if 'sid' in kwargs:
29+
self._thisptr.sid = kwargs.pop('sid')
30+
if 'toe' in kwargs:
31+
self._thisptr.toe = kwargs.pop('toe')
32+
if 'ura' in kwargs:
33+
self._thisptr.ura = kwargs.pop('ura')
34+
if 'fit_interval' in kwargs:
35+
self._thisptr.fit_interval = kwargs.pop('fit_interval')
36+
if 'valid' in kwargs:
37+
self._thisptr.valid = kwargs.pop('valid')
38+
if 'healthy' in kwargs:
39+
self._thisptr.healthy = kwargs.pop('healthy')
3340
if 'kepler' in kwargs:
3441
self._thisptr.kepler = kwargs.pop('kepler')
3542
elif 'xyz' in kwargs:

python/swiftnav/nav_msg.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ cdef extern from "libswiftnav/nav_msg.h":
4444

4545
cdef class NavMsg:
4646
cdef nav_msg_t _thisptr
47+

python/swiftnav/nav_msg.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
# cython: embedsignature=True
1111

12-
from ephemeris cimport ephemeris_t
1312
from fmt_utils import fmt_repr
1413
from time cimport gps_time_t
1514
from signal cimport gnss_signal_t
@@ -42,7 +41,8 @@ cdef class NavMsg:
4241

4342
def process_subframe(self, sid, d):
4443
cdef gps_l1ca_decoded_data_t tmp_d = d._thisptr
45-
return process_subframe(&self._thisptr, sid, &tmp_d)
44+
cdef gnss_signal_t tmp_sid = sid._thisptr
45+
return process_subframe(&self._thisptr, tmp_sid, &tmp_d)
4646

4747
def __richcmp__(self, other, op):
4848
"""

0 commit comments

Comments
 (0)