Wideband autonomous SDR analysis engine forked from sdr-visual-suite
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

49 行
1.5KB

  1. package pipeline
  2. import (
  3. "sdr-wideband-suite/internal/classifier"
  4. "sdr-wideband-suite/internal/detector"
  5. )
  6. // Candidate is the coarse output of the surveillance detector.
  7. // It intentionally stays lightweight and cheap to produce.
  8. type Candidate struct {
  9. ID int64 `json:"id"`
  10. CenterHz float64 `json:"center_hz"`
  11. BandwidthHz float64 `json:"bandwidth_hz"`
  12. PeakDb float64 `json:"peak_db"`
  13. SNRDb float64 `json:"snr_db"`
  14. FirstBin int `json:"first_bin"`
  15. LastBin int `json:"last_bin"`
  16. NoiseDb float64 `json:"noise_db,omitempty"`
  17. Source string `json:"source,omitempty"`
  18. Hint string `json:"hint,omitempty"`
  19. }
  20. // Refinement contains higher-cost local analysis derived from a candidate.
  21. type Refinement struct {
  22. Candidate Candidate `json:"candidate"`
  23. Signal detector.Signal `json:"signal"`
  24. SnippetRate int `json:"snippet_rate"`
  25. Class *classifier.Classification `json:"class,omitempty"`
  26. Stage string `json:"stage,omitempty"`
  27. }
  28. func CandidatesFromSignals(signals []detector.Signal, source string) []Candidate {
  29. out := make([]Candidate, 0, len(signals))
  30. for _, s := range signals {
  31. out = append(out, Candidate{
  32. ID: s.ID,
  33. CenterHz: s.CenterHz,
  34. BandwidthHz: s.BWHz,
  35. PeakDb: s.PeakDb,
  36. SNRDb: s.SNRDb,
  37. FirstBin: s.FirstBin,
  38. LastBin: s.LastBin,
  39. NoiseDb: s.NoiseDb,
  40. Source: source,
  41. })
  42. }
  43. return out
  44. }