Skip to content

Commit

Permalink
Add pretty printer for acquisition results (#12)
Browse files Browse the repository at this point in the history
* Add pretty printer for acquisition results

This will show a table of PRNs with CN0, carrier doppler and code phases
instead of raw Julia struct dump

* Fix wrong unit on code phase display

AcquisitionResults.code_phase is in chips not samples

* Code style fix

Co-authored-by: Soeren Schoenbrod <soeren.schoenbrod@outlook.de>

* Add unit to CN0 column

Co-authored-by: Soeren Schoenbrod <soeren.schoenbrod@outlook.de>

* Shorten the table generator

Co-authored-by: Soeren Schoenbrod <soeren.schoenbrod@outlook.de>

---------

Co-authored-by: Soeren Schoenbrod <soeren.schoenbrod@outlook.de>
  • Loading branch information
minecraft2048 and zsoerenm committed Jun 13, 2024
1 parent 94bf3fa commit 4c4ca8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
GNSSSignals = "52c80523-2a4e-5c38-8979-05588f836870"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Expand Down
13 changes: 13 additions & 0 deletions src/Acquisition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using DocStringExtensions,
GNSSSignals, RecipesBase, FFTW, Statistics, LinearAlgebra, LoopVectorization, Unitful

import Unitful: s, Hz
using PrettyTables

export acquire,
plot_acquisition_results,
Expand All @@ -29,6 +30,18 @@ struct AcquisitionResults{S<:AbstractGNSS,T}
}
end

function Base.show(io::IO, ::MIME"text/plain", acq_channels::Vector{Acquisition.AcquisitionResults{T1,T2}}) where {T1,T2}
header = ["PRN"; "CN0 (dBHz)"; "Carrier Doppler (Hz)"; "Code phase (chips)"]
data = reduce(vcat, map(acq -> [acq.prn, acq.CN0, acq.carrier_doppler, acq.code_phase]', acq_channels))
hl_good = Highlighter((data,i,j)->(j==2) && (data[i,j] > 42), crayon"green")
hl_bad = Highlighter((data,i,j)->(j==2) && (data[i,j] < 42), crayon"red")

pretty_table(io,data,header=header,highlighters=(hl_good,hl_bad))
end




include("plan_acquire.jl")
include("downconvert.jl")
include("plot.jl")
Expand Down

0 comments on commit 4c4ca8a

Please sign in to comment.