Skip to content

Commit a4d59f3

Browse files
committed
iir: Rename to emlearn_iir
1 parent 15d072c commit a4d59f3

File tree

10 files changed

+24
-24
lines changed

10 files changed

+24
-24
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ $(MODULES_PATH)/emlearn_trees.mpy:
1616
$(MODULES_PATH)/emlearn_neighbors.mpy:
1717
make -C src/emlearn_neighbors/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
1818

19-
$(MODULES_PATH)/emliir.mpy:
20-
make -C src/emliir/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
19+
$(MODULES_PATH)/emlearn_iir.mpy:
20+
make -C src/emlearn_iir/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
2121

2222
$(MODULES_PATH)/emlearn_fft.mpy:
2323
make -C src/emlearn_fft/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean dist
@@ -40,7 +40,7 @@ emlearn_trees.results: $(MODULES_PATH)/emlearn_trees.mpy
4040
emlearn_neighbors.results: $(MODULES_PATH)/emlearn_neighbors.mpy
4141
MICROPYPATH=$(MODULES_PATH) $(MICROPYTHON_BIN) tests/test_neighbors.py
4242

43-
emliir.results: $(MODULES_PATH)/emliir.mpy
43+
emlearn_iir.results: $(MODULES_PATH)/emlearn_iir.mpy
4444
MICROPYPATH=$(MODULES_PATH) $(MICROPYTHON_BIN) tests/test_iir.py
4545

4646
emlearn_fft.results: $(MODULES_PATH)/emlearn_fft.mpy
@@ -63,7 +63,7 @@ emlearn_arrayutils.results: $(MODULES_PATH)/emlearn_arrayutils.mpy
6363
clean:
6464
make -C src/emlearn_trees/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean
6565
make -C src/emlearn_neighbors/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean
66-
make -C src/emliir/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean
66+
make -C src/emlearn_iir/ ARCH=$(ARCH) MPY_DIR=$(MPY_DIR_ABS) V=1 clean
6767
rm -rf ./dist
6868

6969
RELEASE_NAME = emlearn-micropython-$(VERSION)
@@ -74,8 +74,8 @@ release:
7474
zip -r $(RELEASE_NAME).zip $(RELEASE_NAME)
7575
#cp $(RELEASE_NAME).zip emlearn-micropython-latest.zip
7676

77-
check: emlearn_trees.results emlearn_neighbors.results emliir.results emlearn_iir_q15.results emlearn_fft.results emlearn_kmeans.results emlearn_arrayutils.results emlearn_cnn.results
77+
check: emlearn_trees.results emlearn_neighbors.results emlearn_iir.results emlearn_iir_q15.results emlearn_fft.results emlearn_kmeans.results emlearn_arrayutils.results emlearn_cnn.results
7878

79-
dist: $(MODULES_PATH)/emlearn_trees.mpy $(MODULES_PATH)/emlearn_neighbors.mpy $(MODULES_PATH)/emliir.mpy $(MODULES_PATH)/emlearn_iir_q15.mpy $(MODULES_PATH)/emlearn_fft.mpy $(MODULES_PATH)/emlearn_kmeans.mpy $(MODULES_PATH)/emlearn_arrayutils.mpy $(MODULES_PATH)/emlearn_cnn.mpy
79+
dist: $(MODULES_PATH)/emlearn_trees.mpy $(MODULES_PATH)/emlearn_neighbors.mpy $(MODULES_PATH)/emlearn_iir.mpy $(MODULES_PATH)/emlearn_iir_q15.mpy $(MODULES_PATH)/emlearn_fft.mpy $(MODULES_PATH)/emlearn_kmeans.mpy $(MODULES_PATH)/emlearn_arrayutils.mpy $(MODULES_PATH)/emlearn_cnn.mpy
8080

8181

benchmarks/iir/iir_benchmark.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
print(e)
1515
pass
1616

17-
emliir = None
17+
emlearn_iir = None
1818
try:
19-
import emliir
19+
import emlearn_iir
2020
except ImportError as e:
2121
print(e)
2222
pass
@@ -70,9 +70,9 @@ def main():
7070
print('ulab', t)
7171

7272
# emlearn
73-
if emliir:
73+
if emlearn_iir:
7474
start = time.ticks_us()
75-
iir = emliir.new(coeff)
75+
iir = emlearn_iir.new(coeff)
7676
for r in range(repeats):
7777
iir.run(a)
7878
t = (time.ticks_diff(time.ticks_us(), start) / repeats ) / 1000.0 # ms

benchmarks/iir/iir_run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def iir_process_file(inp, out, filters, chunksize):
2727
if len(reader.shape) != 1:
2828
raise ValueError("Input must be 1d")
2929
if reader.typecode == 'f':
30-
import emliir
31-
filter = emliir.new(coefficients)
30+
import emlearn_iir
31+
filter = emlearn_iir.new(coefficients)
3232
elif reader.typecode == 'h':
3333
import emlearn_iir_q15
3434
filter = emlearn_iir_q15.new(coefficients)

