This commit is contained in:
awe
2026-03-26 20:01:56 +03:00
parent 64e66933e4
commit 5152314f21
10 changed files with 377 additions and 110 deletions

View File

@ -231,14 +231,14 @@ class LogScale16BitX2BinaryParser:
del self._buf[:8]
continue
if words[3] == 0xFFFF and words[0] != 0xFFFF:
avg_1 = u16_to_i16(words[1])
avg_2 = u16_to_i16(words[2])
real = u16_to_i16(words[1])
imag = u16_to_i16(words[2])
events.append(
PointEvent(
ch=self._current_channel,
x=int(words[0]),
y=log_pair_to_sweep(avg_1, avg_2),
aux=(float(avg_1), float(avg_2)),
y=float(abs(complex(real, imag))),
aux=(float(real), float(imag)),
)
)
del self._buf[:8]
@ -268,14 +268,14 @@ class ParserTestStreamParser:
return None
if self._expected_step is not None and step < self._expected_step:
return None
avg_1 = u16_to_i16(int(self._point_buf[1]))
avg_2 = u16_to_i16(int(self._point_buf[2]))
real = u16_to_i16(int(self._point_buf[1]))
imag = u16_to_i16(int(self._point_buf[2]))
self._expected_step = step + 1
return PointEvent(
ch=self._current_channel,
x=step,
y=log_pair_to_sweep(avg_1, avg_2),
aux=(float(avg_1), float(avg_2)),
y=float(abs(complex(real, imag))),
aux=(float(real), float(imag)),
)
def feed(self, data: bytes) -> List[ParserEvent]: