mirror of
https://github.com/nqrduck/nqrduck-broadband.git
synced 2025-01-03 13:18:10 +00:00
Fixed number of points in the spectrum.
This commit is contained in:
parent
38ce350bca
commit
f0b4425b8c
1 changed files with 16 additions and 7 deletions
|
@ -151,18 +151,27 @@ class BroadbandModel(ModuleModel):
|
||||||
[measurement.fdy[center][0], measurement.fdy[idx_xf_lower][0]])
|
[measurement.fdy[center][0], measurement.fdy[idx_xf_lower][0]])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# We take the last point of the previous spectrum and the first point of the current spectrum and average them
|
||||||
fdy_assembled[-1] = (fdy_assembled[-1] + yf_interp_lower) / 2
|
fdy_assembled[-1] = (fdy_assembled[-1] + yf_interp_lower) / 2
|
||||||
fdy_assembled = np.append(fdy_assembled, measurement.fdy[center])
|
# Then we append the data from idx_xf_lower + 1 (because of the averaged datapoint) to idx_xf_upper
|
||||||
|
fdy_assembled = np.append(fdy_assembled, measurement.fdy[idx_xf_lower+1:idx_xf_upper-1])
|
||||||
fdy_assembled = np.append(fdy_assembled, yf_interp_upper)
|
fdy_assembled = np.append(fdy_assembled, yf_interp_upper)
|
||||||
|
|
||||||
fdx_assembled[-1] = -self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6
|
# We append the frequency values of the current spectrum and shift them by the target frequency
|
||||||
fdx_assembled = np.append(fdx_assembled, measurement.target_frequency * 1e-6)
|
fdx_assembled = np.append(fdx_assembled, -self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6)
|
||||||
fdx_assembled = np.append(fdx_assembled, +self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6)
|
fdx_assembled = np.append(fdx_assembled, measurement.fdx[idx_xf_lower + 1:idx_xf_upper - 1] + measurement.target_frequency * 1e-6)
|
||||||
|
|
||||||
# On the first run we will get an Index Error
|
# On the first run we will get an Index Error
|
||||||
except IndexError:
|
except IndexError:
|
||||||
fdy_assembled = np.array([yf_interp_lower, measurement.fdy[center][0], yf_interp_upper])
|
fdy_assembled = np.array([yf_interp_lower])
|
||||||
first_time_values = np.array([-self.frequency_step/2*1e-6, measurement.fdx[center] , +self.frequency_step/2*1e-6]) + measurement.target_frequency*1e-6
|
fdy_assembled = np.append(fdy_assembled, measurement.fdy[idx_xf_lower+1:idx_xf_upper-1])
|
||||||
fdx_assembled = first_time_values
|
fdy_assembled = np.append(fdy_assembled, yf_interp_upper)
|
||||||
|
|
||||||
|
first_time_values = (measurement.fdx[idx_xf_lower:idx_xf_upper] + measurement.target_frequency * 1e-6)
|
||||||
|
first_time_values[0] = -self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6
|
||||||
|
first_time_values[-1] = +self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6
|
||||||
|
|
||||||
|
fdx_assembled = np.array(first_time_values)
|
||||||
|
|
||||||
self.broadband_data_fdx = fdx_assembled.flatten()
|
self.broadband_data_fdx = fdx_assembled.flatten()
|
||||||
self.broadband_data_fdy = fdy_assembled.flatten()
|
self.broadband_data_fdy = fdy_assembled.flatten()
|
||||||
|
|
Loading…
Reference in a new issue