Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Wrapper for the C/N0 estimator.

  • Loading branch information...
commit c60bc4ee9d41c30b4774373d29362e10fc90c810 1 parent 60d3528
Fergus Noble authored
Showing with 52 additions and 0 deletions.
  1. +43 −0 swiftnav/track.pyx
  2. +9 −0 swiftnav/track_c.pxd
43 swiftnav/track.pyx
View
@@ -394,3 +394,46 @@ cdef class CompTrackingLoop:
def __get__(self):
return self.s.carr_freq
+
+cdef class CN0Estimator:
+ """
+ Wraps the `libswiftnav` :math:`C / N_0` estimator implementation.
+
+ The estimator state, :libswiftnav:`cn0_est_state_t` is maintained by
+ the class instance.
+
+ Parameters
+ ----------
+ bw : float
+ The loop noise bandwidth in Hz.
+ cn0_0 : float
+ The initial value of :math:`C / N_0` in dBHz.
+ cutoff_freq : float
+ The low-pass filter cutoff frequency, :math:`f_c`, in Hz.
+ loop_freq : float
+ The loop update frequency, :math:`f`, in Hz.
+
+ """
+
+ cdef track_c.cn0_est_state_t s
+
+ def __cinit__(self, bw, cn0_0, cutoff_freq, loop_freq):
+ track_c.cn0_est_init(&self.s, bw, cn0_0, cutoff_freq, loop_freq)
+
+ def update(self, I):
+ """
+ Wraps the function :libswiftnav:`cn0_est`.
+
+ Parameters
+ ----------
+ I : float
+ The prompt in-phase correlation from the tracking correlators.
+
+ Returns
+ -------
+ out : float
+ The Carrier-to-Noise Density, :math:`C / N_0`, in dBHz.
+
+ """
+ return track_c.cn0_est(&self.s, I)
+
9 swiftnav/track_c.pxd
View
@@ -39,6 +39,9 @@ cdef extern from "libswiftnav/track.h":
double code_freq
double carr_freq
+ ctypedef struct cn0_est_state_t:
+ pass
+
ctypedef struct correlation_t:
double I
double Q
@@ -69,3 +72,9 @@ cdef extern from "libswiftnav/track.h":
double tau, u32 sched)
void comp_tl_update(comp_tl_state_t *s, correlation_t cs[3])
+ void cn0_est_init(cn0_est_state_t* s, double bw, double cn0_0,
+ double cutoff_freq, double loop_freq)
+ double cn0_est(cn0_est_state_t* s, double I)
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.