Use np.linspace() instead of np.arange() in soapy_power, rtl_power and rx_power backends

This commit is contained in:
Michal Krenek (Mikos) 2017-04-27 16:46:18 +02:00
parent 5505f0dfd7
commit 4571075bd9
3 changed files with 6 additions and 3 deletions

View File

@ -77,7 +77,8 @@ class PowerThread(BasePowerThread):
step = float(line[4])
samples = float(line[5])
x_axis = list(np.arange(start_freq + self.lnb_lo, stop_freq + self.lnb_lo, step))
x_axis = list(np.linspace(start_freq + self.lnb_lo, stop_freq + self.lnb_lo,
round((stop_freq - start_freq) / step)))
y_axis = [float(y) for y in line[6:]]
if len(x_axis) != len(y_axis):
print("ERROR: len(x_axis) != len(y_axis), use newer version of rtl_power!")

View File

@ -82,7 +82,8 @@ class PowerThread(BasePowerThread):
step = float(line[4])
samples = float(line[5])
x_axis = list(np.arange(start_freq + self.lnb_lo, stop_freq + self.lnb_lo, step))
x_axis = list(np.linspace(start_freq + self.lnb_lo, stop_freq + self.lnb_lo,
round((stop_freq - start_freq) / step)))
y_axis = [float(y) for y in line[6:]]
if len(x_axis) != len(y_axis):
print("ERROR: len(x_axis) != len(y_axis)!")

View File

@ -169,9 +169,10 @@ class PowerThread(BasePowerThread):
step = header.step
samples = header.samples
x_axis = np.arange(start_freq, stop_freq, step)
x_axis = np.linspace(start_freq, stop_freq, round((stop_freq - start_freq) / step))
if len(x_axis) != len(y_axis):
print("ERROR: len(x_axis) != len(y_axis)")
return
if self.min_freq is None:
self.min_freq = start_freq