From 15035317d35c181223d314e48c084c26a111905c Mon Sep 17 00:00:00 2001 From: 30hours Date: Sun, 2 Jun 2024 23:21:51 +0930 Subject: [PATCH 1/3] Remove numpy tostring() deprecated in 1.19.0 for tobytes() --- spectrum_painter/img2iqstream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spectrum_painter/img2iqstream.py b/spectrum_painter/img2iqstream.py index 974cb0b..2b7946c 100644 --- a/spectrum_painter/img2iqstream.py +++ b/spectrum_painter/img2iqstream.py @@ -19,7 +19,7 @@ def img2iqstream(samplerate, linetime, output, format, srcs): for src in srcs: iq_samples = painter.convert_image(src) target_format = formatter.convert(iq_samples) - output.write(target_format.tostring()) + output.write(target_format.tobytes()) if __name__ == '__main__': From 599244453889307a3f1cdc26cdd844223a69c7c7 Mon Sep 17 00:00:00 2001 From: 30hours Date: Sun, 2 Jun 2024 23:23:23 +0930 Subject: [PATCH 2/3] Add seed to numpy.random for consistent IQ data --- spectrum_painter/spectrum_painter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spectrum_painter/spectrum_painter.py b/spectrum_painter/spectrum_painter.py index 16e5704..952e4a6 100644 --- a/spectrum_painter/spectrum_painter.py +++ b/spectrum_painter/spectrum_painter.py @@ -28,6 +28,7 @@ def convert_image(self, filename): # Generate random phase vectors for the FFT bins, this is important to prevent high peaks in the output # The phases won't be visible in the spectrum + np.seed(0) phases = 2*np.pi*np.random.rand(*fftall.shape) rffts = fftall * np.exp(1j*phases) From 5088fa281d365aaba9b080392ae00210b3cbf273 Mon Sep 17 00:00:00 2001 From: 30hours Date: Mon, 17 Jun 2024 19:32:26 +0930 Subject: [PATCH 3/3] Fix np.seed to np.random.seed --- spectrum_painter/spectrum_painter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spectrum_painter/spectrum_painter.py b/spectrum_painter/spectrum_painter.py index 952e4a6..b884d0d 100644 --- a/spectrum_painter/spectrum_painter.py +++ b/spectrum_painter/spectrum_painter.py @@ -28,7 +28,7 @@ def convert_image(self, filename): # Generate random phase vectors for the FFT bins, this is important to prevent high peaks in the output # The phases won't be visible in the spectrum - np.seed(0) + np.random.seed(0) phases = 2*np.pi*np.random.rand(*fftall.shape) rffts = fftall * np.exp(1j*phases)