kopia lustrzana https://github.com/bristol-seds/pico-tracker
New notebook for si_fir_filter
rodzic
a44a4efdcf
commit
5a5772499c
|
@ -1,20 +1,32 @@
|
|||
## Design of the Si TX Spectral Shaping Filter
|
||||
|
||||
It's a 17-tap digital FIR filter. No idea what the sample rate is, but
|
||||
it could be the IF? That's 400kHz or so..
|
||||
The SI contains a 17-tap digital FIR filter for use in GFSK modes.
|
||||
|
||||
We use this in aprs mode to filter the gpio squarewave into a sensible
|
||||
afsk signal.
|
||||
|
||||
There's some notes in a ipython notebook `si_fir_filter.ipynp` on
|
||||
this. This notebook is also used to calculate the deviation values.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
```
|
||||
sudo apt-get install ipython libblas-dev liblapack-dev gfortran
|
||||
pip install scipy matplotlib
|
||||
```
|
||||
|
||||
Yes you need a fortran compiler!!!
|
||||
|
||||
## Python Usage
|
||||
|
||||
`ipython --pylab`
|
||||
|
||||
`%run test.ipy`
|
||||
`ipython notebook`
|
||||
|
||||
## Calcuating new coefficients
|
||||
|
||||
There's an awesome calculator here
|
||||
[here](http://t-filter.appspot.com/fir/index.html)
|
||||
|
||||
## Sources
|
||||
## So
|
||||
|
||||
The python script is from
|
||||
[here](http://nbviewer.ipython.org/github/unpingco/Python-for-Signal-Processing/blob/master/Filtering.ipynb)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,57 +0,0 @@
|
|||
from __future__ import division
|
||||
from scipy import signal
|
||||
|
||||
fig, axs = subplots(2,1,sharex=True)
|
||||
subplots_adjust( hspace = .2 )
|
||||
fig.set_size_inches((5,5))
|
||||
|
||||
t_fir_coeff = [0.01665389596732681,
|
||||
0.07353658710395161,
|
||||
0.10040345335534452,
|
||||
0.04751332314075821,
|
||||
-0.06317967799551721,
|
||||
-0.09143711477971043,
|
||||
0.06319322564548596,
|
||||
0.31257963657965065,
|
||||
0.43524399610103215,
|
||||
0.31257963657965065,
|
||||
0.06319322564548596,
|
||||
-0.09143711477971043,
|
||||
-0.06317967799551721,
|
||||
0.04751332314075821,
|
||||
0.10040345335534452,
|
||||
0.07353658710395161,
|
||||
0.01665389596732681]
|
||||
|
||||
# Default si coefficients
|
||||
si_default_fir_coeff = [0x1, 0x3, 0x8, 0x11, 0x21, 0x36, 0x4d, 0x60, 0x67]
|
||||
|
||||
# Reflects an array of coefficients about the last element
|
||||
def sym_fir_coeff(coeff):
|
||||
for i in range(len(coeff)-2, -1, -1):
|
||||
coeff.append(coeff[i])
|
||||
|
||||
return coeff
|
||||
# Normalises the si's 8-bit coefficients to 0 - 1
|
||||
def si_normalise_coeff(coeff):
|
||||
return [x / 0x300 for x in coeff]
|
||||
|
||||
si_default = si_normalise_coeff(sym_fir_coeff(si_default_fir_coeff))
|
||||
|
||||
print si_default
|
||||
print len(si_default)
|
||||
|
||||
fir_coeff = si_default
|
||||
|
||||
ax=axs[0]
|
||||
w,h=signal.freqz(fir_coeff,1) # Compute impulse response
|
||||
ax.plot(w,20*log10(abs(h)))
|
||||
ax.set_ylabel(r"$20 \log_{10} |H(\omega)| $",fontsize=18)
|
||||
ax.grid()
|
||||
|
||||
ax=axs[1]
|
||||
ax.plot(w,angle(h)/pi*180)
|
||||
ax.set_xlabel(r'$\omega$ (radians/s)',fontsize=18)
|
||||
ax.set_ylabel(r"$\phi $ (deg)",fontsize=18)
|
||||
ax.set_xlim(xmax = pi)
|
||||
ax.grid()
|
Ładowanie…
Reference in New Issue