new GPR parameters and some UI fixes

This commit is contained in:
Ayzen
2026-04-07 12:55:26 +03:00
parent 4b78c2808d
commit 202993325d
27 changed files with 1494 additions and 168 deletions
@@ -36,6 +36,8 @@ struct ProcessingLiveConfig {
float gpr_stop_freq_mhz = 6000.0F;
float gpr_speed_m_s = 0.0F;
float gpr_look_angle_deg = 0.0F;
float gpr_snr_thresh = 4.5F;
float gpr_snr_comp_max = 25.0F;
bool gpr_background_subtract_enabled = true;
std::uint32_t gpr_background_mean_count = 10U;
std::uint64_t history_command_seq = 0;
@@ -211,6 +211,18 @@ using Json = nlohmann::json;
}
config.gpr_look_angle_deg = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_snr_thresh"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_snr_thresh must be number");
}
config.gpr_snr_thresh = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_snr_comp_max"); found != root.end()) {
if (!found->is_number()) {
throw std::runtime_error("processing.gpr_snr_comp_max must be number");
}
config.gpr_snr_comp_max = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("gpr_background_subtract_enabled"); found != root.end()) {
if (!found->is_boolean()) {
throw std::runtime_error("processing.gpr_background_subtract_enabled must be bool");
@@ -20,8 +20,6 @@ constexpr double kPi = 3.14159265358979323846;
constexpr double kSpeedOfLightMetersPerSec = 299'792'458.0;
constexpr double kAccumulatorXMarginM = 2.0;
constexpr double kAccumulatorZMinM = 0.20;
constexpr double kSnrThresh = 4.5;
constexpr double kSnrCompMax = 25.0;
constexpr std::size_t kGridWidth = 300U;
constexpr std::size_t kGridHeight = 300U;
constexpr double kGaussianSigma = 3.0;
@@ -1197,6 +1195,8 @@ auto GprProcessor::process_collection(
kSpeedOfLightMetersPerSec / std::sqrt(std::max(1e-6, static_cast<double>(run_config.gpr.relative_permittivity)));
const double start_hz = static_cast<double>(live_config.gpr_start_freq_mhz) * 1'000'000.0;
const double stop_hz = static_cast<double>(live_config.gpr_stop_freq_mhz) * 1'000'000.0;
const double snr_thresh = std::max(0.0, static_cast<double>(live_config.gpr_snr_thresh));
const double snr_comp_max = std::max(0.0, static_cast<double>(live_config.gpr_snr_comp_max));
std::unordered_map<PairKey, AscanResult> ascans_by_pair{};
double bandwidth_hz = 0.0;
@@ -1248,7 +1248,8 @@ auto GprProcessor::process_collection(
4.0,
std::floor(((velocity_mps / (2.0 * bandwidth_hz)) / z_step) * 0.7)
));
const auto peak_indices = find_peak_indices(ascan.amplitude, min_index, max_index, noise * kSnrThresh, min_distance);
const auto peak_indices =
find_peak_indices(ascan.amplitude, min_index, max_index, noise * snr_thresh, min_distance);
auto& peaks = peaks_by_pair[key];
peaks.reserve(peak_indices.size());
for (const auto peak_index : peak_indices) {
@@ -1259,7 +1260,7 @@ auto GprProcessor::process_collection(
attenuation / attenuation_at_depth(tx_index, rx_index, 3.0, selection.x_tx, selection.x_rx);
const double snr_comp = std::min(
snr_raw / (std::pow(attenuation_norm, static_cast<double>(live_config.gpr_comp_power)) + 1e-12),
kSnrCompMax
snr_comp_max
);
peaks.push_back(PeakRecord{
.z_app = z_app,