@@ -87,17 +87,25 @@ def doplot(B, A):
8787# 8/1054 with 0.2 leftover
8888bandpass = sps .firwin (55 , [.350 / NYQUIST_MHZ , 1.85 / NYQUIST_MHZ ], pass_zero = False )
8989
90+ # 5/1055 with 0.25 leftover scale
91+ bandpass = sps .firwin (55 , [.335 / NYQUIST_MHZ , 1.875 / NYQUIST_MHZ ], pass_zero = False )
92+ bandpass = sps .firwin (55 , [.335 / NYQUIST_MHZ , 1.870 / NYQUIST_MHZ ], pass_zero = False )
93+
9094# trying to follow cd player as reference - 79/825
9195#bandpass = sps.firwin(33, [.047/NYQUIST_MHZ, 1.59/NYQUIST_MHZ], pass_zero=False)
9296
9397data = sps .lfilter (bandpass , 1.0 , data )
94-
98+ offset = len ( bandpass ) / 2
9599#[b, a] = sps.zpk2tf([1/1590000.0], [0, 1/49700.0], 1.0)
96100#[bb, aa] = sps.bilinear(b, a, 1.0)
97101#doplot(bb, aa)
98102#exit()
99103
100- bandpassb , bandpassa = sps .butter (8 , [0.047 / NYQUIST_MHZ , 1.59 / NYQUIST_MHZ ], btype = 'bandpass' )
104+ bandpassb , bandpassa = sps .butter (3 , [0.047 / NYQUIST_MHZ , 1.59 / NYQUIST_MHZ ], btype = 'bandpass' )
105+ # 314/956
106+ bandpassb , bandpassa = sps .butter (4 , 1.59 / NYQUIST_MHZ , btype = 'lowpass' )
107+ # 339/959
108+ bandpassb , bandpassa = sps .butter (6 , 1.57 / NYQUIST_MHZ , btype = 'lowpass' )
101109#doplot(bandpassb, bandpassa)
102110#exit()
103111#plt.plot(data[5000:6000])
@@ -107,6 +115,25 @@ def doplot(B, A):
107115#plt.show()
108116#exit()
109117
118+ #t1 = 1; t2 = 32; [b, a] = bilinear(-t1*(10^-8), -t2*(10^-8), t2/t1, freq); freqz(b, a)
119+ # printf("f_emp_b = ["); printf("%.15e, ", b); printf("]\nf_emp_a = ["); printf("%.15e, ", a); printf("]\n")
120+ f_emp_b = [1.041988950276243e+01 , - 9.027624309392266e+00 , ]
121+ f_emp_a = [1.000000000000000e+00 , 3.922651933701657e-01 , ]
122+ #data = sps.lfilter(f_emp_b, f_emp_a, data)
123+
124+ #lowpass = sps.firwin(55, 1.870/NYQUIST_MHZ)
125+ #data = sps.lfilter(lowpass, 1.0, data)
126+
127+ highpassb , highpassa = sps .butter (1 , .010 / NYQUIST_MHZ , 'highpass' )
128+ #lowpassb, lowpassa = sps.butter(1, 1.59/NYQUIST_MHZ, 'lowpass')
129+ #lowpassb, lowpassa = sps.butter(3, 1.40/NYQUIST_MHZ)
130+ #data = sps.lfilter(highpassb, highpassa, data)
131+ #data = sps.lfilter(lowpassb, lowpassa, data)
132+
133+ #plt.plot(data[5000:6000])
134+ #plt.show()
135+ #exit()
136+
110137# filter to binary signal
111138data = (data > 0.0 )
112139
@@ -180,7 +207,9 @@ def doplot(B, A):
180207 leftover = 0
181208 for (value , duration ) in zip (runValues , runDurations ):
182209 #durationr = int(round(duration + (leftover * .111))) # to integer
183- durationr = int (round (duration + (leftover * 0.2 ))) # to integer
210+ #durationr = int(round(duration + (leftover * 0.22))) # to integer
211+ #durationr = int(round(duration + (leftover * 0.24))) # to integer
212+ durationr = int (round (duration + (leftover * 0.270 ))) # to integer
184213# durationr = int(round(duration)) # to integer
185214 leftover = duration - durationr
186215
0 commit comments