Skip to content

Conversation

@gofaster
Copy link
Contributor

Occasionally, the "pos" keys' values in the "freqList" and "srcList" stanzas of the call metadata JSON file are presented to many decimal places.
This can occur when the binary representation of a floating point number is serialized. In this case, pos in T-R is a double; which has an approximate precision of 15 decimal places.
This change rounds the pos value to 2 decimal places, similar to what the OpenMHz uploader plugin does.

Example fragment from call metadata JSON:

...
  "freqList": [
    {
      "freq": 852550000,
      "time": 1769708284,
      "pos": 0.0,
      "len": 1.52,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708286,
      "pos": 1.52,
      "len": 9.52,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708298,
      "pos": 11.04,
      "len": 3.28,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708303,
      "pos": 14.320000000000003,
      "len": 2.16,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708307,
      "pos": 16.479999999999997,
      "len": 1.6,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708310,
      "pos": 18.08,
      "len": 10.16,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708321,
      "pos": 28.24,
      "len": 4.84,
      "error_count": 0,
      "spike_count": 0
    },
    {
      "freq": 852550000,
      "time": 1769708327,
      "pos": 33.08,
      "len": 1.4,
      "error_count": 0,
      "spike_count": 0
    }
  ],
  "srcList": [
    {
      "src": 1899003,
      "time": 1769708284,
      "pos": 0.0,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 45410,
      "time": 1769708286,
      "pos": 1.52,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 45410,
      "time": 1769708298,
      "pos": 11.04,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 45410,
      "time": 1769708303,
      "pos": 14.320000000000003,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 1899003,
      "time": 1769708307,
      "pos": 16.479999999999997,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 45410,
      "time": 1769708310,
      "pos": 18.08,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 45236,
      "time": 1769708321,
      "pos": 28.24,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    },
    {
      "src": 1899003,
      "time": 1769708327,
      "pos": 33.08,
      "emergency": 0,
      "signal_system": "",
      "tag": ""
    }
  ]
...

@gofaster gofaster changed the title Round FreqList and srcList 'pos' values to 2 decimal places. Round freqList and srcList 'pos' values to 2 decimal places. Jan 17, 2026
@robotastic
Copy link
Collaborator

Good call

@robotastic robotastic closed this Jan 22, 2026
@robotastic robotastic reopened this Jan 22, 2026
@robotastic robotastic merged commit 5f96ef4 into TrunkRecorder:master Jan 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants