ka9q-python 3.26.2__py3-none-any.whl → 3.27.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ka9q/cli.py +0 -2
- ka9q/compat.py +1 -1
- ka9q/control.py +53 -15
- ka9q/status.py +25 -6
- ka9q/tui.py +0 -2
- ka9q/types.py +11 -3
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/METADATA +6 -1
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/RECORD +12 -12
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/WHEEL +0 -0
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/entry_points.txt +0 -0
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/licenses/LICENSE +0 -0
- {ka9q_python-3.26.2.dist-info → ka9q_python-3.27.0.dist-info}/top_level.txt +0 -0
ka9q/cli.py
CHANGED
|
@@ -54,8 +54,6 @@ def _render_status_text(st: ChannelStatus) -> str:
|
|
|
54
54
|
L.append(f" First LO: {_fmt_hz(st.first_lo)} lock={fe.lock}")
|
|
55
55
|
L.append(f" Second LO: {_fmt_hz(st.second_lo)}")
|
|
56
56
|
L.append(f" Shift: {_fmt_hz(st.shift)}")
|
|
57
|
-
if st.doppler:
|
|
58
|
-
L.append(f" Doppler: {_fmt_hz(st.doppler)} @ {st.doppler_rate} Hz/s")
|
|
59
57
|
L.append(f" Filter: {_fmt_hz(st.low_edge)} .. {_fmt_hz(st.high_edge)} (β={st.kaiser_beta})")
|
|
60
58
|
L.append(f" FE filter: {_fmt_hz(fe.fe_low_edge)} .. {_fmt_hz(fe.fe_high_edge)}")
|
|
61
59
|
L.append("")
|
ka9q/compat.py
CHANGED
ka9q/control.py
CHANGED
|
@@ -23,7 +23,9 @@ PARAMETERS:
|
|
|
23
23
|
import socket
|
|
24
24
|
import select
|
|
25
25
|
import struct
|
|
26
|
+
import math
|
|
26
27
|
import secrets
|
|
28
|
+
import warnings
|
|
27
29
|
import logging
|
|
28
30
|
import threading
|
|
29
31
|
import hashlib
|
|
@@ -2624,32 +2626,68 @@ class RadiodControl:
|
|
|
2624
2626
|
logger.info("Metrics reset")
|
|
2625
2627
|
|
|
2626
2628
|
def set_doppler(self, ssrc: int, doppler_hz: float = 0.0, doppler_rate_hz_per_sec: float = 0.0):
|
|
2629
|
+
"""Retired: radiod dropped DOPPLER_FREQUENCY/_RATE in ka9q 64938af7.
|
|
2630
|
+
|
|
2631
|
+
Use :meth:`set_sweep`. Sends nothing.
|
|
2627
2632
|
"""
|
|
2628
|
-
|
|
2629
|
-
|
|
2633
|
+
warnings.warn("set_doppler is retired; radiod dropped DOPPLER (ka9q 64938af7); use set_sweep",
|
|
2634
|
+
DeprecationWarning, stacklevel=2)
|
|
2635
|
+
raise RuntimeError("radiod dropped DOPPLER (ka9q 64938af7); use set_sweep")
|
|
2636
|
+
|
|
2637
|
+
def set_sweep(self, ssrc: int, rate_hz_per_s: float, period_s: float,
|
|
2638
|
+
duration_s: Optional[float] = None, start_s: float = 0.0) -> None:
|
|
2639
|
+
"""
|
|
2640
|
+
Command a linear sweep (dechirp) on a linear-demod channel.
|
|
2641
|
+
|
|
2642
|
+
Sends all four sweep TLVs, zeros explicit, so a command always
|
|
2643
|
+
replaces the whole sweep. radiod checks the merged settings after
|
|
2644
|
+
each command and refuses (logs, leaves the channel unswept) a rate
|
|
2645
|
+
without a period, duration > period, or an NCO-limit violation.
|
|
2646
|
+
|
|
2630
2647
|
Args:
|
|
2631
2648
|
ssrc: SSRC of the channel
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2649
|
+
rate_hz_per_s: sweep rate, Hz/s, signed (positive = up); 0 = no sweep
|
|
2650
|
+
period_s: sweep period in seconds (required for a nonzero rate)
|
|
2651
|
+
duration_s: seconds of each period that sweep (default: whole period)
|
|
2652
|
+
start_s: offset added to the sweep time base, seconds (default 0)
|
|
2653
|
+
|
|
2654
|
+
Raises:
|
|
2655
|
+
ValidationError: non-finite value; rate != 0 without
|
|
2656
|
+
0 < period <= 1e6 s; duration outside [0, period]
|
|
2657
|
+
|
|
2658
|
+
Note: SWEEP_EPOCH_SAMPLE/FRAC (217/216), which radiod reports, are
|
|
2659
|
+
provisional until Phil assigns final numbers.
|
|
2638
2660
|
"""
|
|
2639
2661
|
_validate_ssrc(ssrc)
|
|
2640
|
-
|
|
2662
|
+
if duration_s is None:
|
|
2663
|
+
duration_s = period_s
|
|
2664
|
+
for nm, v in (("rate", rate_hz_per_s), ("period", period_s),
|
|
2665
|
+
("duration", duration_s), ("start", start_s)):
|
|
2666
|
+
if not isinstance(v, (int, float)) or isinstance(v, bool) or not math.isfinite(v):
|
|
2667
|
+
raise ValidationError(f"Sweep {nm} must be a finite number, got {v!r}")
|
|
2668
|
+
if rate_hz_per_s != 0 and not (0 < period_s <= 1e6):
|
|
2669
|
+
raise ValidationError(
|
|
2670
|
+
f"Sweep period must satisfy 0 < period <= 1e6 s with a nonzero rate, got {period_s}")
|
|
2671
|
+
if period_s < 0 or period_s > 1e6:
|
|
2672
|
+
raise ValidationError(f"Sweep period out of range [0, 1e6] s: {period_s}")
|
|
2673
|
+
if not (0 <= duration_s <= period_s):
|
|
2674
|
+
raise ValidationError(
|
|
2675
|
+
f"Sweep duration must satisfy 0 <= duration <= period ({period_s}), got {duration_s}")
|
|
2676
|
+
|
|
2641
2677
|
cmdbuffer = bytearray()
|
|
2642
2678
|
cmdbuffer.append(CMD)
|
|
2643
|
-
|
|
2644
|
-
encode_double(cmdbuffer, StatusType.
|
|
2645
|
-
encode_double(cmdbuffer, StatusType.
|
|
2679
|
+
encode_double(cmdbuffer, StatusType.SWEEP_RATE, float(rate_hz_per_s))
|
|
2680
|
+
encode_double(cmdbuffer, StatusType.SWEEP_DURATION, float(duration_s))
|
|
2681
|
+
encode_double(cmdbuffer, StatusType.SWEEP_PERIOD, float(period_s))
|
|
2682
|
+
encode_double(cmdbuffer, StatusType.SWEEP_START, float(start_s))
|
|
2646
2683
|
encode_int(cmdbuffer, StatusType.OUTPUT_SSRC, ssrc)
|
|
2647
2684
|
encode_int(cmdbuffer, StatusType.COMMAND_TAG, secrets.randbits(31))
|
|
2648
2685
|
encode_eol(cmdbuffer)
|
|
2649
|
-
|
|
2650
|
-
logger.info(f"Setting
|
|
2686
|
+
|
|
2687
|
+
logger.info(f"Setting sweep for SSRC {ssrc}: rate={rate_hz_per_s} Hz/s, "
|
|
2688
|
+
f"period={period_s} s, duration={duration_s} s, start={start_s} s")
|
|
2651
2689
|
self.send_command(cmdbuffer)
|
|
2652
|
-
|
|
2690
|
+
|
|
2653
2691
|
def set_pll(self, ssrc: int, enable: bool, bandwidth_hz: Optional[float] = None, square: bool = False):
|
|
2654
2692
|
"""
|
|
2655
2693
|
Configure PLL (Phase-Locked Loop) for carrier tracking in linear modes
|
ka9q/status.py
CHANGED
|
@@ -209,8 +209,16 @@ class ChannelStatus:
|
|
|
209
209
|
first_lo: Optional[float] = None # FIRST_LO_FREQUENCY (also in frontend)
|
|
210
210
|
second_lo: Optional[float] = None # SECOND_LO_FREQUENCY
|
|
211
211
|
shift: Optional[float] = None # SHIFT_FREQUENCY
|
|
212
|
-
doppler: Optional[float] = None #
|
|
213
|
-
doppler_rate: Optional[float] = None #
|
|
212
|
+
doppler: Optional[float] = None # always None: radiod dropped DOPPLER (ka9q 64938af7)
|
|
213
|
+
doppler_rate: Optional[float] = None # always None: tags 37/38 are UNUSED6/7 upstream
|
|
214
|
+
|
|
215
|
+
# Sweep (dechirp); radiod reports all four on every linear channel
|
|
216
|
+
sweep_rate: Optional[float] = None # SWEEP_RATE (Hz/s, signed)
|
|
217
|
+
sweep_duration: Optional[float] = None # SWEEP_DURATION (s)
|
|
218
|
+
sweep_period: Optional[float] = None # SWEEP_PERIOD (s)
|
|
219
|
+
sweep_start: Optional[float] = None # SWEEP_START (s)
|
|
220
|
+
sweep_epoch_sample: Optional[int] = None # SWEEP_EPOCH_SAMPLE (signed int64)
|
|
221
|
+
sweep_epoch_frac: Optional[float] = None # SWEEP_EPOCH_FRAC (fraction of a sample)
|
|
214
222
|
|
|
215
223
|
# Filter (primary)
|
|
216
224
|
low_edge: Optional[float] = None # LOW_EDGE (Hz)
|
|
@@ -499,10 +507,21 @@ def decode_status_packet(buffer: bytes) -> Optional[ChannelStatus]:
|
|
|
499
507
|
st.frequency = decode_double(data, optlen)
|
|
500
508
|
elif t == StatusType.SHIFT_FREQUENCY:
|
|
501
509
|
st.shift = decode_double(data, optlen)
|
|
502
|
-
elif t == StatusType.
|
|
503
|
-
st.
|
|
504
|
-
elif t == StatusType.
|
|
505
|
-
st.
|
|
510
|
+
elif t == StatusType.SWEEP_RATE:
|
|
511
|
+
st.sweep_rate = decode_double(data, optlen)
|
|
512
|
+
elif t == StatusType.SWEEP_DURATION:
|
|
513
|
+
st.sweep_duration = decode_double(data, optlen)
|
|
514
|
+
elif t == StatusType.SWEEP_PERIOD:
|
|
515
|
+
st.sweep_period = decode_double(data, optlen)
|
|
516
|
+
elif t == StatusType.SWEEP_START:
|
|
517
|
+
st.sweep_start = decode_double(data, optlen)
|
|
518
|
+
elif t == StatusType.SWEEP_EPOCH_SAMPLE:
|
|
519
|
+
# Signed: negative early in uptime. A negative int64 always
|
|
520
|
+
# arrives as all 8 bytes (no leading zeros to strip).
|
|
521
|
+
v = decode_int64(data, optlen)
|
|
522
|
+
st.sweep_epoch_sample = v - (1 << 64) if v >= (1 << 63) else v
|
|
523
|
+
elif t == StatusType.SWEEP_EPOCH_FRAC:
|
|
524
|
+
st.sweep_epoch_frac = decode_double(data, optlen)
|
|
506
525
|
|
|
507
526
|
# ---- Demod class / preset ----
|
|
508
527
|
elif t == StatusType.DEMOD_TYPE:
|
ka9q/tui.py
CHANGED
|
@@ -127,8 +127,6 @@ class TuningPanel(Panel):
|
|
|
127
127
|
f"Filter: {_fmt_hz(st.low_edge)} .. {_fmt_hz(st.high_edge)}",
|
|
128
128
|
f"FE filter: {_fmt_hz(fe.fe_low_edge)} .. {_fmt_hz(fe.fe_high_edge)}",
|
|
129
129
|
]
|
|
130
|
-
if st.doppler:
|
|
131
|
-
lines.append(f"Doppler: {_fmt_hz(st.doppler)} @ {st.doppler_rate} Hz/s")
|
|
132
130
|
return "\n".join(lines)
|
|
133
131
|
|
|
134
132
|
|
ka9q/types.py
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
ka9q-radio protocol types and constants
|
|
3
3
|
|
|
4
4
|
Auto-generated by scripts/sync_types.py from ka9q-radio C headers.
|
|
5
|
-
Validated against ka9q-radio commit:
|
|
5
|
+
Validated against ka9q-radio commit: aa52698cd1a8
|
|
6
6
|
|
|
7
7
|
DO NOT EDIT MANUALLY — run: python scripts/sync_types.py --apply
|
|
8
|
+
Entries marked 'pending upstream' come from PENDING_UPSTREAM_STATUS_TABLE
|
|
9
|
+
in that script; --apply re-emits them.
|
|
8
10
|
"""
|
|
9
11
|
|
|
10
12
|
|
|
@@ -48,8 +50,8 @@ class StatusType:
|
|
|
48
50
|
FIRST_LO_FREQUENCY = 34
|
|
49
51
|
SECOND_LO_FREQUENCY = 35
|
|
50
52
|
SHIFT_FREQUENCY = 36
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
UNUSED6 = 37
|
|
54
|
+
UNUSED7 = 38
|
|
53
55
|
LOW_EDGE = 39
|
|
54
56
|
HIGH_EDGE = 40
|
|
55
57
|
KAISER_BETA = 41
|
|
@@ -129,6 +131,12 @@ class StatusType:
|
|
|
129
131
|
SPECTRUM_STEP = 115 # size of byte spectrum data level step, dB
|
|
130
132
|
SPECTRUM_OVERLAP = 116 # Overlap of FFT windows when averaging (0-1)
|
|
131
133
|
LIFETIME = 117 # frames until channel goes away
|
|
134
|
+
SWEEP_RATE = 118
|
|
135
|
+
SWEEP_DURATION = 119
|
|
136
|
+
SWEEP_PERIOD = 120
|
|
137
|
+
SWEEP_START = 121
|
|
138
|
+
SWEEP_EPOCH_FRAC = 216 # fraction of an input sample after SWEEP_EPOCH_SAMPLE (double); pending upstream; Phil assigns final numbers
|
|
139
|
+
SWEEP_EPOCH_SAMPLE = 217 # input-counter index of a recent sweep start (SIGNED int64); pending upstream; Phil assigns final numbers
|
|
132
140
|
|
|
133
141
|
|
|
134
142
|
# Command packet type
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ka9q-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.27.0
|
|
4
4
|
Summary: Python interface for ka9q-radio control and monitoring
|
|
5
5
|
Author-email: Michael Hauan AC0G <ac0g@hauan.org>
|
|
6
6
|
License: MIT
|
|
@@ -284,6 +284,11 @@ The `--apply` mode updates three files atomically:
|
|
|
284
284
|
2. `ka9q_radio_compat` — updated with the new commit hash
|
|
285
285
|
3. `ka9q/compat.py` — updated with the new commit hash (importable)
|
|
286
286
|
|
|
287
|
+
Tags HamSCI defines ahead of upstream (the sweep TLVs) live in
|
|
288
|
+
`PENDING_UPSTREAM_STATUS_TABLE` in `scripts/sync_types.py`; `--apply` re-emits
|
|
289
|
+
them into `types.py`, so it stays idempotent. `--check` fails if upstream
|
|
290
|
+
reuses one of their numbers and warns when upstream gains the name.
|
|
291
|
+
|
|
287
292
|
### For Deployment Tooling
|
|
288
293
|
|
|
289
294
|
`ka9q-update` (or any deployment tool) can read the pinned commit to ensure the correct `radiod` version is running:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ka9q/__init__.py,sha256=P2glBiqPlHhJO7YN8TAMMg9SBtBcwtql_AF5MZxOBE0,5483
|
|
2
2
|
ka9q/_multicast.py,sha256=U6pCiH1ruy3i5yv7B_rRhkakokwnetu1Nd3009nAI5w,3343
|
|
3
3
|
ka9q/addressing.py,sha256=GaHLeTwRpsmJawRAROoj-AqALcVkqO6Jq4_th9u7fjE,2681
|
|
4
|
-
ka9q/cli.py,sha256=
|
|
5
|
-
ka9q/compat.py,sha256=
|
|
6
|
-
ka9q/control.py,sha256=
|
|
4
|
+
ka9q/cli.py,sha256=iWnSTb4sf98GXMamsBu5_CLTXErtrKq8PsF9MKrbGNM,14938
|
|
5
|
+
ka9q/compat.py,sha256=YaeDfj5eVmebtfcv0HcX9fO_Y-nlLRJW-yYJvM46oL8,436
|
|
6
|
+
ka9q/control.py,sha256=Lp-1mWkUqKW68SEX7ezYvk9C2aDNAyE_IeSLKMXQf7M,160296
|
|
7
7
|
ka9q/discovery.py,sha256=-jGcDczuwEQmmJRogc2hR22PUKT2qxWkPgy_ffd9Cdk,28615
|
|
8
8
|
ka9q/exceptions.py,sha256=_P8rok_tTmRMu-lLRhS95kv8FRK5PEY80_6jIux2mWM,474
|
|
9
9
|
ka9q/managed_stream.py,sha256=gHvGcQgJF5FCOzVp7V6vcIp75NLGnOHgClGR24i9_No,18842
|
|
@@ -15,16 +15,16 @@ ka9q/resequencer.py,sha256=m_OWattFpqIugSqWr6aadsmUeoJIPkfINKfPi6gp_sg,17300
|
|
|
15
15
|
ka9q/rtp_recorder.py,sha256=-YpG9mleoGjEd5voPSxnGcdVsFvyxSgOJ8f7ZaXGcT0,23210
|
|
16
16
|
ka9q/slot_clock.py,sha256=9OuE1qMHJ5YBHfNPtQSguj_KHgkU9iAXfhOLEk-1B78,13468
|
|
17
17
|
ka9q/spectrum_stream.py,sha256=utMhpH8hkkwOSD1WpKb4r0YHm3isDF0TvYMq-jJJFwY,11458
|
|
18
|
-
ka9q/status.py,sha256=
|
|
18
|
+
ka9q/status.py,sha256=zXZzo6Bfl0IUm-bMHap_-2bC95Lmak9CLgiGzu_8ljQ,29602
|
|
19
19
|
ka9q/status_listener.py,sha256=20l9aHii263myYlO8mmSgI_tUcchUwLwgh69Dx-1UQY,20045
|
|
20
20
|
ka9q/stream.py,sha256=TvEcQorlRWZ9_MoyN0apXlrZaLtlheU7V2RP0yR-hIk,33197
|
|
21
21
|
ka9q/stream_quality.py,sha256=YrKa07PzDi4xeF5tubwpDvSTs5eHu0G7mOa12iIINrs,8222
|
|
22
|
-
ka9q/tui.py,sha256=
|
|
23
|
-
ka9q/types.py,sha256=
|
|
22
|
+
ka9q/tui.py,sha256=yUvRRY7EWef4rokyrv6tCjVuDlYah4CtP4A4BE7d_Hw,27072
|
|
23
|
+
ka9q/types.py,sha256=LaxZVvO_beFmgw2-U5on91cr7C08dVM_esLlOmzRLZE,7968
|
|
24
24
|
ka9q/utils.py,sha256=fFR_sYIpeDyPaFlXzN6jCiGhYlssvrMMVx4z6vyhqcc,7107
|
|
25
|
-
ka9q_python-3.
|
|
26
|
-
ka9q_python-3.
|
|
27
|
-
ka9q_python-3.
|
|
28
|
-
ka9q_python-3.
|
|
29
|
-
ka9q_python-3.
|
|
30
|
-
ka9q_python-3.
|
|
25
|
+
ka9q_python-3.27.0.dist-info/licenses/LICENSE,sha256=mjz-l5TVsO9j7Jqt1gfLvTWtZK_HL9sZRRpsHaq4Qv8,1074
|
|
26
|
+
ka9q_python-3.27.0.dist-info/METADATA,sha256=X0kuMDDjeoOk-usbglJJGHYTped600g5IVn8pnwA8Jc,14922
|
|
27
|
+
ka9q_python-3.27.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
28
|
+
ka9q_python-3.27.0.dist-info/entry_points.txt,sha256=Wt5Q4OMUKHaf4KdsZXWsjSBpbHVuTtt3pypVIHi7eRk,39
|
|
29
|
+
ka9q_python-3.27.0.dist-info/top_level.txt,sha256=FUTLZDtQpJGenGPPlN34E5QpQi_oaiLB6LuzgHblBNE,5
|
|
30
|
+
ka9q_python-3.27.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|