|
Last change
on this file was 13331, checked in by neise, 14 years ago |
|
added first unit test of fir_filter module - use py.test to conduct it
|
-
Property svn:executable
set to
*
|
|
File size:
537 bytes
|
| Line | |
|---|
| 1 | #!/usr/bin/python -tt
|
|---|
| 2 | #
|
|---|
| 3 | # Dominik Neise, Werner Lustermann
|
|---|
| 4 | # TU Dortmund, ETH Zurich
|
|---|
| 5 | #
|
|---|
| 6 | import numpy as np
|
|---|
| 7 | from scipy import signal
|
|---|
| 8 | import fir_filter
|
|---|
| 9 |
|
|---|
| 10 | def test_SlidingAverage():
|
|---|
| 11 | """ test the sliding average function
|
|---|
| 12 | A constant input should result in a constant and equal output
|
|---|
| 13 | """
|
|---|
| 14 | safilter = fir_filter.SlidingAverage(8)
|
|---|
| 15 | signal = np.ones(100) * 3.0
|
|---|
| 16 | filtered = safilter(signal)
|
|---|
| 17 | assert (filtered == signal).all()
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | if __name__ == '__main__':
|
|---|
| 21 | """ conduct the tests """
|
|---|
| 22 |
|
|---|
| 23 | test_SlidingAverage()
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.