Compare commits
1 Commits
b27a5cf00e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af7c05f2da |
146
data/processed/lab067/candidate_analysis.csv
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
candidate_number,position,nearest_packet,difference_samples,category,strict_reason
|
||||||
|
1,4902630,1,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
2,4900598,1,-2032,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
3,4904662,1,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
4,4898566,1,-4064,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
5,4896534,1,-6096,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
6,4906694,1,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
7,4894502,1,-8128,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
8,4908726,1,6096,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
9,4910758,1,8128,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
10,4902630,1,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
11,4900598,1,-2032,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
12,4904662,1,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
13,4898566,1,-4064,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
14,4906694,1,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
15,4902630,1,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
16,4900598,1,-2032,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
17,4904662,1,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
18,4968617,1,65987,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
19,4958408,1,55778,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
20,4982295,2,-52591,UNRELATED,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
21,5034886,2,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
22,5032854,2,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
23,5036918,2,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
24,5030822,2,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
25,5028790,2,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
26,5038949,2,4063,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
27,5026758,2,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
28,5040981,2,6095,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
29,5043013,2,8127,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
30,5034886,2,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
31,5032854,2,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
32,5034886,2,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
33,5036918,2,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
34,5032854,2,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
35,5036918,2,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
36,5030822,2,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
37,5167142,3,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
38,5165110,3,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
39,5169174,3,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
40,5163078,3,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
41,5161046,3,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
42,5171206,3,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
43,5159014,3,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
44,5173238,3,6096,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
45,5175270,3,8128,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
46,5167142,3,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
47,5169174,3,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
48,5165110,3,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
49,5171206,3,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
50,5163078,3,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
51,5167142,3,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
52,5169174,3,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
53,5165110,3,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
54,5198234,3,31092,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
55,5196202,3,29060,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
56,5194172,3,27030,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
57,5228601,3,61459,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
58,5230634,3,63492,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
59,5232665,3,65523,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
60,5220198,3,53056,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
61,5299398,4,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
62,5431654,5,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
63,5563910,6,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
64,5696166,7,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
65,5828422,8,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
66,5960678,9,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
67,5958646,9,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
68,5962710,9,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
69,5956614,9,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
70,5954582,9,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
71,5952550,9,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
72,5960678,9,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
73,5958646,9,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
74,5962710,9,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
75,5956614,9,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
76,5960678,9,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_CHECKSUM_MISMATCH
|
||||||
|
77,5958646,9,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
78,5962710,9,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
79,5964742,9,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
80,5966774,9,6096,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
81,5968806,9,8128,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
82,5964742,9,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
83,6017761,9,57083,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
84,6015727,9,55049,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
85,6092934,10,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
86,6225190,11,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
87,6355414,12,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
88,6353382,12,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
89,6351350,12,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
90,6349317,12,-8129,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
91,6355414,12,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
92,6353382,12,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
93,6351350,12,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
94,6355414,12,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
95,6357446,12,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
96,6487670,13,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
97,6485638,13,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
98,6483606,13,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
99,6481574,13,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
100,6487670,13,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
101,6485638,13,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
102,6483606,13,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
103,6487670,13,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
104,6485638,13,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
105,6489702,13,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
106,6617894,14,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
107,6615862,14,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
108,6613830,14,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
109,6617894,14,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
110,6621958,14,0,TRUE_PREAMBLE_POSITION,CRC_PASS
|
||||||
|
111,6750150,15,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
112,6748118,15,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
113,6746086,15,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
114,6750150,15,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
115,6748118,15,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
116,6750150,15,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
117,6754214,15,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
118,6752182,15,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
119,6756246,15,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
120,6758278,15,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
121,6760309,15,6095,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
122,6762341,15,8127,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
123,6754214,15,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
124,6752182,15,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
125,6756246,15,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
126,6758278,15,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
127,6754214,15,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
128,6752182,15,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
129,6756246,15,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
130,6880374,16,-6096,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
131,6878342,16,-8128,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
132,6886470,16,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_VERSION_MISMATCH
|
||||||
|
133,6884438,16,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
134,6888502,16,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
135,6882406,16,-4064,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
136,6890534,16,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
137,6892566,16,6096,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
138,6894597,16,8127,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
139,6888502,16,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
140,6886470,16,0,TRUE_PREAMBLE_POSITION,PHY_HEADER_VERSION_MISMATCH
|
||||||
|
141,6892566,16,6096,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
142,6890534,16,4064,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
143,6884438,16,-2032,ZERO_GAP,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
144,6888502,16,2032,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
145,6902724,16,16254,REPEATED_PRBS_LOCAL_MAXIMUM,PHY_HEADER_MAGIC_MISMATCH
|
||||||
|
BIN
data/processed/lab067/candidate_checks_by_packet.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
data/processed/lab067/gap_background_by_packet.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
2305
data/processed/lab067/header_bit_errors.csv
Normal file
BIN
data/processed/lab067/header_error_position_map.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
data/processed/lab067/header_errors_by_packet.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
17
data/processed/lab067/header_packet_comparison.csv
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
packet,strict_result,candidate_position,expected_packet_position,candidate_difference_samples,preamble_errors,preamble_error_rate,preamble_correlation,header_raw_errors,header_voted_errors,header_copy_1_errors,header_copy_2_errors,header_copy_3_errors,magic_errors,version_errors,length_errors,checksum_errors,expected_header_bits,received_raw_header_bits,voted_header_bits,header_accepted,header_reason,legacy_header_bits,t2_header_bits,legacy_initial_frequency_hz,t2_initial_frequency_hz,reference_frequency_hz,legacy_frequency_error_vs_reference_hz,initial_phase_error_rad,timing_offset_samples,fractional_timing_offset,reference_timing_offset_samples,reference_fractional_timing_offset,local_matched_power,local_residual_power,local_matched_residual_db,rms_symbol_deviation,legacy_t2_header_differences,classification
|
||||||
|
1,HEADER_FAIL,4902630,4902630,0,15,0.01171875,0.8981139142983712,3,1,1,2,0,0,0,1,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000101000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000110000000000000111000000000,110100111001000100000001000000010000110100001000,False,CHECKSUM_MISMATCH,111111000101000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000110000000000000111000000000,111111000101000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000110000000000000111000000000,-2.662272181646709,-5.3879680108224575,-2.6542601970280364,-0.008011984618672585,1.8341164291785854,0,0.0,0,0.0,8.982336070665001,2.7583799759789063,5.127352085281537,0.5541564541425134,0,HEADER_SPECIFIC_FAILURE
|
||||||
|
2,HEADER_FAIL,5034886,5034886,0,10,0.0078125,0.892574719565451,6,1,3,2,1,0,0,1,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000100000111000000000000000000000111000000000000000000000001000001110000111111000000000000000000111000000000,110100111001000100000001000000010010110000001000,False,CHECKSUM_MISMATCH,111111000111000000111111111000000111000100000111000000000000000000000111000000000000000000000001000001110000111111000000000000000000111000000000,111111000111000000111111111000000111000100000111000000000000000000000111000000000000000000000011000001110000111111000000000000000000111000000000,-11.085402212024045,-5.423727145761877,2.664169158774504,-13.749571370798549,1.8865220093820032,0,0.0,0,0.0,8.566883580374462,3.867819679092585,3.4535664637802532,0.6719263565992358,1,HEADER_SPECIFIC_FAILURE
|
||||||
|
3,HEADER_FAIL,5167142,5167142,0,11,0.00859375,0.8832445602414427,3,1,1,1,1,1,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111110001000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100110001000100000001000000010000110000001000,False,MAGIC_MISMATCH,111111000111000000111110001000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111110001000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,-2.14390103272374,2.717358680061899,4.3756668288999,-6.51956786162364,1.837976468233186,0,0.0,0,0.0,8.391114739306301,2.917171371178907,4.5885771684300085,0.589618554298201,0,HEADER_SPECIFIC_FAILURE
|
||||||
|
4,PASS,5299398,5299398,0,12,0.009375,0.8702559090330103,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,-4.969843852460903,0.5011874511379912,3.928841196279306,-8.898685048740209,1.823004794704275,0,0.0,0,0.0,8.221366239802954,2.9179318124892393,4.498688563977461,0.5957520861601466,0,PASSED
|
||||||
|
5,PASS,5431654,5431654,0,15,0.01171875,0.882298526549992,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,3.163024030078619,-1.2710648335872299,1.1365290837564324,2.026494946322187,1.8355890323417587,0,0.0,0,0.0,8.188755217773341,1.2708156134102264,8.091353471792932,0.39394203715952975,0,PASSED
|
||||||
|
6,PASS,5563910,5563910,0,17,0.01328125,0.8834263035683648,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,5.595453900367469,1.2623874159193273,-4.567512776067651,10.162966676435119,1.7721238280090583,0,0.0,0,0.0,8.667865149110309,1.6073728447094802,7.317955191422993,0.43062797582960244,0,PASSED
|
||||||
|
7,PASS,5696166,5696166,0,7,0.00546875,0.8957036694801145,1,0,0,0,1,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000001,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000001,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,-1.2654548420073324,-1.236432022604831,-6.203901481459032,4.9384466394516995,1.8155098517430892,0,0.0,0,0.0,8.65014337171221,2.0185187625245264,6.319905151171046,0.4830640770103008,1,PASSED
|
||||||
|
8,PASS,5828422,5828422,0,10,0.0078125,0.8935154947988603,3,0,1,2,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111001000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000010000111000000000,110100111001000100000001000000010000110000001000,True,,111001000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000010000111000000000,111001000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000010000111000000000,9.131379183391202,-0.4710188398180419,4.02876530540373,5.102613877987472,1.6973544391851634,0,0.0,0,0.0,8.476859162285322,2.688967210304384,4.986494612866651,0.5632163702340075,0,PASSED
|
||||||
|
9,HEADER_FAIL,5960678,5960678,0,13,0.01015625,0.8831012072365596,4,1,1,2,1,0,0,1,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000011010000000000000000000111000000000000000000000111011000000000111111000000000000000000111000000000,110100111001000100000001000000011000110000001000,False,CHECKSUM_MISMATCH,111111000111000000111111111000000111000000000011010000000000000000000111000000000000000000000111011000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000011010000000000000000000111000000000000000000000111011000000000111111000000000000000000111000000000,6.363378164483905,-1.9815016298670118,8.696281322717777,-2.332903158233872,1.7240388753166553,0,0.0,0,0.0,8.379835253157635,3.513421286396085,3.7750525233897125,0.6475113327264761,0,HEADER_SPECIFIC_FAILURE
|
||||||
|
10,PASS,6092934,6092934,0,14,0.0109375,0.8756981622368548,1,0,0,0,1,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111110111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111110111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111110111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,10.521050631968299,4.784422094967777,8.894608707236657,1.6264419247316422,1.6172834220436263,0,0.0,0,0.0,7.7745725932128815,2.478953865410118,4.964080786327893,0.5646716196549459,0,PASSED
|
||||||
|
11,PASS,6225190,6225190,0,14,0.0109375,0.8739448578846127,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,-4.3377788034794795,5.576222280700207,6.2889992427567645,-10.626778046236243,1.8042319285279784,0,0.0,0,0.0,8.281301835417366,2.613504672826743,5.008753330856255,0.5617749030480063,0,PASSED
|
||||||
|
12,PASS,6357446,6357446,0,15,0.01171875,0.8691086828109845,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,-14.662329907046818,-12.429475985972452,-7.481009787452366,-7.181320119594452,1.9299825595605988,0,0.0,0,0.0,8.105161843192903,1.785984725783043,6.568839508606049,0.4694161471804715,0,PASSED
|
||||||
|
13,PASS,6489702,6489702,0,19,0.01484375,0.8870876180609537,0,0,0,0,0,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,2.005711398433546,-3.8713317585287843,-9.48236864846436,11.488080046897906,1.7755837460769197,0,0.0,0,0.0,8.379598937532618,1.5074086416620165,7.44992232360151,0.42413477685697976,0,PASSED
|
||||||
|
14,PASS,6621958,6621958,0,13,0.01015625,0.8979602974476922,1,0,0,0,1,0,0,0,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000110000000000000111111000000000000000000111000000000,110100111001000100000001000000010000110000001000,True,,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000110000000000000111111000000000000000000111000000000,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,7.210729633183354,3.326192426336044,-3.8425458753995345,11.053275508582889,1.6778789052916618,0,0.0,0,0.0,8.575750726813316,2.4203963781579967,5.493856544116208,0.5312600671059894,1,PASSED
|
||||||
|
15,HEADER_FAIL,6754214,6754214,0,12,0.009375,0.8887378180983065,7,2,2,2,3,1,0,1,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,111111000111000011111111111000000111000000000111000000000000000000000111001000110000000000000111000000000000111111000000000000000000111001100000,110101111001000100000001001000010000110000001000,False,MAGIC_MISMATCH,111111000111000011111111111000000111000000000111000000000000000000000111001000110000000000000111000000000000111111000000000000000000111001100000,111111000111000011111111111000000111000000000111000000000000000000000111001000110000000000000111000000000000111111000000000000000000111001100000,-5.7315977256001345,-3.5200403113930196,0.10139388237069231,-5.832991607970826,1.7811965898235738,0,0.0,0,0.0,7.968245167205011,3.1321489434833123,4.055202820682332,0.6269600363881329,0,HEADER_SPECIFIC_FAILURE
|
||||||
|
16,HEADER_FAIL,6886470,6886470,0,16,0.0125,0.8805097957519517,5,2,1,2,2,0,1,1,0,111111000111000000111111111000000111000000000111000000000000000000000111000000000000000000000111000000000000111111000000000000000000111000000000,101111000111000000111111111000000111000000000111000000000011000000000111000000000000001100000111000000000000111111000000000000000000111000000000,110100111001000100010001000001010000110000001000,False,VERSION_MISMATCH,101111000111000000111111111000000111000000000111000000000011000000000111000000000000001100000111000000000000111111000000000000000000111000000000,000111000000111111100000000101011110110001101000011101111000001111000110111101111011100000111001010010111111000000111111111111111011000111111111,4.7344866536019055,228.10491338016192,10.381403191597384,-5.646916537995478,1.6829380426891485,0,0.0,0,0.0,8.084601213892752,3.04749463363358,4.237156529516785,0.613962963260252,107,HEADER_SPECIFIC_FAILURE
|
||||||
|
BIN
data/processed/lab067/local_signal_quality_by_packet.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
data/processed/lab067/preamble_errors_by_packet.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
data/processed/lab067/preamble_header_transition.png
Normal file
|
After Width: | Height: | Size: 838 KiB |
1724
data/processed/lab067/summary.json
Normal file
BIN
data/processed/lab067/timing_and_cfo_by_packet.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
49
data/processed/lab067/transition_metrics.csv
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
packet,region,symbols,decision_errors,magnitude_median,magnitude_minimum,phase_error_rms_rad,imaginary_rms,timing_offset_samples
|
||||||
|
1,preamble_tail,128,0,1.0988442307313235,0.43466351049701235,0.36545432588063453,0.3677449037710503,0
|
||||||
|
1,header,144,3,1.0815752733984212,0.5778378379912865,0.6187439503436525,0.551502400297575,0
|
||||||
|
1,postheader,128,2,1.1114278978759744,0.4714742841146855,0.5693534448896019,0.49591231338100494,0
|
||||||
|
2,preamble_tail,128,0,1.074345037947809,0.5715381413183729,0.5169701760998907,0.4918784327994302,0
|
||||||
|
2,header,144,6,1.0888449278310801,0.4753465266196904,0.7542889272180515,0.6186207192551644,0
|
||||||
|
2,postheader,128,0,1.1317475637994039,0.6993167478293558,0.28345944315453764,0.2904885233790264,0
|
||||||
|
3,preamble_tail,128,0,1.0919580830559625,0.4931835747157359,0.577421183092019,0.5161252295458062,0
|
||||||
|
3,header,144,4,1.152609811941216,0.6541218073505881,0.5437712455230955,0.433109513511742,0
|
||||||
|
3,postheader,128,0,1.0857706086674181,0.3396593308737327,0.2976136824815135,0.3003548051915534,0
|
||||||
|
4,preamble_tail,128,0,1.1087294828126495,0.5024192881228802,0.6792582574914069,0.6647511818530001,0
|
||||||
|
4,header,144,0,1.1507766975854852,0.42562892480326897,0.3156584316410723,0.33839321792646554,0
|
||||||
|
4,postheader,128,0,1.1449814637127051,0.5937437256113064,0.29460252451816493,0.31949283720140587,0
|
||||||
|
5,preamble_tail,128,0,1.1434636342884739,0.6047967729049536,0.35172140313369066,0.3535407042323131,0
|
||||||
|
5,header,144,0,1.1363877434085625,0.6007022877000862,0.2522418948656545,0.27555358339271957,0
|
||||||
|
5,postheader,128,5,1.0966485328526976,0.41749527315450785,0.6464901825183261,0.5318845761533794,0
|
||||||
|
6,preamble_tail,128,0,1.1318097006554524,0.6221411610236426,0.2794053247219388,0.30212984078304644,0
|
||||||
|
6,header,144,0,1.118944116022563,0.604506255970942,0.4000248179092374,0.40617877592291496,0
|
||||||
|
6,postheader,128,3,1.1203373379450718,0.5733983281027794,0.6433269203677763,0.5585770337413266,0
|
||||||
|
7,preamble_tail,128,0,1.098335506453933,0.685298350349321,0.31267846128306165,0.3400209740040822,0
|
||||||
|
7,header,144,1,1.0859515485682385,0.4918795883455653,0.49770271058274784,0.48404835853198735,0
|
||||||
|
7,postheader,128,3,1.078419996569039,0.44698965664144213,0.5990105590866479,0.5112821191437632,0
|
||||||
|
8,preamble_tail,128,0,1.0950824513758386,0.5415446078858628,0.37054349208551474,0.38513707581929985,0
|
||||||
|
8,header,144,3,1.0904644019616199,0.43076194377790394,0.6094384014423195,0.5588536614362375,0
|
||||||
|
8,postheader,128,2,1.0935087479377619,0.63642176553416,0.4463244127331142,0.43911459515487505,0
|
||||||
|
9,preamble_tail,128,2,1.093901338967227,0.4388973792742324,0.5923392165896195,0.5322335060592657,0
|
||||||
|
9,header,144,4,1.1195324105485278,0.49998913621143454,0.611185029044535,0.5659527404173302,0
|
||||||
|
9,postheader,128,0,1.1053805607840526,0.640256963735712,0.28052596266122526,0.30630431218636367,0
|
||||||
|
10,preamble_tail,128,3,1.1419841905626784,0.5060536577715014,0.5971065417005673,0.5330612346503504,0
|
||||||
|
10,header,144,1,1.1147443336597755,0.6501217642416475,0.39358947394490806,0.40010760065192014,0
|
||||||
|
10,postheader,128,0,1.1787629415552199,0.42900718390148934,0.2926514547716184,0.3306690896219249,0
|
||||||
|
11,preamble_tail,128,3,1.1704570892176922,0.6573740193329803,0.6151666707460389,0.6107317885152251,0
|
||||||
|
11,header,144,0,1.12981219997058,0.5282686497447672,0.324658042677611,0.3384614869201178,0
|
||||||
|
11,postheader,128,0,1.1070044356208588,0.5046571226194821,0.33630657442006734,0.36220237044356646,0
|
||||||
|
12,preamble_tail,128,4,1.1293212243971127,0.5975355368621857,0.5056848722345468,0.41499438743931705,0
|
||||||
|
12,header,144,0,1.1346606346022847,0.37281496808234904,0.2862848068844218,0.3172306512537894,0
|
||||||
|
12,postheader,128,1,1.1452864327334882,0.4013942634977783,0.4893751135204076,0.4862028130220328,0
|
||||||
|
13,preamble_tail,128,0,1.1020405947443312,0.5476951608093663,0.26825405646139866,0.299908757841907,0
|
||||||
|
13,header,144,0,1.1246852022329477,0.5448659176501547,0.3819108989758959,0.3972670513029744,0
|
||||||
|
13,postheader,128,2,1.0925865889420296,0.5942311935828164,0.5526657411269684,0.47037502313805846,0
|
||||||
|
14,preamble_tail,128,0,1.0986885517578937,0.4240058786452209,0.307170345418273,0.30833136259021016,0
|
||||||
|
14,header,144,1,1.1117645619461933,0.5698477702591676,0.5701021956757241,0.5678681526072823,0
|
||||||
|
14,postheader,128,3,1.106509873733971,0.5370530426198264,0.594466571272217,0.5534673376824929,0
|
||||||
|
15,preamble_tail,128,1,1.0605799496659238,0.5096523999436898,0.4395937997414911,0.41506255958111626,0
|
||||||
|
15,header,144,7,1.0998344881084918,0.562650314086593,0.6887166853647746,0.5814901000470972,0
|
||||||
|
15,postheader,128,2,1.1227074410764701,0.5161407533490777,0.5946319825247028,0.5701686238399535,0
|
||||||
|
16,preamble_tail,128,2,1.1150803467611397,0.5398340206811254,0.5646446219736847,0.48272300998033535,0
|
||||||
|
16,header,144,5,1.1024025293008193,0.41214915514462663,0.6355591984079474,0.49483023185734204,0
|
||||||
|
16,postheader,128,0,1.1777412846771014,0.3344663773895672,0.3015102248779219,0.3386110581722476,0
|
||||||
|
38730
data/processed/lab067/transition_symbols.json
Normal file
49
docs/lab067_current_state.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# Lab067: текущее состояние
|
||||||
|
|
||||||
|
Дата: 15 сентября 2026 года.
|
||||||
|
|
||||||
|
## Граница работы
|
||||||
|
|
||||||
|
Lab067 выполнена полностью офлайн по сохранённой аппаратно валидной записи
|
||||||
|
Lab066. HackRF Plus не опрашивался, аппаратные команды не запускались, RF TX
|
||||||
|
оставался равным 0. Алгоритмы приёмника, PHY-заголовок, пороги, FEC, CRC и
|
||||||
|
критерии принятия пакета не менялись.
|
||||||
|
|
||||||
|
Исторический строгий результат Lab066 сохранён:
|
||||||
|
|
||||||
|
- legacy: 10/16 точных пакетов;
|
||||||
|
- T2: 10/16 точных пакетов;
|
||||||
|
- приняты пакеты 4–8 и 10–14;
|
||||||
|
- пакеты 1–3, 9, 15 и 16 остановились на PHY-заголовке.
|
||||||
|
|
||||||
|
## Проверенные исходники
|
||||||
|
|
||||||
|
- TX: 7 352 192 байта, 3 676 096 комплексных отсчётов, SHA-256
|
||||||
|
`621b0bb8ec72bba4f522c79a5c77669c850740ea481270c4dcc2a7317819f199`;
|
||||||
|
- RX: 32 000 000 байт, 16 000 000 комплексных отсчётов, 2,0 с при
|
||||||
|
8 Мвыб/с, SHA-256
|
||||||
|
`72ff7ddd8b30baa4a5c066361ca1f8dfa664f1da37f65c0c373b211ce6cf00f0`;
|
||||||
|
- на расчётной позиции каждого из 16 пакетов найден строгий кандидат с
|
||||||
|
нулевым смещением уточнённой позиции.
|
||||||
|
|
||||||
|
## Текущий вывод
|
||||||
|
|
||||||
|
Все шесть отказов локализованы в PHY-заголовке: преамбулы этих пакетов лежат
|
||||||
|
внутри диапазона принятых пакетов, но в коротком окне от последних 128 символов
|
||||||
|
преамбулы до конца заголовка растёт остаток. Медиана `matched/residual` снижается
|
||||||
|
с 5,906881 dB у принятых пакетов до 4,146180 dB у отказавших.
|
||||||
|
|
||||||
|
28 сырых ошибок заголовка занимают разные позиции; ни одна позиция не
|
||||||
|
повторяется между отказавшими пакетами. TX-заголовки всех 16 пакетов идентичны,
|
||||||
|
корректны и дают текущий программный круговой тест 16/16 в legacy и T2.
|
||||||
|
Систематическая ошибка обработки заголовка не найдена.
|
||||||
|
|
||||||
|
`HEADER_FAILURE_ROOT_CAUSE = LOCAL_RF_QUALITY`
|
||||||
|
|
||||||
|
`ONE SMALL FIX JUSTIFIED = NO`
|
||||||
|
|
||||||
|
Рекомендация: закрыть текущую диагностическую ветку на достигнутом результате
|
||||||
|
10/16 и перейти к ветке управления и телеметрии CRSF/ELRS. QPSK с меньшей
|
||||||
|
символьной скоростью можно рассматривать позднее для видеоканала.
|
||||||
|
|
||||||
|
Lab067 не коммитировалась. Push не выполнялся.
|
||||||
151
docs/lab067_offline_result.md
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
# Lab067: офлайн-анализ отказов PHY-заголовка Lab066
|
||||||
|
|
||||||
|
## Результат
|
||||||
|
|
||||||
|
Причина шести отказов совместима с кратковременным ростом несогласованного
|
||||||
|
остатка именно в области заголовка. Данных за небольшую ошибку логики приёмника,
|
||||||
|
временной привязки, сопровождения несущей или состояния кандидатов нет.
|
||||||
|
|
||||||
|
`HEADER_FAILURE_ROOT_CAUSE = LOCAL_RF_QUALITY`
|
||||||
|
|
||||||
|
`ONE SMALL FIX JUSTIFIED = NO`
|
||||||
|
|
||||||
|
`BRANCH DECISION = NO_SMALL_FIX_JUSTIFIED`
|
||||||
|
|
||||||
|
Исторический результат Lab066 остаётся 10/16 для legacy и 10/16 для T2.
|
||||||
|
Oracle-расчёты ниже диагностические и не меняют строгий результат.
|
||||||
|
|
||||||
|
## Целостность и геометрия данных
|
||||||
|
|
||||||
|
SHA-256 TX и RX совпали с зафиксированными значениями Lab066. RX имеет
|
||||||
|
16 000 000 комплексных отсчётов, 32 000 000 байт и длительность 2,0 с при
|
||||||
|
8 Мвыб/с. Все 16 ожидаемых позиций подтверждены строгими кандидатами;
|
||||||
|
уточнённое смещение для каждого пакета равно 0 отсчётов.
|
||||||
|
|
||||||
|
## Сводная таблица
|
||||||
|
|
||||||
|
`P err` означает ошибки 1280-символьной преамбулы. `H raw` означает ошибки
|
||||||
|
среди 144 переданных символов заголовка. `H vote` означает ошибки после штатной
|
||||||
|
мягкой суммы трёх повторений. Локальная метрика рассчитана по фиксированному
|
||||||
|
окну: последние 128 символов преамбулы и весь заголовок.
|
||||||
|
|
||||||
|
| Пакет | Строгий результат | P err | P corr | H raw | Копии 1/2/3 | H vote | Поля с ошибкой | CFO legacy, Hz | CFO T2/P3, Hz | Timing, отсч. | Локальный M/R, dB | RMS | Legacy/T2 diff | Классификация |
|
||||||
|
|---:|---|---:|---:|---:|---:|---:|---|---:|---:|---:|---:|---:|---:|---|
|
||||||
|
| 1 | HEADER FAIL | 15 | 0,898114 | 3 | 1/2/0 | 1 | length | -2,662 | -5,388 | 0 | 5,127352 | 0,554156 | 0 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
| 2 | HEADER FAIL | 10 | 0,892575 | 6 | 3/2/1 | 1 | length | -11,085 | -5,424 | 0 | 3,453566 | 0,671926 | 1 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
| 3 | HEADER FAIL | 11 | 0,883245 | 3 | 1/1/1 | 1 | magic | -2,144 | 2,717 | 0 | 4,588577 | 0,589619 | 0 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
| 4 | PASS | 12 | 0,870256 | 0 | 0/0/0 | 0 | none | -4,970 | 0,501 | 0 | 4,498689 | 0,595752 | 0 | PASSED |
|
||||||
|
| 5 | PASS | 15 | 0,882299 | 0 | 0/0/0 | 0 | none | 3,163 | -1,271 | 0 | 8,091353 | 0,393942 | 0 | PASSED |
|
||||||
|
| 6 | PASS | 17 | 0,883426 | 0 | 0/0/0 | 0 | none | 5,595 | 1,262 | 0 | 7,317955 | 0,430628 | 0 | PASSED |
|
||||||
|
| 7 | PASS | 7 | 0,895704 | 1 | 0/0/1 | 0 | none | -1,265 | -1,236 | 0 | 6,319905 | 0,483064 | 1 | PASSED |
|
||||||
|
| 8 | PASS | 10 | 0,893515 | 3 | 1/2/0 | 0 | none | 9,131 | -0,471 | 0 | 4,986495 | 0,563216 | 0 | PASSED |
|
||||||
|
| 9 | HEADER FAIL | 13 | 0,883101 | 4 | 1/2/1 | 1 | length | 6,363 | -1,982 | 0 | 3,775053 | 0,647511 | 0 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
| 10 | PASS | 14 | 0,875698 | 1 | 0/0/1 | 0 | none | 10,521 | 4,784 | 0 | 4,964081 | 0,564672 | 0 | PASSED |
|
||||||
|
| 11 | PASS | 14 | 0,873945 | 0 | 0/0/0 | 0 | none | -4,338 | 5,576 | 0 | 5,008753 | 0,561775 | 0 | PASSED |
|
||||||
|
| 12 | PASS | 15 | 0,869109 | 0 | 0/0/0 | 0 | none | -14,662 | -12,429 | 0 | 6,568840 | 0,469416 | 0 | PASSED |
|
||||||
|
| 13 | PASS | 19 | 0,887088 | 0 | 0/0/0 | 0 | none | 2,006 | -3,871 | 0 | 7,449922 | 0,424135 | 0 | PASSED |
|
||||||
|
| 14 | PASS | 13 | 0,897960 | 1 | 0/0/1 | 0 | none | 7,211 | 3,326 | 0 | 5,493857 | 0,531260 | 1 | PASSED |
|
||||||
|
| 15 | HEADER FAIL | 12 | 0,888738 | 7 | 2/2/3 | 2 | magic, length | -5,732 | -3,520 | 0 | 4,055203 | 0,626960 | 0 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
| 16 | HEADER FAIL | 16 | 0,880510 | 5 | 1/2/2 | 2 | version, length | 4,734 | 228,105 | 0 | 4,237157 | 0,613963 | 107 | HEADER_SPECIFIC_FAILURE |
|
||||||
|
|
||||||
|
Полные строки битов `EXPECTED HEADER BITS`, `RECEIVED RAW HEADER BITS`,
|
||||||
|
`VOTED HEADER BITS`, причины строгого отказа и позиции ошибок находятся в
|
||||||
|
`summary.json` и `header_packet_comparison.csv`.
|
||||||
|
|
||||||
|
## Преамбула: распределения
|
||||||
|
|
||||||
|
| Метрика | Passed min / median / max | Failed min / median / max |
|
||||||
|
|---|---:|---:|
|
||||||
|
| Ошибки, бит | 7 / 14 / 19 | 10 / 12,5 / 16 |
|
||||||
|
| Доля ошибок | 0,005469 / 0,010938 / 0,014844 | 0,007813 / 0,009766 / 0,012500 |
|
||||||
|
| Корреляция | 0,869109 / 0,882862 / 0,897960 | 0,880510 / 0,885991 / 0,898114 |
|
||||||
|
| RMS отклонение | 0,489327 / 0,532530 / 0,567221 | 0,489090 / 0,523373 / 0,538197 |
|
||||||
|
| Matched power | 7,774573 / 8,330450 / 8,667865 | 7,968245 / 8,385475 / 8,982336 |
|
||||||
|
| Residual power | 2,053382 / 2,346123 / 2,645143 | 2,118219 / 2,258980 / 2,379173 |
|
||||||
|
| Matched/residual, dB | 4,924949 / 5,473142 / 6,208025 | 5,381167 / 5,624735 / 6,212224 |
|
||||||
|
|
||||||
|
Преамбула не отделяет отказавшие пакеты от принятых: медианные физические
|
||||||
|
показатели failed-группы не хуже. Ухудшение появляется после последних
|
||||||
|
128 символов преамбулы и внутри заголовка. В этом окне медиана residual power
|
||||||
|
равна 3,089822 у failed и 2,219458 у passed; медиана `matched/residual` равна
|
||||||
|
4,146180 и 5,906881 dB соответственно.
|
||||||
|
|
||||||
|
## Карта ошибок заголовка
|
||||||
|
|
||||||
|
У отказавших пакетов найдено 28 сырых ошибочных решений. Ни одна позиция
|
||||||
|
не повторяется в двух failed-пакетах. Ошибки встречаются во всех трёх копиях:
|
||||||
|
9, 11 и 8 ошибок соответственно. После мягкой суммы остаётся 1 ошибка у
|
||||||
|
пакетов 1, 2, 3 и 9 и 2 ошибки у пакетов 15 и 16.
|
||||||
|
|
||||||
|
Общей позиции, стабильно плохой копии, концентрации только в начале или только
|
||||||
|
в конце заголовка нет. Это не поддерживает гипотезу о систематической ошибке
|
||||||
|
формата или индексации заголовка.
|
||||||
|
|
||||||
|
## Переход преамбула → заголовок
|
||||||
|
|
||||||
|
На последних 128 символах преамбулы медиана фазовой RMS-ошибки составляет
|
||||||
|
0,361 rad у passed и 0,541 rad у failed. На заголовке значения составляют
|
||||||
|
0,388 и 0,627 rad. У failed-пакетов ошибки заголовка лежат в диапазоне 3–7
|
||||||
|
сырых решений, а в первых 128 символах после заголовка медиана ошибок равна 0.
|
||||||
|
|
||||||
|
Медианная амплитуда остаётся близкой к единице. Общего скачка амплитуды,
|
||||||
|
смещения точки выборки или одинакового фазового скачка не найдено. Наблюдается
|
||||||
|
короткое ухудшение фазового остатка, различное по позиции в каждом пакете.
|
||||||
|
|
||||||
|
## Timing, CFO и T2
|
||||||
|
|
||||||
|
Штатное timing-смещение и диагностическое oracle-смещение равны 0 отсчётов для
|
||||||
|
всех 16 пакетов. Расхождение legacy CFO с контрольной оценкой создаёт за весь
|
||||||
|
144-символьный заголовок фазовую ошибку от -0,02488 до +0,02079 rad. Этот
|
||||||
|
масштаб недостаточен для объяснения 1–2 ошибок после мягкого голосования.
|
||||||
|
|
||||||
|
T2 начинает влиять с символа 1280, то есть с начала заголовка. Для пакетов
|
||||||
|
1, 3, 4–6, 8–13 и 15 его жёсткие решения заголовка побитно совпадают с legacy.
|
||||||
|
Различия равны одному биту для пакетов 2, 7 и 14. У пакета 16 оценка P3 стала
|
||||||
|
выбросом 228,105 Hz и изменила 107 решений. Это ухудшение одного пакета не
|
||||||
|
объясняет шесть legacy-отказов и не даёт основания менять T2 в этой ветке.
|
||||||
|
|
||||||
|
## Паузы и положение в сеансе
|
||||||
|
|
||||||
|
Для пакета 1 исследован внешний guard длиной 800 000 отсчётов. Для пакетов
|
||||||
|
2–16 исследованы реальные паузы по 40 000 отсчётов. AC RMS перед пакетами
|
||||||
|
лежит в диапазоне 0,744879–1,302893. Признаков хвоста предыдущей формы по
|
||||||
|
критерию превышения первых 8000 отсчётов над серединой паузы на 3 dB нет.
|
||||||
|
После пакета 16 отдельно проверен конечный guard.
|
||||||
|
|
||||||
|
Группы START и END имеют больше ошибок заголовка, чем MIDDLE 1, однако пакет 9
|
||||||
|
отказывает в середине, пакеты 4, 13 и 14 проходят, а timing, CFO и фон не дают
|
||||||
|
монотонного временного тренда. Расположение пакетов не доказывает
|
||||||
|
`START_END_TRANSIENT`.
|
||||||
|
|
||||||
|
## 145 кандидатов
|
||||||
|
|
||||||
|
Строгий журнал содержит 145 проверок:
|
||||||
|
|
||||||
|
- 27 проверок на точных позициях преамбулы, 16 уникальных позиций и 11
|
||||||
|
повторных проверок той же позиции;
|
||||||
|
- 54 локальных максимума повторяющейся PRBS-структуры внутри формы пакета;
|
||||||
|
- 56 кандидатов в нулевых паузах;
|
||||||
|
- 8 кандидатов вне этих областей.
|
||||||
|
|
||||||
|
Каждый кандидат получает новый `PacketMeasure` и полностью независимый строгий
|
||||||
|
проход. Состояние после отказа не переносится. Граница `accepted_until`
|
||||||
|
изменяется только после CRC PASS. Большое число кандидатов увеличивает объём
|
||||||
|
работы, но не объясняет выборочные ошибки настоящих заголовков.
|
||||||
|
|
||||||
|
## TX и решение по ветке
|
||||||
|
|
||||||
|
Все 16 TX-заголовков побитно идентичны. Magic `0xD391`, версия 1, длина
|
||||||
|
268 байт, checksum и тройное повторение корректны. Текущий программный прогон
|
||||||
|
дал 16/16 точных пакетов и для legacy, и для T2.
|
||||||
|
|
||||||
|
Конкретная небольшая ошибка приёмника, которая объяснила бы значимую часть
|
||||||
|
шести отказов, не найдена. Зафиксирован достигнутый результат: 10/16 точных
|
||||||
|
полных пакетов при 500 ксимв/с и TX VGA 20 dB в аппаратно валидной OTA-записи.
|
||||||
|
Текущую диагностическую ветку следует закрыть. Следующая проектная ветка:
|
||||||
|
CRSF/ELRS для управления и телеметрии.
|
||||||
|
|
||||||
|
QPSK с меньшей скоростью символов остаётся будущим кандидатом для видеоканала.
|
||||||
|
В Lab067 QPSK, новый PHY и изменения BPSK не выполнялись.
|
||||||
|
|
||||||
|
RF TX = 0. Lab067 не коммитировалась. Push не выполнялся.
|
||||||
906
experiments/lab067_header_failure_analysis.py
Normal file
@@ -0,0 +1,906 @@
|
|||||||
|
"""Lab067: офлайн-анализ отказов PHY-заголовка в сохранённой записи Lab066.
|
||||||
|
|
||||||
|
Строгий результат Lab066 загружается без изменений. Известный TX используется
|
||||||
|
только после этого результата для диагностического подсчёта ошибок.
|
||||||
|
Аппаратные команды и передача RF в этой лаборатории отсутствуют.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import csv
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
from pathlib import Path
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
if __package__ in (None, ""):
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
import matplotlib
|
||||||
|
|
||||||
|
matplotlib.use("Agg")
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from experiments import lab053_packet_processing as packet_processing
|
||||||
|
from experiments import lab058_abab_symbol_quality as symbol_quality
|
||||||
|
from experiments import lab066_full_packet_rf_retest as lab066
|
||||||
|
from protocol import bpsk_carrier_tracking as carrier_tracking
|
||||||
|
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
RAW = ROOT / "data/raw/lab066"
|
||||||
|
LAB066 = ROOT / "data/processed/lab066"
|
||||||
|
OUTPUT = ROOT / "data/processed/lab067"
|
||||||
|
TX_PATH = RAW / "tx_stream.cs8"
|
||||||
|
RX_PATH = RAW / "rx_stream.cs8"
|
||||||
|
TX_SHA256 = "621b0bb8ec72bba4f522c79a5c77669c850740ea481270c4dcc2a7317819f199"
|
||||||
|
RX_SHA256 = "72ff7ddd8b30baa4a5c066361ca1f8dfa664f1da37f65c0c373b211ce6cf00f0"
|
||||||
|
RX_BYTES = 32_000_000
|
||||||
|
RX_SAMPLES = 16_000_000
|
||||||
|
SAMPLE_RATE_HZ = 8_000_000
|
||||||
|
SYMBOL_RATE = 500_000
|
||||||
|
SAMPLES_PER_SYMBOL = 16
|
||||||
|
PREAMBLE_SYMBOLS = 1280
|
||||||
|
HEADER_SYMBOLS = 144
|
||||||
|
HEADER_BITS = 48
|
||||||
|
HEADER_REPETITION = 3
|
||||||
|
POSTHEADER_SYMBOLS = 128
|
||||||
|
FAILED_PACKETS = {1, 2, 3, 9, 15, 16}
|
||||||
|
PASSED_PACKETS = set(range(1, 17)) - FAILED_PACKETS
|
||||||
|
|
||||||
|
|
||||||
|
def sha256(path: Path) -> str:
|
||||||
|
digest = hashlib.sha256()
|
||||||
|
with path.open("rb") as stream:
|
||||||
|
for block in iter(lambda: stream.read(1024 * 1024), b""):
|
||||||
|
digest.update(block)
|
||||||
|
return digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def save_json(path: Path, value: Any) -> None:
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_text(
|
||||||
|
json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def bits_text(bits: np.ndarray) -> str:
|
||||||
|
return "".join(str(int(value)) for value in np.asarray(bits).reshape(-1))
|
||||||
|
|
||||||
|
|
||||||
|
def finite(value: float) -> float | None:
|
||||||
|
return float(value) if np.isfinite(value) else None
|
||||||
|
|
||||||
|
|
||||||
|
def source_integrity() -> tuple[dict, dict, dict]:
|
||||||
|
"""Проверить неизменность Lab066 до любой oracle-диагностики."""
|
||||||
|
capture = json.loads((LAB066 / "capture_result.json").read_text(encoding="utf-8"))
|
||||||
|
strict = json.loads((LAB066 / "rf_result.json").read_text(encoding="utf-8"))
|
||||||
|
metadata = json.loads((LAB066 / "preparation.json").read_text(encoding="utf-8"))
|
||||||
|
tx_digest = sha256(TX_PATH)
|
||||||
|
rx_digest = sha256(RX_PATH)
|
||||||
|
integrity = {
|
||||||
|
"tx_path": str(TX_PATH.relative_to(ROOT)),
|
||||||
|
"tx_bytes": TX_PATH.stat().st_size,
|
||||||
|
"tx_samples": TX_PATH.stat().st_size // 2,
|
||||||
|
"tx_sha256": tx_digest,
|
||||||
|
"rx_path": str(RX_PATH.relative_to(ROOT)),
|
||||||
|
"rx_bytes": RX_PATH.stat().st_size,
|
||||||
|
"rx_samples": RX_PATH.stat().st_size // 2,
|
||||||
|
"rx_duration_seconds": (RX_PATH.stat().st_size // 2) / SAMPLE_RATE_HZ,
|
||||||
|
"rx_sha256": rx_digest,
|
||||||
|
"sample_rate_hz": SAMPLE_RATE_HZ,
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
tx_digest != TX_SHA256
|
||||||
|
or rx_digest != RX_SHA256
|
||||||
|
or integrity["rx_bytes"] != RX_BYTES
|
||||||
|
or integrity["rx_samples"] != RX_SAMPLES
|
||||||
|
or metadata.get("tx_sha256") != TX_SHA256
|
||||||
|
or metadata.get("parameters", {}).get("sample_rate_hz") != SAMPLE_RATE_HZ
|
||||||
|
or capture.get("rx_sha256") != RX_SHA256
|
||||||
|
or capture.get("rf_tx_count") != 1
|
||||||
|
or capture.get("automatic_tx_repeats") != 0
|
||||||
|
or capture.get("passed") is not True
|
||||||
|
or strict.get("capture_valid") is not True
|
||||||
|
):
|
||||||
|
raise RuntimeError("Исходники или аппаратная валидность Lab066 не подтверждены")
|
||||||
|
for mode in ("run_a_legacy", "run_b_t2"):
|
||||||
|
result = strict[mode]
|
||||||
|
if (
|
||||||
|
result.get("header_pass") != 10
|
||||||
|
or result.get("packet_output") != 10
|
||||||
|
or result.get("exact_payload_match") != 10
|
||||||
|
or result.get("packet_indexes") != sorted(PASSED_PACKETS)
|
||||||
|
):
|
||||||
|
raise RuntimeError("Исторический строгий результат Lab066 изменился")
|
||||||
|
return integrity, metadata, strict
|
||||||
|
|
||||||
|
|
||||||
|
def extract_symbols(
|
||||||
|
received: symbol_quality.Cs8File,
|
||||||
|
frame_start: int,
|
||||||
|
symbol_count: int,
|
||||||
|
mode: str,
|
||||||
|
) -> dict:
|
||||||
|
"""Повторить штатные timing/carrier операции для известного окна пакета."""
|
||||||
|
processor = packet_processing.PacketProcessor(carrier_tracking_mode=mode)
|
||||||
|
length = (symbol_count + 42) * SAMPLES_PER_SYMBOL
|
||||||
|
segment = received.read(frame_start, length).astype(np.complex64)
|
||||||
|
matched = processor.filter(processor.shift(segment))
|
||||||
|
nominal = 16 * SAMPLES_PER_SYMBOL + processor.taps.size - 1
|
||||||
|
timing = int(processor.timing(matched, nominal, processor.expected))
|
||||||
|
initial = processor.carrier(
|
||||||
|
matched, nominal, timing, processor.bits, len(processor.bits)
|
||||||
|
)
|
||||||
|
symbols = matched[
|
||||||
|
nominal + timing:
|
||||||
|
nominal + timing + symbol_count * SAMPLES_PER_SYMBOL:
|
||||||
|
SAMPLES_PER_SYMBOL
|
||||||
|
].astype(np.complex128)
|
||||||
|
if symbols.size != symbol_count or initial["abs_h"] == 0:
|
||||||
|
raise RuntimeError("Не удалось извлечь диагностическое окно символов")
|
||||||
|
times = (np.arange(symbol_count, dtype=np.float64) + 0.5) / SYMBOL_RATE
|
||||||
|
if mode == "legacy":
|
||||||
|
corrected = symbols * np.exp(-2j * np.pi * initial["cfo_hz"] * times)
|
||||||
|
gain = initial["abs_h"] * np.exp(1j * initial["phase_rad"])
|
||||||
|
corrected /= gain
|
||||||
|
phase_trace = (
|
||||||
|
initial["phase_rad"] + 2 * np.pi * initial["cfo_hz"] * times
|
||||||
|
)
|
||||||
|
frequency_trace = np.full(symbol_count, initial["cfo_hz"], dtype=float)
|
||||||
|
detector_error = np.angle(corrected * np.where(corrected.real >= 0, 1, -1))
|
||||||
|
estimate = {
|
||||||
|
"frequency_hz": float(initial["cfo_hz"]),
|
||||||
|
"gain": complex(gain),
|
||||||
|
"phase_fit_rmse_rad": None,
|
||||||
|
"squared_coherence": None,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
estimate_value = carrier_tracking.estimate_p3(
|
||||||
|
symbols[:PREAMBLE_SYMBOLS], processor.expected, SYMBOL_RATE
|
||||||
|
)
|
||||||
|
tracked = carrier_tracking.track_t2(
|
||||||
|
symbols, SYMBOL_RATE, estimate_value, start_index=PREAMBLE_SYMBOLS
|
||||||
|
)
|
||||||
|
corrected = tracked.corrected.copy()
|
||||||
|
phase_trace = tracked.phase_rad.copy()
|
||||||
|
frequency_trace = tracked.frequency_hz.copy()
|
||||||
|
detector_error = tracked.detector_error_rad.copy()
|
||||||
|
estimate = {
|
||||||
|
"frequency_hz": float(estimate_value.frequency_hz),
|
||||||
|
"gain": complex(estimate_value.gain),
|
||||||
|
"phase_fit_rmse_rad": float(estimate_value.phase_fit_rmse_rad),
|
||||||
|
"squared_coherence": float(estimate_value.squared_coherence),
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"corrected": corrected,
|
||||||
|
"raw_symbols": symbols,
|
||||||
|
"matched": matched,
|
||||||
|
"hard_bits": (corrected.real >= 0).astype(np.uint8),
|
||||||
|
"timing_samples": timing,
|
||||||
|
"timing_fraction": timing / SAMPLES_PER_SYMBOL,
|
||||||
|
"nominal": nominal,
|
||||||
|
"sample_positions": frame_start + nominal + timing + np.arange(symbol_count) * SAMPLES_PER_SYMBOL,
|
||||||
|
"initial": estimate,
|
||||||
|
"phase_trace": phase_trace,
|
||||||
|
"frequency_trace": frequency_trace,
|
||||||
|
"detector_error": detector_error,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def reference_sync_diagnostic(extracted: dict, expected_bits: np.ndarray) -> dict:
|
||||||
|
"""Oracle-проверка timing/CFO после штатного результата, без влияния на него."""
|
||||||
|
expected = 2.0 * np.asarray(expected_bits, dtype=np.float64) - 1.0
|
||||||
|
indexes = np.arange(len(expected), dtype=np.int64)
|
||||||
|
candidates = []
|
||||||
|
for offset in range(-SAMPLES_PER_SYMBOL // 2, SAMPLES_PER_SYMBOL // 2 + 1):
|
||||||
|
start = extracted["nominal"] + offset
|
||||||
|
symbols = extracted["matched"][
|
||||||
|
start:start + len(expected) * SAMPLES_PER_SYMBOL:SAMPLES_PER_SYMBOL
|
||||||
|
].astype(np.complex128)
|
||||||
|
if len(symbols) != len(expected):
|
||||||
|
continue
|
||||||
|
frequency, gain, coherence = symbol_quality.fit_cfo_gain(
|
||||||
|
symbols, expected, indexes, SYMBOL_RATE, len(expected)
|
||||||
|
)
|
||||||
|
candidates.append((coherence, offset, frequency, gain))
|
||||||
|
coherence, timing, frequency, gain = max(candidates, key=lambda item: item[0])
|
||||||
|
return {
|
||||||
|
"scope": "KNOWN_BITS_AFTER_STRICT_VERDICT",
|
||||||
|
"timing_offset_samples": int(timing),
|
||||||
|
"timing_fraction": timing / SAMPLES_PER_SYMBOL,
|
||||||
|
"frequency_hz": float(frequency),
|
||||||
|
"gain_real": float(gain.real),
|
||||||
|
"gain_imag": float(gain.imag),
|
||||||
|
"coherence": float(coherence),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def physical_metrics(extracted: dict, expected_bits: np.ndarray, selected: slice) -> dict:
|
||||||
|
expected = 2.0 * np.asarray(expected_bits[selected], dtype=np.float64) - 1.0
|
||||||
|
raw = extracted["raw_symbols"][selected]
|
||||||
|
indexes = np.arange(len(extracted["raw_symbols"]), dtype=np.float64)[selected]
|
||||||
|
frequency = extracted["initial"]["frequency_hz"]
|
||||||
|
times = (indexes + 0.5) / SYMBOL_RATE
|
||||||
|
derotated = raw * np.exp(-2j * np.pi * frequency * times)
|
||||||
|
gain = complex(extracted["initial"]["gain"])
|
||||||
|
predicted = gain * expected
|
||||||
|
residual = derotated - predicted
|
||||||
|
matched_power = float(np.mean(abs(predicted) ** 2))
|
||||||
|
residual_power = float(np.mean(abs(residual) ** 2))
|
||||||
|
normalized = derotated / gain
|
||||||
|
errors = int(np.count_nonzero((normalized.real >= 0) != (expected > 0)))
|
||||||
|
correlation = float(
|
||||||
|
abs(np.vdot(expected, raw))
|
||||||
|
/ math.sqrt(float(np.vdot(expected, expected).real * np.vdot(raw, raw).real) + 1e-30)
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"symbols": int(len(expected)),
|
||||||
|
"errors": errors,
|
||||||
|
"error_rate": errors / len(expected),
|
||||||
|
"correlation": correlation,
|
||||||
|
"matched_component_power": matched_power,
|
||||||
|
"residual_power": residual_power,
|
||||||
|
"matched_residual_db": finite(10 * np.log10(matched_power / residual_power)),
|
||||||
|
"rms_symbol_deviation": float(np.sqrt(residual_power / matched_power)),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def header_diagnostics(received_soft: np.ndarray, expected_bits: np.ndarray) -> dict:
|
||||||
|
soft = np.asarray(received_soft[:HEADER_SYMBOLS], dtype=np.float64)
|
||||||
|
raw = (soft >= 0.0).astype(np.uint8)
|
||||||
|
expected = np.asarray(expected_bits[:HEADER_SYMBOLS], dtype=np.uint8)
|
||||||
|
raw_groups = raw.reshape(HEADER_BITS, HEADER_REPETITION)
|
||||||
|
expected_groups = expected.reshape(HEADER_BITS, HEADER_REPETITION)
|
||||||
|
voted = (np.sum(soft.reshape(HEADER_BITS, HEADER_REPETITION), axis=1) >= 0.0).astype(np.uint8)
|
||||||
|
expected_voted = expected_groups[:, 0]
|
||||||
|
fields = lab066.phy.lab045.lab044.bits_to_bytes(voted)
|
||||||
|
magic, version, length, checksum = struct.unpack(
|
||||||
|
lab066.phy.lab045.PHY_HEADER_FIELDS_FORMAT, fields
|
||||||
|
)
|
||||||
|
decoded = lab066.phy.lab045.decode_phy_header_soft(soft)
|
||||||
|
field_errors = {
|
||||||
|
"magic": int(np.count_nonzero(voted[:16] != expected_voted[:16])),
|
||||||
|
"version": int(np.count_nonzero(voted[16:24] != expected_voted[16:24])),
|
||||||
|
"length": int(np.count_nonzero(voted[24:40] != expected_voted[24:40])),
|
||||||
|
"checksum": int(np.count_nonzero(voted[40:48] != expected_voted[40:48])),
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"expected_header_bits": bits_text(expected),
|
||||||
|
"received_raw_header_bits": bits_text(raw),
|
||||||
|
"raw_header_errors": int(np.count_nonzero(raw != expected)),
|
||||||
|
"copy_errors": [
|
||||||
|
int(np.count_nonzero(raw_groups[:, index] != expected_groups[:, index]))
|
||||||
|
for index in range(HEADER_REPETITION)
|
||||||
|
],
|
||||||
|
"voted_header_bits": bits_text(voted),
|
||||||
|
"expected_voted_bits": bits_text(expected_voted),
|
||||||
|
"voted_header_errors": int(np.count_nonzero(voted != expected_voted)),
|
||||||
|
"magic_errors": field_errors["magic"],
|
||||||
|
"version_errors": field_errors["version"],
|
||||||
|
"length_errors": field_errors["length"],
|
||||||
|
"checksum_errors": field_errors["checksum"],
|
||||||
|
"decoded_magic": magic,
|
||||||
|
"decoded_version": version,
|
||||||
|
"decoded_length": length,
|
||||||
|
"decoded_checksum": checksum,
|
||||||
|
"accepted": bool(decoded["passed"]),
|
||||||
|
"reason": decoded["reason"],
|
||||||
|
"raw_error_positions": np.flatnonzero(raw != expected).astype(int).tolist(),
|
||||||
|
"voted_error_positions": np.flatnonzero(voted != expected_voted).astype(int).tolist(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def gap_metrics(received: symbol_quality.Cs8File, start: int, count: int) -> dict:
|
||||||
|
values = received.read(start, count).astype(np.complex128)
|
||||||
|
mean = np.mean(values)
|
||||||
|
centered = values - mean
|
||||||
|
edge = min(count // 4, 8000)
|
||||||
|
first_power = float(np.mean(abs(centered[:edge]) ** 2))
|
||||||
|
middle_start = max(edge, count // 2 - edge // 2)
|
||||||
|
middle_power = float(np.mean(abs(centered[middle_start:middle_start + edge]) ** 2))
|
||||||
|
tail_ratio_db = float(10 * np.log10(max(first_power, 1e-30) / max(middle_power, 1e-30)))
|
||||||
|
return {
|
||||||
|
"length_samples": count,
|
||||||
|
"duration_seconds": count / SAMPLE_RATE_HZ,
|
||||||
|
"background_ac_rms": float(np.sqrt(np.mean(abs(centered) ** 2))),
|
||||||
|
"mean_i": float(mean.real),
|
||||||
|
"mean_q": float(mean.imag),
|
||||||
|
"residual_energy_mean": float(np.mean(abs(centered) ** 2)),
|
||||||
|
"leading_edge_to_middle_db": tail_ratio_db,
|
||||||
|
"previous_waveform_tail_detected": bool(tail_ratio_db > 3.0),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def strict_candidate_for_packet(rows: list[dict], expected: int) -> dict | None:
|
||||||
|
candidates = [row for row in rows if abs(int(row["absolute_refined"]) - expected) <= 64]
|
||||||
|
if not candidates:
|
||||||
|
return None
|
||||||
|
return min(
|
||||||
|
candidates,
|
||||||
|
key=lambda row: (
|
||||||
|
abs(int(row["absolute_refined"]) - expected),
|
||||||
|
int(row["absolute_refined"]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def candidate_analysis(strict: dict, expected_starts: list[int]) -> tuple[dict, list[dict]]:
|
||||||
|
rows = strict["run_a_legacy"]["rows"]
|
||||||
|
packet_samples = lab066.PACKET_SAMPLES
|
||||||
|
gap_intervals = []
|
||||||
|
metadata = json.loads((LAB066 / "preparation.json").read_text(encoding="utf-8"))
|
||||||
|
stream_start = strict["location_after_strict_runs"]["stream_rx_start_sample"]
|
||||||
|
for layout in metadata["layout"][:-1]:
|
||||||
|
low = stream_start + layout["following_gap_start_sample"]
|
||||||
|
gap_intervals.append((low, low + layout["following_gap_samples"]))
|
||||||
|
output_rows = []
|
||||||
|
true = repeated = gaps = unrelated = 0
|
||||||
|
true_positions = set()
|
||||||
|
per_packet = {index: 0 for index in range(1, 17)}
|
||||||
|
for number, row in enumerate(rows, start=1):
|
||||||
|
position = int(row["absolute_refined"])
|
||||||
|
distances = np.abs(np.asarray(expected_starts, dtype=np.int64) - position)
|
||||||
|
nearest_index = int(np.argmin(distances)) + 1
|
||||||
|
delta = position - expected_starts[nearest_index - 1]
|
||||||
|
in_gap = any(low <= position < high for low, high in gap_intervals)
|
||||||
|
if abs(delta) <= 64:
|
||||||
|
category = "TRUE_PREAMBLE_POSITION"
|
||||||
|
true += 1
|
||||||
|
true_positions.add((nearest_index, position))
|
||||||
|
elif -64 <= delta < packet_samples:
|
||||||
|
category = "REPEATED_PRBS_LOCAL_MAXIMUM"
|
||||||
|
repeated += 1
|
||||||
|
elif in_gap:
|
||||||
|
category = "ZERO_GAP"
|
||||||
|
gaps += 1
|
||||||
|
else:
|
||||||
|
category = "UNRELATED"
|
||||||
|
unrelated += 1
|
||||||
|
if category in {"TRUE_PREAMBLE_POSITION", "REPEATED_PRBS_LOCAL_MAXIMUM"}:
|
||||||
|
per_packet[nearest_index] += 1
|
||||||
|
output_rows.append({
|
||||||
|
"candidate_number": number,
|
||||||
|
"position": position,
|
||||||
|
"nearest_packet": nearest_index,
|
||||||
|
"difference_samples": delta,
|
||||||
|
"category": category,
|
||||||
|
"strict_reason": row["reason"],
|
||||||
|
})
|
||||||
|
summary = {
|
||||||
|
"total_strict_candidates": len(rows),
|
||||||
|
"true_preamble_position_checks": true,
|
||||||
|
"unique_true_preamble_positions": len(true_positions),
|
||||||
|
"duplicate_true_position_checks": true - len(true_positions),
|
||||||
|
"repeated_prbs_local_maxima": repeated,
|
||||||
|
"zero_gap_candidates": gaps,
|
||||||
|
"unrelated_candidates": unrelated,
|
||||||
|
"checks_associated_with_each_real_preamble": per_packet,
|
||||||
|
"detector_statistics": strict["run_a_legacy"]["detector_statistics"],
|
||||||
|
"candidate_processing_state": "NEW_PACKET_MEASURE_AND_INDEPENDENT_DECODE_PER_CANDIDATE",
|
||||||
|
"persistent_state_between_rejected_candidates": False,
|
||||||
|
"accepted_until_changes_only_after_crc_pass": True,
|
||||||
|
}
|
||||||
|
return summary, output_rows
|
||||||
|
|
||||||
|
|
||||||
|
def distribution(rows: list[dict], packets: set[int], key: str) -> dict:
|
||||||
|
values = np.asarray([row[key] for row in rows if row["packet"] in packets], dtype=float)
|
||||||
|
return {
|
||||||
|
"minimum": float(np.min(values)),
|
||||||
|
"median": float(np.median(values)),
|
||||||
|
"maximum": float(np.max(values)),
|
||||||
|
"values": {str(row["packet"]): row[key] for row in rows if row["packet"] in packets},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def assign_classifications(rows: list[dict]) -> None:
|
||||||
|
passed = [row for row in rows if row["packet"] in PASSED_PACKETS]
|
||||||
|
limits = {
|
||||||
|
"preamble_errors_max": max(row["preamble_errors"] for row in passed),
|
||||||
|
"preamble_mr_p10": float(np.percentile([row["preamble_matched_residual_db"] for row in passed], 10)),
|
||||||
|
"preamble_rms_p90": float(np.percentile([row["preamble_rms_symbol_deviation"] for row in passed], 90)),
|
||||||
|
"correlation_p10": float(np.percentile([row["preamble_correlation"] for row in passed], 10)),
|
||||||
|
}
|
||||||
|
for row in rows:
|
||||||
|
if row["packet"] in PASSED_PACKETS:
|
||||||
|
row["classification"] = "PASSED"
|
||||||
|
continue
|
||||||
|
physical_bad = sum((
|
||||||
|
row["preamble_errors"] > limits["preamble_errors_max"],
|
||||||
|
row["preamble_matched_residual_db"] < limits["preamble_mr_p10"],
|
||||||
|
row["preamble_rms_symbol_deviation"] > limits["preamble_rms_p90"],
|
||||||
|
row["preamble_correlation"] < limits["correlation_p10"],
|
||||||
|
))
|
||||||
|
if row["preamble_errors"] > limits["preamble_errors_max"]:
|
||||||
|
row["classification"] = "PREAMBLE_ALREADY_BAD"
|
||||||
|
elif physical_bad >= 2:
|
||||||
|
row["classification"] = "LOCAL_RF_DEGRADATION"
|
||||||
|
elif row["header_voted_errors"] > 0:
|
||||||
|
row["classification"] = "HEADER_SPECIFIC_FAILURE"
|
||||||
|
else:
|
||||||
|
row["classification"] = "NOT_LOCALIZED"
|
||||||
|
|
||||||
|
|
||||||
|
def group_summary(rows: list[dict]) -> dict:
|
||||||
|
groups = {"START": range(1, 5), "MIDDLE_1": range(5, 9), "MIDDLE_2": range(9, 13), "END": range(13, 17)}
|
||||||
|
result = {}
|
||||||
|
for name, indexes in groups.items():
|
||||||
|
selected = [row for row in rows if row["packet"] in indexes]
|
||||||
|
result[name] = {
|
||||||
|
"packets": list(indexes),
|
||||||
|
"preamble_error_rate": float(np.mean([row["preamble_error_rate"] for row in selected])),
|
||||||
|
"header_error_rate": float(np.mean([row["header_raw_errors"] / HEADER_SYMBOLS for row in selected])),
|
||||||
|
"matched_power": float(np.mean([row["local_matched_power"] for row in selected])),
|
||||||
|
"residual_power": float(np.mean([row["local_residual_power"] for row in selected])),
|
||||||
|
"matched_residual_db": float(10 * np.log10(
|
||||||
|
np.mean([row["local_matched_power"] for row in selected])
|
||||||
|
/ np.mean([row["local_residual_power"] for row in selected])
|
||||||
|
)),
|
||||||
|
"initial_frequency_offset_hz": float(np.mean([row["legacy_initial_frequency_hz"] for row in selected])),
|
||||||
|
"timing_offset_samples": float(np.mean([row["timing_offset_samples"] for row in selected])),
|
||||||
|
"background_ac_rms": float(np.mean([row["gap_background_ac_rms"] for row in selected])),
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def make_plots(rows: list[dict], transitions: dict[int, dict], candidates: dict) -> list[str]:
|
||||||
|
OUTPUT.mkdir(parents=True, exist_ok=True)
|
||||||
|
packets = [row["packet"] for row in rows]
|
||||||
|
colors = ["C3" if packet in FAILED_PACKETS else "C0" for packet in packets]
|
||||||
|
plots = []
|
||||||
|
|
||||||
|
def save(name: str) -> None:
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.savefig(OUTPUT / name, dpi=160)
|
||||||
|
plt.close()
|
||||||
|
plots.append(name)
|
||||||
|
|
||||||
|
plt.figure(figsize=(10, 4.5))
|
||||||
|
plt.bar(packets, [row["preamble_errors"] for row in rows], color=colors)
|
||||||
|
plt.xticks(packets); plt.xlabel("Пакет"); plt.ylabel("Ошибки преамбулы, бит")
|
||||||
|
plt.grid(axis="y", alpha=.25); save("preamble_errors_by_packet.png")
|
||||||
|
|
||||||
|
plt.figure(figsize=(10, 4.5))
|
||||||
|
x = np.arange(1, 17)
|
||||||
|
plt.bar(x - .18, [row["header_raw_errors"] for row in rows], width=.36, label="raw")
|
||||||
|
plt.bar(x + .18, [row["header_voted_errors"] for row in rows], width=.36, label="voted", color=colors)
|
||||||
|
plt.xticks(x); plt.xlabel("Пакет"); plt.ylabel("Ошибки PHY header, бит"); plt.legend()
|
||||||
|
plt.grid(axis="y", alpha=.25); save("header_errors_by_packet.png")
|
||||||
|
|
||||||
|
figure, axes = plt.subplots(3, 1, figsize=(10, 8), sharex=True)
|
||||||
|
axes[0].bar(packets, [row["local_matched_power"] for row in rows], color=colors)
|
||||||
|
axes[0].set_ylabel("Matched power")
|
||||||
|
axes[1].bar(packets, [row["local_residual_power"] for row in rows], color=colors)
|
||||||
|
axes[1].set_ylabel("Residual power")
|
||||||
|
axes[2].bar(packets, [row["local_matched_residual_db"] for row in rows], color=colors)
|
||||||
|
axes[2].set_ylabel("Matched/residual, dB"); axes[2].set_xlabel("Пакет"); axes[2].set_xticks(packets)
|
||||||
|
for axis in axes: axis.grid(axis="y", alpha=.25)
|
||||||
|
save("local_signal_quality_by_packet.png")
|
||||||
|
|
||||||
|
matrix = np.zeros((16, HEADER_SYMBOLS), dtype=np.uint8)
|
||||||
|
for row in rows:
|
||||||
|
for position in row["header_raw_error_positions"]:
|
||||||
|
matrix[row["packet"] - 1, position] = 1
|
||||||
|
plt.figure(figsize=(13, 5))
|
||||||
|
plt.imshow(matrix, aspect="auto", interpolation="nearest", cmap="Reds")
|
||||||
|
plt.xlabel("Позиция защищённого PHY header, 0...143"); plt.ylabel("Пакет")
|
||||||
|
plt.yticks(np.arange(16), np.arange(1, 17)); plt.colorbar(label="Ошибка")
|
||||||
|
save("header_error_position_map.png")
|
||||||
|
|
||||||
|
representative = [4, 1, 14, 16]
|
||||||
|
figure, axes = plt.subplots(len(representative), 3, figsize=(13, 10), sharex=True)
|
||||||
|
for line, packet in enumerate(representative):
|
||||||
|
values = transitions[packet]
|
||||||
|
x = np.arange(-128, HEADER_SYMBOLS + 128)
|
||||||
|
axes[line, 0].plot(x, values["corrected_real"], lw=.7)
|
||||||
|
axes[line, 0].scatter(x[values["errors"]], np.asarray(values["corrected_real"])[values["errors"]], s=12, color="red")
|
||||||
|
axes[line, 1].plot(x, values["corrected_imag"], lw=.7)
|
||||||
|
axes[line, 2].plot(x, values["phase_error_rad"], lw=.7)
|
||||||
|
for axis in axes[line]:
|
||||||
|
axis.axvline(0, color="black", lw=.8); axis.axvline(HEADER_SYMBOLS, color="black", lw=.8)
|
||||||
|
axis.grid(alpha=.2)
|
||||||
|
axes[line, 0].set_ylabel(f"P{packet}")
|
||||||
|
axes[0, 0].set_title("Re, ошибки красным"); axes[0, 1].set_title("Im"); axes[0, 2].set_title("Фазовая ошибка, rad")
|
||||||
|
for axis in axes[-1]: axis.set_xlabel("Символ относительно начала header")
|
||||||
|
save("preamble_header_transition.png")
|
||||||
|
|
||||||
|
figure, axes = plt.subplots(2, 1, figsize=(10, 6), sharex=True)
|
||||||
|
axes[0].bar(packets, [row["timing_offset_samples"] for row in rows], color=colors)
|
||||||
|
axes[0].set_ylabel("Timing, samples")
|
||||||
|
axes[1].plot(packets, [row["legacy_initial_frequency_hz"] for row in rows], "o-", label="legacy")
|
||||||
|
axes[1].plot(packets, [row["t2_initial_frequency_hz"] for row in rows], "s-", label="T2/P3")
|
||||||
|
axes[1].set_ylabel("CFO, Hz"); axes[1].set_xlabel("Пакет"); axes[1].legend()
|
||||||
|
for axis in axes: axis.grid(alpha=.25)
|
||||||
|
save("timing_and_cfo_by_packet.png")
|
||||||
|
|
||||||
|
plt.figure(figsize=(10, 4.5))
|
||||||
|
plt.bar(packets, [row["gap_background_ac_rms"] for row in rows], color=colors)
|
||||||
|
plt.xlabel("Пакет"); plt.ylabel("AC RMS перед пакетом"); plt.xticks(packets); plt.grid(axis="y", alpha=.25)
|
||||||
|
save("gap_background_by_packet.png")
|
||||||
|
|
||||||
|
per_packet = candidates["checks_associated_with_each_real_preamble"]
|
||||||
|
plt.figure(figsize=(10, 4.5))
|
||||||
|
plt.bar(packets, [per_packet[str(packet)] if str(packet) in per_packet else per_packet[packet] for packet in packets], color=colors)
|
||||||
|
plt.xlabel("Пакет"); plt.ylabel("Строгие проверки кандидатов"); plt.xticks(packets); plt.grid(axis="y", alpha=.25)
|
||||||
|
save("candidate_checks_by_packet.png")
|
||||||
|
return plots
|
||||||
|
|
||||||
|
|
||||||
|
def write_csvs(rows: list[dict], candidate_rows: list[dict], bit_rows: list[dict], transition_rows: list[dict]) -> None:
|
||||||
|
main_fields = [
|
||||||
|
"packet", "strict_result", "candidate_position", "expected_packet_position", "candidate_difference_samples",
|
||||||
|
"preamble_errors", "preamble_error_rate", "preamble_correlation", "header_raw_errors", "header_voted_errors",
|
||||||
|
"header_copy_1_errors", "header_copy_2_errors", "header_copy_3_errors", "magic_errors", "version_errors",
|
||||||
|
"length_errors", "checksum_errors", "expected_header_bits", "received_raw_header_bits", "voted_header_bits",
|
||||||
|
"header_accepted", "header_reason", "legacy_header_bits", "t2_header_bits",
|
||||||
|
"legacy_initial_frequency_hz", "t2_initial_frequency_hz", "reference_frequency_hz",
|
||||||
|
"legacy_frequency_error_vs_reference_hz", "initial_phase_error_rad", "timing_offset_samples", "fractional_timing_offset",
|
||||||
|
"reference_timing_offset_samples", "reference_fractional_timing_offset", "local_matched_power", "local_residual_power",
|
||||||
|
"local_matched_residual_db", "rms_symbol_deviation", "legacy_t2_header_differences", "classification",
|
||||||
|
]
|
||||||
|
with (OUTPUT / "header_packet_comparison.csv").open("w", newline="", encoding="utf-8-sig") as stream:
|
||||||
|
writer = csv.DictWriter(stream, fieldnames=main_fields, extrasaction="ignore")
|
||||||
|
writer.writeheader(); writer.writerows(rows)
|
||||||
|
for name, values in (
|
||||||
|
("header_bit_errors.csv", bit_rows),
|
||||||
|
("candidate_analysis.csv", candidate_rows),
|
||||||
|
("transition_metrics.csv", transition_rows),
|
||||||
|
):
|
||||||
|
with (OUTPUT / name).open("w", newline="", encoding="utf-8-sig") as stream:
|
||||||
|
writer = csv.DictWriter(stream, fieldnames=list(values[0]))
|
||||||
|
writer.writeheader(); writer.writerows(values)
|
||||||
|
|
||||||
|
|
||||||
|
def analyze() -> dict:
|
||||||
|
integrity, metadata, strict = source_integrity()
|
||||||
|
received = symbol_quality.Cs8File(RX_PATH)
|
||||||
|
stream_start = int(strict["location_after_strict_runs"]["stream_rx_start_sample"])
|
||||||
|
expected_starts = [stream_start + int(item["start_sample"]) for item in metadata["layout"]]
|
||||||
|
plans = lab066.plans()
|
||||||
|
packet_rows: list[dict] = []
|
||||||
|
bit_rows: list[dict] = []
|
||||||
|
transition_rows: list[dict] = []
|
||||||
|
transitions: dict[int, dict] = {}
|
||||||
|
tx_headers = []
|
||||||
|
|
||||||
|
for packet, (layout, frame, rx_start) in enumerate(zip(metadata["layout"], plans, expected_starts), start=1):
|
||||||
|
expected_frame = frame.plan.frame_bits.astype(np.uint8)
|
||||||
|
expected_header = frame.plan.phy_header_bits.astype(np.uint8)
|
||||||
|
tx_headers.append(expected_header)
|
||||||
|
legacy = extract_symbols(received, rx_start, PREAMBLE_SYMBOLS + HEADER_SYMBOLS, "legacy")
|
||||||
|
t2 = extract_symbols(received, rx_start, PREAMBLE_SYMBOLS + HEADER_SYMBOLS, "t2")
|
||||||
|
transition = extract_symbols(
|
||||||
|
received, rx_start, PREAMBLE_SYMBOLS + HEADER_SYMBOLS + POSTHEADER_SYMBOLS, "legacy"
|
||||||
|
)
|
||||||
|
preamble = physical_metrics(legacy, expected_frame, slice(0, PREAMBLE_SYMBOLS))
|
||||||
|
local = physical_metrics(legacy, expected_frame, slice(PREAMBLE_SYMBOLS - 128, PREAMBLE_SYMBOLS + HEADER_SYMBOLS))
|
||||||
|
reference = reference_sync_diagnostic(
|
||||||
|
legacy, expected_frame[:PREAMBLE_SYMBOLS + HEADER_SYMBOLS]
|
||||||
|
)
|
||||||
|
header_legacy = header_diagnostics(
|
||||||
|
legacy["corrected"].real[PREAMBLE_SYMBOLS:], expected_header
|
||||||
|
)
|
||||||
|
header_t2 = header_diagnostics(
|
||||||
|
t2["corrected"].real[PREAMBLE_SYMBOLS:], expected_header
|
||||||
|
)
|
||||||
|
legacy_t2_differences = int(np.count_nonzero(
|
||||||
|
legacy["hard_bits"][PREAMBLE_SYMBOLS:] != t2["hard_bits"][PREAMBLE_SYMBOLS:]
|
||||||
|
))
|
||||||
|
strict_row = strict_candidate_for_packet(strict["run_a_legacy"]["rows"], rx_start)
|
||||||
|
candidate_position = int(strict_row["absolute_refined"]) if strict_row else None
|
||||||
|
if packet == 1:
|
||||||
|
preceding_start = stream_start
|
||||||
|
preceding_count = lab066.GUARD_SAMPLES
|
||||||
|
else:
|
||||||
|
preceding_count = lab066.INTER_PACKET_GAP_SAMPLES
|
||||||
|
preceding_start = rx_start - preceding_count
|
||||||
|
gap = gap_metrics(received, preceding_start, preceding_count)
|
||||||
|
trailing = gap_metrics(received, rx_start + lab066.PACKET_SAMPLES, lab066.GUARD_SAMPLES) if packet == 16 else None
|
||||||
|
row = {
|
||||||
|
"packet": packet,
|
||||||
|
"strict_result": "PASS" if packet in PASSED_PACKETS else "HEADER_FAIL",
|
||||||
|
"candidate_position": candidate_position,
|
||||||
|
"expected_packet_position": rx_start,
|
||||||
|
"candidate_difference_samples": None if candidate_position is None else candidate_position - rx_start,
|
||||||
|
"timing_offset_samples": legacy["timing_samples"],
|
||||||
|
"fractional_timing_offset": legacy["timing_fraction"],
|
||||||
|
"timing_metric_confidence": None,
|
||||||
|
"preamble_symbols": preamble["symbols"],
|
||||||
|
"preamble_errors": preamble["errors"],
|
||||||
|
"preamble_error_rate": preamble["error_rate"],
|
||||||
|
"preamble_correlation": preamble["correlation"],
|
||||||
|
"preamble_rms_symbol_deviation": preamble["rms_symbol_deviation"],
|
||||||
|
"preamble_matched_power": preamble["matched_component_power"],
|
||||||
|
"preamble_residual_power": preamble["residual_power"],
|
||||||
|
"preamble_matched_residual_db": preamble["matched_residual_db"],
|
||||||
|
"legacy_initial_frequency_hz": legacy["initial"]["frequency_hz"],
|
||||||
|
"t2_initial_frequency_hz": t2["initial"]["frequency_hz"],
|
||||||
|
"initial_phase_error_rad": float(np.angle(legacy["initial"]["gain"])),
|
||||||
|
"frequency_difference_legacy_t2_hz": legacy["initial"]["frequency_hz"] - t2["initial"]["frequency_hz"],
|
||||||
|
"reference_frequency_hz": reference["frequency_hz"],
|
||||||
|
"legacy_frequency_error_vs_reference_hz": legacy["initial"]["frequency_hz"] - reference["frequency_hz"],
|
||||||
|
"reference_timing_offset_samples": reference["timing_offset_samples"],
|
||||||
|
"reference_fractional_timing_offset": reference["timing_fraction"],
|
||||||
|
"reference_coherence": reference["coherence"],
|
||||||
|
"legacy_expected_phase_drift_preamble_rad": float(2 * np.pi * legacy["initial"]["frequency_hz"] * PREAMBLE_SYMBOLS / SYMBOL_RATE),
|
||||||
|
"legacy_expected_phase_drift_header_rad": float(2 * np.pi * legacy["initial"]["frequency_hz"] * HEADER_SYMBOLS / SYMBOL_RATE),
|
||||||
|
"legacy_expected_phase_drift_full_packet_rad": float(2 * np.pi * legacy["initial"]["frequency_hz"] * len(expected_frame) / SYMBOL_RATE),
|
||||||
|
"phase_error_from_cfo_mismatch_over_header_rad": float(
|
||||||
|
2 * np.pi * (legacy["initial"]["frequency_hz"] - reference["frequency_hz"])
|
||||||
|
* HEADER_SYMBOLS / SYMBOL_RATE
|
||||||
|
),
|
||||||
|
"expected_header_bits": header_legacy["expected_header_bits"],
|
||||||
|
"received_raw_header_bits": header_legacy["received_raw_header_bits"],
|
||||||
|
"header_raw_errors": header_legacy["raw_header_errors"],
|
||||||
|
"header_copy_1_errors": header_legacy["copy_errors"][0],
|
||||||
|
"header_copy_2_errors": header_legacy["copy_errors"][1],
|
||||||
|
"header_copy_3_errors": header_legacy["copy_errors"][2],
|
||||||
|
"voted_header_bits": header_legacy["voted_header_bits"],
|
||||||
|
"header_voted_errors": header_legacy["voted_header_errors"],
|
||||||
|
"magic_errors": header_legacy["magic_errors"],
|
||||||
|
"version_errors": header_legacy["version_errors"],
|
||||||
|
"length_errors": header_legacy["length_errors"],
|
||||||
|
"checksum_errors": header_legacy["checksum_errors"],
|
||||||
|
"decoded_magic": header_legacy["decoded_magic"],
|
||||||
|
"decoded_length": header_legacy["decoded_length"],
|
||||||
|
"header_accepted": header_legacy["accepted"],
|
||||||
|
"header_reason": header_legacy["reason"],
|
||||||
|
"header_raw_error_positions": header_legacy["raw_error_positions"],
|
||||||
|
"header_voted_error_positions": header_legacy["voted_error_positions"],
|
||||||
|
"legacy_header_bits": header_legacy["received_raw_header_bits"],
|
||||||
|
"t2_header_bits": header_t2["received_raw_header_bits"],
|
||||||
|
"legacy_t2_header_differences": legacy_t2_differences,
|
||||||
|
"local_window": "last 128 preamble symbols plus complete 144-symbol header",
|
||||||
|
"local_matched_power": local["matched_component_power"],
|
||||||
|
"local_residual_power": local["residual_power"],
|
||||||
|
"local_matched_residual_db": local["matched_residual_db"],
|
||||||
|
"rms_symbol_deviation": local["rms_symbol_deviation"],
|
||||||
|
"header_error_rate": header_legacy["raw_header_errors"] / HEADER_SYMBOLS,
|
||||||
|
"preceding_zero_gap_length": gap["length_samples"],
|
||||||
|
"gap_background_ac_rms": gap["background_ac_rms"],
|
||||||
|
"gap_mean_i": gap["mean_i"], "gap_mean_q": gap["mean_q"],
|
||||||
|
"gap_residual_energy": gap["residual_energy_mean"],
|
||||||
|
"previous_waveform_tail_detected": gap["previous_waveform_tail_detected"],
|
||||||
|
"gap_leading_edge_to_middle_db": gap["leading_edge_to_middle_db"],
|
||||||
|
"trailing_guard_packet_16": trailing,
|
||||||
|
}
|
||||||
|
packet_rows.append(row)
|
||||||
|
for position in range(HEADER_SYMBOLS):
|
||||||
|
bit_rows.append({
|
||||||
|
"packet": packet, "protected_bit_position": position,
|
||||||
|
"field_bit_position": position // HEADER_REPETITION,
|
||||||
|
"copy": position % HEADER_REPETITION + 1,
|
||||||
|
"expected": int(expected_header[position]),
|
||||||
|
"legacy_received": int(legacy["hard_bits"][PREAMBLE_SYMBOLS + position]),
|
||||||
|
"t2_received": int(t2["hard_bits"][PREAMBLE_SYMBOLS + position]),
|
||||||
|
"legacy_error": int(position in header_legacy["raw_error_positions"]),
|
||||||
|
"t2_error": int(position in header_t2["raw_error_positions"]),
|
||||||
|
})
|
||||||
|
start = PREAMBLE_SYMBOLS - 128
|
||||||
|
stop = PREAMBLE_SYMBOLS + HEADER_SYMBOLS + 128
|
||||||
|
corrected = transition["corrected"][start:stop]
|
||||||
|
truth = 2.0 * expected_frame[start:stop] - 1.0
|
||||||
|
errors = np.flatnonzero((corrected.real >= 0) != (truth > 0))
|
||||||
|
phase_error = np.angle(corrected * truth)
|
||||||
|
transitions[packet] = {
|
||||||
|
"corrected_real": corrected.real.astype(float).tolist(),
|
||||||
|
"corrected_imag": corrected.imag.astype(float).tolist(),
|
||||||
|
"magnitude": abs(corrected).astype(float).tolist(),
|
||||||
|
"phase_error_rad": phase_error.astype(float).tolist(),
|
||||||
|
"hard_decisions": (corrected.real >= 0).astype(int).tolist(),
|
||||||
|
"errors": errors.astype(int).tolist(),
|
||||||
|
"sample_positions": transition["sample_positions"][start:stop].astype(int).tolist(),
|
||||||
|
}
|
||||||
|
regions = {"preamble_tail": slice(0, 128), "header": slice(128, 128 + HEADER_SYMBOLS), "postheader": slice(128 + HEADER_SYMBOLS, None)}
|
||||||
|
for name, selected in regions.items():
|
||||||
|
values = corrected[selected]
|
||||||
|
local_truth = truth[selected]
|
||||||
|
transition_rows.append({
|
||||||
|
"packet": packet, "region": name,
|
||||||
|
"symbols": len(values),
|
||||||
|
"decision_errors": int(np.count_nonzero((values.real >= 0) != (local_truth > 0))),
|
||||||
|
"magnitude_median": float(np.median(abs(values))),
|
||||||
|
"magnitude_minimum": float(np.min(abs(values))),
|
||||||
|
"phase_error_rms_rad": float(np.sqrt(np.mean(np.angle(values * local_truth) ** 2))),
|
||||||
|
"imaginary_rms": float(np.sqrt(np.mean(values.imag ** 2))),
|
||||||
|
"timing_offset_samples": transition["timing_samples"],
|
||||||
|
})
|
||||||
|
|
||||||
|
assign_classifications(packet_rows)
|
||||||
|
candidate_summary, candidate_rows = candidate_analysis(strict, expected_starts)
|
||||||
|
tx_header_identical = all(np.array_equal(tx_headers[0], item) for item in tx_headers[1:])
|
||||||
|
tx_header_decodes = [lab066.phy.lab045.decode_phy_header_soft(2.0 * item - 1.0) for item in tx_headers]
|
||||||
|
software_current = {
|
||||||
|
mode: lab066.decode(mode, TX_PATH, diagnostics=False)
|
||||||
|
for mode in ("legacy", "t2")
|
||||||
|
}
|
||||||
|
software_16_of_16 = all(
|
||||||
|
result["packet_output"] == 16 and result["exact_payload_match"] == 16
|
||||||
|
for result in software_current.values()
|
||||||
|
)
|
||||||
|
groups = group_summary(packet_rows)
|
||||||
|
distributions = {
|
||||||
|
label: {
|
||||||
|
metric: distribution(packet_rows, packets, metric)
|
||||||
|
for metric in (
|
||||||
|
"preamble_errors", "preamble_error_rate", "preamble_correlation",
|
||||||
|
"preamble_rms_symbol_deviation", "preamble_matched_power",
|
||||||
|
"preamble_residual_power", "preamble_matched_residual_db",
|
||||||
|
"header_raw_errors", "header_voted_errors",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
for label, packets in (("passed", PASSED_PACKETS), ("failed", FAILED_PACKETS))
|
||||||
|
}
|
||||||
|
failed_classes = {str(row["packet"]): row["classification"] for row in packet_rows if row["packet"] in FAILED_PACKETS}
|
||||||
|
passed_local_residual = float(np.median([
|
||||||
|
row["local_residual_power"] for row in packet_rows if row["packet"] in PASSED_PACKETS
|
||||||
|
]))
|
||||||
|
failed_local_residual = float(np.median([
|
||||||
|
row["local_residual_power"] for row in packet_rows if row["packet"] in FAILED_PACKETS
|
||||||
|
]))
|
||||||
|
passed_local_ratio = float(np.median([
|
||||||
|
row["local_matched_residual_db"] for row in packet_rows if row["packet"] in PASSED_PACKETS
|
||||||
|
]))
|
||||||
|
failed_local_ratio = float(np.median([
|
||||||
|
row["local_matched_residual_db"] for row in packet_rows if row["packet"] in FAILED_PACKETS
|
||||||
|
]))
|
||||||
|
failed_error_positions = [
|
||||||
|
position for row in packet_rows if row["packet"] in FAILED_PACKETS
|
||||||
|
for position in row["header_raw_error_positions"]
|
||||||
|
]
|
||||||
|
repeated_failed_positions = sorted({
|
||||||
|
position for position in failed_error_positions
|
||||||
|
if failed_error_positions.count(position) > 1
|
||||||
|
})
|
||||||
|
diagnostic_strict_agreement = all(
|
||||||
|
row["header_accepted"] == (row["strict_result"] == "PASS")
|
||||||
|
for row in packet_rows
|
||||||
|
)
|
||||||
|
timing_agreement = all(
|
||||||
|
row["timing_offset_samples"] == row["reference_timing_offset_samples"]
|
||||||
|
for row in packet_rows
|
||||||
|
)
|
||||||
|
cfo_scale_small = max(abs(row["phase_error_from_cfo_mismatch_over_header_rad"])
|
||||||
|
for row in packet_rows) < 0.1
|
||||||
|
candidate_state_independent = (
|
||||||
|
candidate_summary["persistent_state_between_rejected_candidates"] is False
|
||||||
|
and candidate_summary["accepted_until_changes_only_after_crc_pass"] is True
|
||||||
|
)
|
||||||
|
local_quality_conditions = {
|
||||||
|
"tx_and_software_valid": bool(
|
||||||
|
tx_header_identical and all(item["passed"] for item in tx_header_decodes)
|
||||||
|
and software_16_of_16
|
||||||
|
),
|
||||||
|
"strict_header_reproduced": diagnostic_strict_agreement,
|
||||||
|
"no_common_failed_error_position": not repeated_failed_positions,
|
||||||
|
"failed_local_residual_at_least_20_percent_higher": (
|
||||||
|
failed_local_residual > 1.2 * passed_local_residual
|
||||||
|
),
|
||||||
|
"failed_local_matched_residual_at_least_1_db_lower": (
|
||||||
|
failed_local_ratio < passed_local_ratio - 1.0
|
||||||
|
),
|
||||||
|
"receiver_and_oracle_timing_agree": timing_agreement,
|
||||||
|
"cfo_mismatch_phase_scale_below_0p1_rad": cfo_scale_small,
|
||||||
|
"candidate_state_independent": candidate_state_independent,
|
||||||
|
}
|
||||||
|
root_cause = (
|
||||||
|
"LOCAL_RF_QUALITY" if all(local_quality_conditions.values())
|
||||||
|
else "NOT_LOCALIZED"
|
||||||
|
)
|
||||||
|
small_fix_evidence = {
|
||||||
|
"receiver_header_logic": bool(not diagnostic_strict_agreement),
|
||||||
|
"timing_transition": bool(not timing_agreement and not cfo_scale_small),
|
||||||
|
"carrier_transition": bool(not cfo_scale_small and timing_agreement),
|
||||||
|
"candidate_state_handling": bool(not candidate_state_independent),
|
||||||
|
}
|
||||||
|
one_small_fix = any(small_fix_evidence.values())
|
||||||
|
plots = make_plots(packet_rows, transitions, candidate_summary)
|
||||||
|
write_csvs(packet_rows, candidate_rows, bit_rows, transition_rows)
|
||||||
|
save_json(OUTPUT / "transition_symbols.json", transitions)
|
||||||
|
summary = {
|
||||||
|
"lab": "Lab067",
|
||||||
|
"mode": "OFFLINE_DIAGNOSTIC_ONLY",
|
||||||
|
"rf_tx": 0,
|
||||||
|
"hardware_accessed": False,
|
||||||
|
"lab066_integrity": integrity,
|
||||||
|
"historical_strict_result_unchanged": {
|
||||||
|
"legacy": "10/16", "t2": "10/16",
|
||||||
|
"passed_packets": sorted(PASSED_PACKETS), "failed_packets": sorted(FAILED_PACKETS),
|
||||||
|
},
|
||||||
|
"packet_positions_verified": len(expected_starts) == 16 and all(
|
||||||
|
row["candidate_difference_samples"] is not None and abs(row["candidate_difference_samples"]) <= 64
|
||||||
|
for row in packet_rows
|
||||||
|
),
|
||||||
|
"packet_rows": packet_rows,
|
||||||
|
"passed_failed_distributions": distributions,
|
||||||
|
"start_middle_end_groups": groups,
|
||||||
|
"failed_packet_classifications": failed_classes,
|
||||||
|
"header_error_position_analysis": {
|
||||||
|
"failed_raw_error_count": len(failed_error_positions),
|
||||||
|
"positions_repeated_between_failed_packets": repeated_failed_positions,
|
||||||
|
"systematic_common_position_found": bool(repeated_failed_positions),
|
||||||
|
"interpretation": "Позиции ошибок различаются; общей битовой позиции отказа нет.",
|
||||||
|
},
|
||||||
|
"local_quality_evidence": {
|
||||||
|
"passed_local_residual_power_median": passed_local_residual,
|
||||||
|
"failed_local_residual_power_median": failed_local_residual,
|
||||||
|
"passed_local_matched_residual_db_median": passed_local_ratio,
|
||||||
|
"failed_local_matched_residual_db_median": failed_local_ratio,
|
||||||
|
"failed_minus_passed_residual_power_median": failed_local_residual - passed_local_residual,
|
||||||
|
"failed_minus_passed_matched_residual_db_median": failed_local_ratio - passed_local_ratio,
|
||||||
|
"scope": "last 128 preamble symbols plus complete header",
|
||||||
|
"decision_conditions": local_quality_conditions,
|
||||||
|
},
|
||||||
|
"legacy_t2_header_difference": (
|
||||||
|
"NONE" if all(row["legacy_t2_header_differences"] == 0 for row in packet_rows)
|
||||||
|
else "PRESENT"
|
||||||
|
),
|
||||||
|
"t2_influence_starts_at_symbol": PREAMBLE_SYMBOLS,
|
||||||
|
"t2_explanation": "T2 начинает сопровождение после преамбулы; его решения заголовка сравнены побитно со штатным legacy.",
|
||||||
|
"candidate_analysis": candidate_summary,
|
||||||
|
"tx_validation": {
|
||||||
|
"headers_identical_at_all_packet_positions": tx_header_identical,
|
||||||
|
"all_headers_decode_with_correct_magic_version_length_checksum": all(item["passed"] for item in tx_header_decodes),
|
||||||
|
"decoded_packet_lengths": [item["packet_bytes"] for item in tx_header_decodes],
|
||||||
|
"software_roundtrip_current": software_current,
|
||||||
|
"legacy_and_t2_16_of_16": software_16_of_16,
|
||||||
|
},
|
||||||
|
"header_failure_root_cause": root_cause,
|
||||||
|
"one_small_fix_justified": one_small_fix,
|
||||||
|
"branch_decision": (
|
||||||
|
"ONE_SMALL_FIX_JUSTIFIED" if one_small_fix
|
||||||
|
else "NO_SMALL_FIX_JUSTIFIED"
|
||||||
|
),
|
||||||
|
"small_fix_assessment": {
|
||||||
|
"evidence_flags": small_fix_evidence,
|
||||||
|
"receiver_header_logic_error_found": small_fix_evidence["receiver_header_logic"],
|
||||||
|
"timing_transition_error_found": small_fix_evidence["timing_transition"],
|
||||||
|
"carrier_transition_error_explains_six_failures": small_fix_evidence["carrier_transition"],
|
||||||
|
"candidate_state_error_found": small_fix_evidence["candidate_state_handling"],
|
||||||
|
"reason": "TX и программный тракт дают 16/16; ошибки заголовка не имеют общей позиции, timing совпадает, а локальный остаток в failed header-окнах выше.",
|
||||||
|
},
|
||||||
|
"achieved_result": "10/16 exact full packets at 500 ksymbol/s, TX VGA 20 dB, hardware-valid OTA capture",
|
||||||
|
"recommended_next_project_branch": "CRSF / ELRS CONTROL AND TELEMETRY",
|
||||||
|
"qpsk_note": "QPSK с меньшей символьной скоростью остаётся будущим кандидатом для видеоканала; в Lab067 не реализован.",
|
||||||
|
"plots": plots,
|
||||||
|
"lab067_commit": "NOT PERFORMED",
|
||||||
|
"push": "NOT PERFORMED",
|
||||||
|
}
|
||||||
|
save_json(OUTPUT / "summary.json", summary)
|
||||||
|
return summary
|
||||||
|
|
||||||
|
|
||||||
|
def run_functional_tests() -> None:
|
||||||
|
expected = np.repeat(np.arange(HEADER_BITS, dtype=np.uint8) % 2, HEADER_REPETITION)
|
||||||
|
exact = header_diagnostics(2.0 * expected.astype(float) - 1.0, expected)
|
||||||
|
assert exact["raw_header_errors"] == 0
|
||||||
|
assert exact["voted_header_errors"] == 0
|
||||||
|
changed = expected.copy(); changed[3:5] ^= 1
|
||||||
|
result = header_diagnostics(2.0 * changed.astype(float) - 1.0, expected)
|
||||||
|
assert result["raw_header_errors"] == 2
|
||||||
|
assert result["voted_header_errors"] == 1
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
run_functional_tests()
|
||||||
|
result = analyze()
|
||||||
|
print(json.dumps({
|
||||||
|
"lab": result["lab"],
|
||||||
|
"historical_strict_result": result["historical_strict_result_unchanged"],
|
||||||
|
"root_cause": result["header_failure_root_cause"],
|
||||||
|
"one_small_fix_justified": result["one_small_fix_justified"],
|
||||||
|
"failed_packet_classifications": result["failed_packet_classifications"],
|
||||||
|
"plots": result["plots"],
|
||||||
|
}, ensure_ascii=False, indent=2))
|
||||||
|
print("RF TX = 0")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
79
tests/test_lab067_header_failure_analysis.py
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
"""Проверки диагностических вычислений Lab067 без raw IQ и оборудования."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from experiments import lab067_header_failure_analysis as lab067
|
||||||
|
|
||||||
|
|
||||||
|
def test_header_diagnostics_repeats_strict_soft_combining() -> None:
|
||||||
|
expected = lab067.lab066.plans()[0].plan.phy_header_bits.astype(np.uint8)
|
||||||
|
soft = 2.0 * expected.astype(float) - 1.0
|
||||||
|
# Две копии одного бита имеют неверный знак, но малы по модулю. Третья
|
||||||
|
# правильная копия сильнее, поэтому штатная мягкая сумма сохраняет бит.
|
||||||
|
soft[:2] *= -0.1
|
||||||
|
result = lab067.header_diagnostics(soft, expected)
|
||||||
|
assert result["raw_header_errors"] == 2
|
||||||
|
assert result["voted_header_errors"] == 0
|
||||||
|
assert result["accepted"] is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_header_diagnostics_reports_field_and_copy_errors() -> None:
|
||||||
|
expected = lab067.lab066.plans()[0].plan.phy_header_bits.astype(np.uint8)
|
||||||
|
received = expected.copy()
|
||||||
|
received[24:26] ^= 1
|
||||||
|
result = lab067.header_diagnostics(
|
||||||
|
2.0 * received.astype(float) - 1.0,
|
||||||
|
expected,
|
||||||
|
)
|
||||||
|
assert result["raw_header_errors"] == 2
|
||||||
|
assert result["copy_errors"] == [1, 1, 0]
|
||||||
|
assert result["voted_header_errors"] == 1
|
||||||
|
assert result["magic_errors"] == 1
|
||||||
|
assert result["accepted"] is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_strict_candidate_selection_uses_nearest_expected_position() -> None:
|
||||||
|
rows = [
|
||||||
|
{"absolute_refined": 980, "packet_output": False, "crc": False, "fec": False, "header": False},
|
||||||
|
{"absolute_refined": 1003, "packet_output": False, "crc": False, "fec": False, "header": True},
|
||||||
|
]
|
||||||
|
selected = lab067.strict_candidate_for_packet(rows, 1000)
|
||||||
|
assert selected is rows[1]
|
||||||
|
|
||||||
|
|
||||||
|
def test_strict_candidate_selection_never_prefers_farther_success() -> None:
|
||||||
|
exact_failure = {
|
||||||
|
"absolute_refined": 1000, "packet_output": False,
|
||||||
|
"crc": False, "fec": False, "header": False,
|
||||||
|
}
|
||||||
|
farther_success = {
|
||||||
|
"absolute_refined": 1064, "packet_output": True,
|
||||||
|
"crc": True, "fec": True, "header": True,
|
||||||
|
}
|
||||||
|
selected = lab067.strict_candidate_for_packet(
|
||||||
|
[farther_success, exact_failure], 1000
|
||||||
|
)
|
||||||
|
assert selected is exact_failure
|
||||||
|
|
||||||
|
|
||||||
|
def test_strict_candidate_tie_break_does_not_use_verdict() -> None:
|
||||||
|
lower_failure = {
|
||||||
|
"absolute_refined": 999, "packet_output": False,
|
||||||
|
"crc": False, "fec": False, "header": False,
|
||||||
|
}
|
||||||
|
upper_success = {
|
||||||
|
"absolute_refined": 1001, "packet_output": True,
|
||||||
|
"crc": True, "fec": True, "header": True,
|
||||||
|
}
|
||||||
|
selected = lab067.strict_candidate_for_packet(
|
||||||
|
[upper_success, lower_failure], 1000
|
||||||
|
)
|
||||||
|
assert selected is lower_failure
|
||||||
|
|
||||||
|
|
||||||
|
def test_lab067_has_no_rf_entry_point() -> None:
|
||||||
|
assert not hasattr(lab067, "capture_once")
|
||||||
|
assert lab067.RX_PATH.name == "rx_stream.cs8"
|
||||||
|
assert lab067.FAILED_PACKETS == {1, 2, 3, 9, 15, 16}
|
||||||