i am getting signals as given bellow this data capture for just 10 second (due to limited space here) now i want to write a code which shows bits per minute and im considering the value 3.00 as a bit
What i did:
I just used a threshold value to print data to count bits per minute
as
threshold = 2.8 # Threshold to do something if value is more than to that.
if signal >= 2.8:
print signal
counter = counter +1 # to count how many times we get value more than 2.8 or (near by 3)
bits_per_mint = counterx6 # captured for 10 second so converted it to minute
print bits_per_mint
data out put in 10 second
1.7646050347
1.6970572917
1.6774392361
0
3.486762153
1.6310026042
1.6582465278
1.6384114583
1.6501171875
1.6769661458
3.9909898997
0
1.6688020833
1.6627473958
1.6689800347
1.6756423611
1.6579513889
0
1.6809592014
1.6504774306
3.7684857685
1.6463671875
1.67640625
0
1.6509635417
1.6736501736
3.5653423434
1.6581206597
1.6516666667
0
1.6449348958
1.6630338542
1.6605772569
1.6500824653
3.4554564564
0
1.6839409722
1.6495399306
1.6393663194
1.6684244792
------------
--------- so on
How can i do this using Fast Fourier transform
thanks
Try this and let me know if it helped you. You can use time
module to introduce the delay in seconds in an outer while
loop and then check for the condition if the signal is greater than the threshold if yes then print it and also append it to a list bits_per_min
. Example code shown below.
import time
threshold = 2.8 # Threshold to do something if value is more than to that.
seconds = 0
counter = 0
while seconds != 60:
bits_per_min = [] # this part of code runs for one min duration
if signal >= threshold: # to compare if signal is greater than the threshold value
print signal
bits_per_min.append(signal)
counter += 1
time.sleep(1)
seconds += 1
print bits_per_min
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.