@@ -550,7 +550,7 @@ def compute_dops(prns, ephem, r, t, disp=False):
550550 "gdop" :gdop }
551551
552552def postprocess_short_samples (signal , prior_trajectory , t_prior , settings ,
553- plot = True , return_dops = False ):
553+ plot = True , return_metadata = False ):
554554 """
555555 Postprocess a short baseband sample record into a navigation solution.
556556
@@ -569,14 +569,19 @@ def postprocess_short_samples(signal, prior_trajectory, t_prior, settings,
569569 e.g. from peregrine.initSettings.initSettings()
570570 plot : bool
571571 Make pretty graphs.
572+ return_metadata : bool
573+ Return dict of metadata from the solver
572574
573575 Returns
574576 -------
575577 acq_results : [:class:`AcquisitionResult`]
576578 List of :class:`AcquisitionResult` objects loaded from the file.
577-
579+ sol_metadata
580+ Dict of metadata from the solver (optional)
578581 """
579582
583+ metadata = {}
584+
580585 if hasattr (prior_trajectory , '__call__' ):
581586 prior_traj_func = True
582587 prior_traj = prior_trajectory
@@ -633,6 +638,8 @@ def postprocess_short_samples(signal, prior_trajectory, t_prior, settings,
633638 cPickle .dump ((acqed_prns , obs_cp , obs_dopp ), f ,
634639 protocol = cPickle .HIGHEST_PROTOCOL )
635640
641+ metadata ['acqed_prns' ] = len (acqed_prns )
642+
636643 # Check whether we have enough satellites
637644 if len (acqed_prns ) < 5 :
638645 logger .error (("Acquired %d SVs; need at least 5 for a solution" +
@@ -688,15 +695,17 @@ def postprocess_short_samples(signal, prior_trajectory, t_prior, settings,
688695 v_sol , rx_freq_err = vel_solve (r_sol , t_sol , ephem , obs_dopp , los , tot )
689696 print "Velocity: %s (%.1f m/s)" % (v_sol , norm (v_sol ))
690697
698+ metadata ['rx_freq_err' ] = rx_freq_err
699+
691700 # Compute DOPs
692- dops = compute_dops (acqed_prns , ephem , r_sol , t_sol , disp = True )
701+ metadata [ " dops" ] = compute_dops (acqed_prns , ephem , r_sol , t_sol , disp = True )
693702
694703 # How accurate is the time component of the solution?
695704 if plot :
696705 plot_t_recv_sensitivity (r_sol , t_sol , obs_pr , ephem ,
697706 spread = 0.1 , step = 0.01 )
698707
699- if return_dops :
700- return r_sol , v_sol , t_sol , dops
708+ if return_metadata :
709+ return r_sol , v_sol , t_sol , metadata
701710 else :
702711 return r_sol , v_sol , t_sol
0 commit comments