0

I got a problem I don't really understand.

I have a .bin-File with a timeseries of signals and noise in it. I have the exact timedata, to cut out only the interesting parts.

My problem is that sometimes the amplitudes are way to high, and sometimes they are like expected. I think I broke down the problem to the following:

sampling_rate = 2e6  
dt = np.dtype(np.int32) 
# get Timedata
start_raw_L1 = 261.2    # good_signal
count_raw_L1 = 1.315

# start_raw_L1 = 261.4  bad_signal
# count_raw_L1 = 1.315


start_L1 = np.int64(start_raw_L1*sampling_rate*4)
count_L1 = np.int64(count_raw_L1 * sampling_rate)

# L1
bin_data = open(bin_file, "rb")
bin_data.seek(start_L1, os.SEEK_SET)
data_L1 = np.fromfile(bin_data, dtype=dt, count=count_L1, sep='')
bin_data.close()

# Plot
plt.plot(data_L1)

So it looks like that it matters a lot which time I choose? If I just change the start time a little bit, the signal changes in the amplitude height, I dont get why? Maybe someone can help me out.

Thanks a lot! Best regards Bastian

good_signal bad_signal

4

1 回答 1

0

int(261.4*2e6*4)给出 2091199999。这不是 4 的倍数。问题是 261.4*2e6 给出 522799999.99999994,而不是您可能预期的 522800000。

将乘以 4 在转换之外移动到整数:4*int(261.4*2e6) 给出 2091199996。您可能更喜欢4*round(261.4*2e6),它给出 2091200000。在您的代码中,这意味着使用,比如说,

start_L1 = 4*np.int64(start_raw_L1*sampling_rate)
于 2018-10-26T07:10:18.583 回答