doc/micropython-tinyml-status.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ FIR filters.
167167

168168
IIR filters.
169169
`scipy.signal.sosfilt` available in [ulab](https://github.com/v923z/micropython-ulab).
170-
`emliir` available in [emlearn-micropython](https://github.com/emlearn/emlearn-micropython).
170+
`emlearn_iir` available in [emlearn-micropython](https://github.com/emlearn/emlearn-micropython).
171171

172172
### Fast Fourier Transform (FFT)
173173
Key part of computing frequency spectrum, or time-frequency representations (spectrogram).

examples/soundlevel_iir/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ sound level meter used for noise measurements:
2525

2626
The following emlearn functionality are used in the implementation:
2727

28-
- `emliir`. IIR filters to implement the A weighting filter
28+
- `emlearn_iir`. IIR filters to implement the A weighting filter
2929
- `emlearn_arrayutils.linear_map()`. To convert array values between `float` and `int16`
3030

3131

@@ -83,7 +83,7 @@ pip install -r requirements.txt
8383
Install the emlearn modules
8484
```console
8585
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_arrayutils.mpy
86-
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emliir.mpy
86+
micropython -m mip install https://emlearn.github.io/emlearn-micropython/builds/master/x64_6.3/emlearn_iir.mpy
8787
```
8888

8989
Compute soundlevels for a file
@@ -103,7 +103,7 @@ Ensure you have an I2S microphone, and that the pinout is correct in `soundlevel
103103
Install the emlearn modules *for your architecture*. ESP32=xtensawin
104104
```console
105105
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_arrayutils.mpy
106-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emliir.mpy
106+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_iir.mpy
107107
```
108108

109109
Copy example code to the device
@@ -191,7 +191,7 @@ WIFI_PASSWORD = 'MY WIFI PASSWORD'
191191
Install the emlearn modules *for your architecture*. ESP32=xtensawin
192192
```console
193193
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_arrayutils.mpy
194-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emliir.mpy
194+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_iir.mpy
195195
```
196196

197197
Copy example to the device
@@ -220,7 +220,7 @@ So the example can be adapted to other displays supported by that framework.
220220
Install the emlearn modules *for your architecture*. ESP32=xtensawin
221221
```console
222222
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_arrayutils.mpy
223-
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emliir.mpy
223+
mpremote mip install https://emlearn.github.io/emlearn-micropython/builds/master/xtensawin_6.3/emlearn_iir.mpy
224224
```
225225

226226
Install UI framework and screen driver

examples/soundlevel_iir/soundlevel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import array
55
from collections import deque
66

7-
import emliir
7+
import emlearn_iir
88
from emlearn_arrayutils import linear_map
99
#import emlearn_iir_q15
1010
#from iir_python import IIRFilter
@@ -13,7 +13,7 @@ class IIRFilterEmlearn:
1313

1414
def __init__(self, coefficients):
1515
c = array.array('f', coefficients)
16-
self.iir = emliir.new(c)
16+
self.iir = emlearn_iir.new(c)
1717
def process(self, samples):
1818
self.iir.run(samples)
1919

src/emliir/Makefile renamed to src/emlearn_iir/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EMLEARN_DIR := $(shell python3 -c "import emlearn; print(emlearn.includedir)")
1414
DIST_DIR := ../../dist/$(ARCH)_$(MPY_ABI_VERSION)
1515

1616
# Name of module
17-
MOD = emliir
17+
MOD = emlearn_iir
1818

1919
# Source files (.c or .py)
2020
SRC = iir_filter.c
File renamed without changes.

src/emlearn_iir_q15/iir_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def convert_coefficients(c, scale=(2**13)-1):
77
assert (len(c) % 6 == 0), len(c)
88
n_stages = len(c) // 6
99

10-
# Transposed Direct Form II / sosfilt / emliir
10+
# Transposed Direct Form II / sosfilt / emlearn_iir
1111
# [ b0, b1, b2, 1.0, -a1, -a2 ]
1212
# Direct Form I / emlearn_iir_q15
1313
# [ b0, 0, b1, b2, a1, a2 ]

tests/test_iir.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import emliir
2+
import emlearn_iir
33

44
import array
55
import gc
@@ -26,7 +26,7 @@ def test_iir_del():
2626
-1.999111423794296,
2727
0.9991118187443988
2828
])
29-
model = emliir.new(coefficients)
29+
model = emlearn_iir.new(coefficients)
3030
after_new = gc.mem_alloc()
3131
added = after_new - before_new
3232

0 commit comments

Comments
 (0)