diff --git a/cmd/sdrd/pipeline_runtime.go b/cmd/sdrd/pipeline_runtime.go index f38a0d3..6843594 100644 --- a/cmd/sdrd/pipeline_runtime.go +++ b/cmd/sdrd/pipeline_runtime.go @@ -219,7 +219,16 @@ func (rt *dspRuntime) buildSurveillanceResult(art *spectrumArtifacts) pipeline.S policy := pipeline.PolicyFromConfig(rt.cfg) candidates := pipeline.CandidatesFromSignals(art.detected, "surveillance-detector") scheduled := pipeline.ScheduleCandidates(candidates, policy) + level := pipeline.AnalysisLevel{ + Name: "surveillance", + SampleRate: rt.cfg.SampleRate, + FFTSize: rt.cfg.Surveillance.AnalysisFFTSize, + CenterHz: rt.cfg.CenterHz, + SpanHz: float64(rt.cfg.SampleRate), + Source: "baseband", + } return pipeline.SurveillanceResult{ + Level: level, Candidates: candidates, Scheduled: scheduled, Finished: art.finished, @@ -262,7 +271,16 @@ func (rt *dspRuntime) buildRefinementInput(surv pipeline.SurveillanceResult) pip Source: windowSource, }) } + level := pipeline.AnalysisLevel{ + Name: "refinement", + SampleRate: rt.cfg.SampleRate, + FFTSize: rt.cfg.FFTSize, + CenterHz: rt.cfg.CenterHz, + SpanHz: float64(rt.cfg.SampleRate), + Source: "refinement-window", + } input := pipeline.RefinementInput{ + Level: level, Candidates: append([]pipeline.Candidate(nil), surv.Candidates...), Scheduled: scheduled, Plan: plan, diff --git a/internal/pipeline/phases.go b/internal/pipeline/phases.go index 138cd95..fb7148f 100644 --- a/internal/pipeline/phases.go +++ b/internal/pipeline/phases.go @@ -2,7 +2,17 @@ package pipeline import "sdr-wideband-suite/internal/detector" +type AnalysisLevel struct { + Name string `json:"name"` + SampleRate int `json:"sample_rate"` + FFTSize int `json:"fft_size"` + CenterHz float64 `json:"center_hz"` + SpanHz float64 `json:"span_hz"` + Source string `json:"source,omitempty"` +} + type SurveillanceResult struct { + Level AnalysisLevel `json:"level"` Candidates []Candidate `json:"candidates"` Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` Finished []detector.Event `json:"finished"` @@ -21,6 +31,7 @@ type RefinementPlan struct { } type RefinementInput struct { + Level AnalysisLevel `json:"level"` Candidates []Candidate `json:"candidates,omitempty"` Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` Plan RefinementPlan `json:"plan,omitempty"` diff --git a/internal/pipeline/phases_test.go b/internal/pipeline/phases_test.go index 2c45c45..49987df 100644 --- a/internal/pipeline/phases_test.go +++ b/internal/pipeline/phases_test.go @@ -29,6 +29,7 @@ func TestSurveillanceResultCarriesScheduledCandidates(t *testing.T) { func TestRefinementInputCarriesScheduledCandidates(t *testing.T) { res := RefinementInput{ + Level: AnalysisLevel{Name: "refinement"}, Candidates: []Candidate{{ID: 2}}, Scheduled: []ScheduledCandidate{{Candidate: Candidate{ID: 2}, Priority: 4}}, Plan: RefinementPlan{