Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pretty printer for acquisition results #12

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 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,25 @@ 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"; "Carrier doppler (Hz)"; "Code phase (chips)"]
minecraft2048 marked this conversation as resolved.
Show resolved Hide resolved
data = Matrix{Any}(undef, length(acq_channels),length(header))

for (idx,acq) in enumerate(acq_channels)
data[idx,1] = acq.prn
data[idx,2] = acq.CN0
data[idx,3] = acq.carrier_doppler
data[idx,4] = acq.code_phase
end
minecraft2048 marked this conversation as resolved.
Show resolved Hide resolved
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")
minecraft2048 marked this conversation as resolved.
Show resolved Hide resolved

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




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