Skip to content

Commit 60f22e0

Browse files
Improvements to Python wrapper and corrections for distance and window.
2 parents 5f5086f + 82d9415 commit 60f22e0

File tree

10 files changed

+42
-50
lines changed

10 files changed

+42
-50
lines changed

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ include PythonWrapper_README.md
22
recursive-include Include *.h
33
recursive-include PrivateInclude *.h
44
recursive-include PythonWrapper/cmsisdsp_pkg/src *.h
5-
include cmsisdsp/cg/scheduler/templates/*
65
include Source/DistanceFunctions/arm_boolean_distance_template.h
76

PythonWrapper/build/create.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake -DHOST=YES ^
22
-DLOOPUNROLL=ON ^
33
-DWRAPPER=YES ^
4-
-DCMSISDSP="path to CMSIS-DSP folder" ^
4+
-DCMSISDSP=".." ^
55
-DCMAKE_C_FLAGS_RELEASE="-std=c11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra" ^
66
-DCMAKE_CXX_FLAGS_RELEASE="-fno-rtti -std=c++11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra -Wno-unused-parameter" ^
77
-G "Unix Makefiles" ..

PythonWrapper/build_linux/create.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ cmake -DHOST=YES \
22
-DLOOPUNROLL=ON \
33
-DWRAPPER=YES \
44
-DCMAKE_POSITION_INDEPENDENT_CODE=YES \
5-
-DCMSISDSP="path to CMSIS-DSP folder" \
5+
-DCMSISDSP=".." \
66
-DCMAKE_C_FLAGS_RELEASE="-std=c11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra" \
77
-DCMAKE_CXX_FLAGS_RELEASE="-fno-rtti -std=c++11 -Ofast -ffast-math -DNDEBUG -Wall -Wextra -Wno-unused-parameter" \
88
-G "Unix Makefiles" ..
99

1010
# For Mac universal lib
11-
# -arch x86_64 -arch arm64 -mmacosx-version-min=11.0
11+
# -arch x86_64 -arch arm64 -mmacosx-version-min=11.0

PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_distance.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ cmsis_arm_dtw_init_window_q7(PyObject *obj,
227227
arm_matrix_instance_q7 pSrc_converted; // input
228228

229229

230-
if (PyArg_ParseTuple(args,"iiO",&winType,&winSize,&pSrc));
230+
if (PyArg_ParseTuple(args,"iiO",&winType,&winSize,&pSrc))
231231
{
232232

233233
q7MatrixFromNumpy(&pSrc_converted,pSrc);
@@ -267,7 +267,7 @@ cmsis_arm_dtw_distance_f32(PyObject *obj,
267267
arm_matrix_instance_f32 dtw_converted;
268268

269269

270-
if (PyArg_ParseTuple(args,"OO",&pDist,&pWin));
270+
if (PyArg_ParseTuple(args,"OO",&pDist,&pWin))
271271
{
272272

273273
f32MatrixFromNumpy(&pDist_converted,pDist);
@@ -348,7 +348,7 @@ cmsis_arm_dtw_path_f32(PyObject *obj,
348348
Py_DECREF(pDstOBJ);
349349
return(pythonResult);
350350
}
351-
351+
Py_RETURN_NONE;
352352
}
353353

354354
static PyMethodDef CMSISDSPMethods[] = {
@@ -450,4 +450,4 @@ void CAT(init,MODINITNAME)(void)
450450
#ifdef IS_PY3K
451451
return module;
452452
#endif
453-
}
453+
}

PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
#include <numpy/numpyconfig.h>
3333

3434
// API version used on google colab
35-
// List on https://github.com/numpy/numpy/blob/main/numpy/core/include/numpy/numpyconfig.h
35+
// List in https://github.com/numpy/numpy numpyconfig.h
3636
#if (NPY_API_VERSION != 0x0000000F )
37-
#error("Error building with wrong NumPy API version")
37+
//#error("Error building with wrong NumPy API version")
3838
#endif
3939

4040
#ifdef WIN

PythonWrapper/cmsisdsp_pkg/src/cmsisdsp_window.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ cmsis_arm_welch_f64(PyObject *obj, PyObject *args)
7272
{
7373

7474

75-
float32_t *pDst=NULL; // output
75+
float64_t *pDst=NULL; // output
7676
int nb; // input
7777

7878
if (PyArg_ParseTuple(args,"i",&nb))
@@ -125,7 +125,7 @@ cmsis_arm_bartlett_f64(PyObject *obj, PyObject *args)
125125
{
126126

127127

128-
float32_t *pDst=NULL; // output
128+
float64_t *pDst=NULL; // output
129129
int nb; // input
130130

131131
if (PyArg_ParseTuple(args,"i",&nb))
@@ -178,7 +178,7 @@ cmsis_arm_hamming_f64(PyObject *obj, PyObject *args)
178178
{
179179

180180

181-
float32_t *pDst=NULL; // output
181+
float64_t *pDst=NULL; // output
182182
int nb; // input
183183

184184
if (PyArg_ParseTuple(args,"i",&nb))
@@ -231,7 +231,7 @@ cmsis_arm_hanning_f64(PyObject *obj, PyObject *args)
231231
{
232232

233233

234-
float32_t *pDst=NULL; // output
234+
float64_t *pDst=NULL; // output
235235
int nb; // input
236236

237237
if (PyArg_ParseTuple(args,"i",&nb))
@@ -284,7 +284,7 @@ cmsis_arm_nuttall3_f64(PyObject *obj, PyObject *args)
284284
{
285285

286286

287-
float32_t *pDst=NULL; // output
287+
float64_t *pDst=NULL; // output
288288
int nb; // input
289289

290290
if (PyArg_ParseTuple(args,"i",&nb))
@@ -337,7 +337,7 @@ cmsis_arm_nuttall4_f64(PyObject *obj, PyObject *args)
337337
{
338338

339339

340-
float32_t *pDst=NULL; // output
340+
float64_t *pDst=NULL; // output
341341
int nb; // input
342342

343343
if (PyArg_ParseTuple(args,"i",&nb))
@@ -390,7 +390,7 @@ cmsis_arm_nuttall3a_f64(PyObject *obj, PyObject *args)
390390
{
391391

392392

393-
float32_t *pDst=NULL; // output
393+
float64_t *pDst=NULL; // output
394394
int nb; // input
395395

396396
if (PyArg_ParseTuple(args,"i",&nb))
@@ -443,7 +443,7 @@ cmsis_arm_nuttall3b_f64(PyObject *obj, PyObject *args)
443443
{
444444

445445

446-
float32_t *pDst=NULL; // output
446+
float64_t *pDst=NULL; // output
447447
int nb; // input
448448

449449
if (PyArg_ParseTuple(args,"i",&nb))
@@ -496,7 +496,7 @@ cmsis_arm_nuttall4a_f64(PyObject *obj, PyObject *args)
496496
{
497497

498498

499-
float32_t *pDst=NULL; // output
499+
float64_t *pDst=NULL; // output
500500
int nb; // input
501501

502502
if (PyArg_ParseTuple(args,"i",&nb))
@@ -549,7 +549,7 @@ cmsis_arm_blackman_harris_92db_f64(PyObject *obj, PyObject *args)
549549
{
550550

551551

552-
float32_t *pDst=NULL; // output
552+
float64_t *pDst=NULL; // output
553553
int nb; // input
554554

555555
if (PyArg_ParseTuple(args,"i",&nb))
@@ -602,7 +602,7 @@ cmsis_arm_nuttall4b_f64(PyObject *obj, PyObject *args)
602602
{
603603

604604

605-
float32_t *pDst=NULL; // output
605+
float64_t *pDst=NULL; // output
606606
int nb; // input
607607

608608
if (PyArg_ParseTuple(args,"i",&nb))
@@ -655,7 +655,7 @@ cmsis_arm_nuttall4c_f64(PyObject *obj, PyObject *args)
655655
{
656656

657657

658-
float32_t *pDst=NULL; // output
658+
float64_t *pDst=NULL; // output
659659
int nb; // input
660660

661661
if (PyArg_ParseTuple(args,"i",&nb))
@@ -708,7 +708,7 @@ cmsis_arm_hft90d_f64(PyObject *obj, PyObject *args)
708708
{
709709

710710

711-
float32_t *pDst=NULL; // output
711+
float64_t *pDst=NULL; // output
712712
int nb; // input
713713

714714
if (PyArg_ParseTuple(args,"i",&nb))
@@ -761,7 +761,7 @@ cmsis_arm_hft95_f64(PyObject *obj, PyObject *args)
761761
{
762762

763763

764-
float32_t *pDst=NULL; // output
764+
float64_t *pDst=NULL; // output
765765
int nb; // input
766766

767767
if (PyArg_ParseTuple(args,"i",&nb))
@@ -814,7 +814,7 @@ cmsis_arm_hft116d_f64(PyObject *obj, PyObject *args)
814814
{
815815

816816

817-
float32_t *pDst=NULL; // output
817+
float64_t *pDst=NULL; // output
818818
int nb; // input
819819

820820
if (PyArg_ParseTuple(args,"i",&nb))
@@ -867,7 +867,7 @@ cmsis_arm_hft144d_f64(PyObject *obj, PyObject *args)
867867
{
868868

869869

870-
float32_t *pDst=NULL; // output
870+
float64_t *pDst=NULL; // output
871871
int nb; // input
872872

873873
if (PyArg_ParseTuple(args,"i",&nb))
@@ -920,7 +920,7 @@ cmsis_arm_hft169d_f64(PyObject *obj, PyObject *args)
920920
{
921921

922922

923-
float32_t *pDst=NULL; // output
923+
float64_t *pDst=NULL; // output
924924
int nb; // input
925925

926926
if (PyArg_ParseTuple(args,"i",&nb))
@@ -973,7 +973,7 @@ cmsis_arm_hft196d_f64(PyObject *obj, PyObject *args)
973973
{
974974

975975

976-
float32_t *pDst=NULL; // output
976+
float64_t *pDst=NULL; // output
977977
int nb; // input
978978

979979
if (PyArg_ParseTuple(args,"i",&nb))
@@ -1026,7 +1026,7 @@ cmsis_arm_hft223d_f64(PyObject *obj, PyObject *args)
10261026
{
10271027

10281028

1029-
float32_t *pDst=NULL; // output
1029+
float64_t *pDst=NULL; // output
10301030
int nb; // input
10311031

10321032
if (PyArg_ParseTuple(args,"i",&nb))
@@ -1079,7 +1079,7 @@ cmsis_arm_hft248d_f64(PyObject *obj, PyObject *args)
10791079
{
10801080

10811081

1082-
float32_t *pDst=NULL; // output
1082+
float64_t *pDst=NULL; // output
10831083
int nb; // input
10841084

10851085
if (PyArg_ParseTuple(args,"i",&nb))

PythonWrapper_README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ The signal processing chain can thus be tested and developed in a Python environ
1111
A tutorial is also available but with less details than this README:
1212
https://developer.arm.com/documentation/102463/latest/
1313

14-
This wrapper is also containing the scripts for the new [CMSIS-DSP compute graph framework](https://github.com/ARM-software/CMSIS-DSP/tree/main/ComputeGraph) (CG).
15-
16-
CG is also including some nodes to communicate with Modelica using the VHT Modelica blocks developed as part of our [VHT-SystemModeling](https://github.com/ARM-software/VHT-SystemModeling) demos.
17-
1814
An history of the changes to this wrapper is available at the end of the README.
1915

2016
# How to build and install
2117

2218
## Tested configurations
2319

24-
The building of this package has been tested on Windows with the Python install from python.org and Microsoft Visual 2017.
20+
The building of this package has been tested on Windows with the Python install from python.org and Microsoft Visual Studio 2022 and on Ubuntu 22.04.
2521

2622
It has also been tested with `cygwin`. In that case, `python-devel` must be installed too. On Mac, it was tested with standard XCode installation.
2723

@@ -43,8 +39,6 @@ You must have a recent `pip` (to automatically install the dependencies like `Nu
4339

4440
DSP examples are available in the [CMSIS-DSP PythonWrapper examples](https://github.com/ARM-software/CMSIS-DSP/tree/main/PythonWrapper/examples) folder.
4541

46-
Synchronous Data Flow examples are available in the [ComputeGraph](https://github.com/ARM-software/CMSIS-DSP/tree/main/ComputeGraph) folder of [CMSIS-DSP](https://github.com/ARM-software/CMSIS-DSP) .
47-
4842
You can also install and run it from [Google colab](https://colab.research.google.com/):
4943

5044
This [link](https://colab.research.google.com/github/ARM-software/CMSIS-DSP/blob/main/PythonWrapper/examples/cmsisdsp_tests.ipynb) will open a Jupyter notebook in [Google colab](https://colab.research.google.com/) for testing. This notebook is from the [examples](https://github.com/ARM-software/CMSIS-DSP/tree/main/PythonWrapper/examples) in the CMSIS-DSP GitHub repository.
@@ -236,12 +230,15 @@ MEL filters are represented as 3 arrays to encode a sparse array.
236230

237231
`datatype` is an API on top of `fixedpoint` to provide more reuse when converting between data formats.
238232

239-
The wrapper is now containing the compute graph Python scripts and you should refer the the documentation in `DSP/ComputeGraph` folder to know how to use those tools.
240-
241233

242234

243235
# Change history
244236

237+
## Version 1.9.8:
238+
* Compute graph API has been removed
239+
* Dependency on numpy 1.22 has been lifted, tested through numpy 1.26
240+
* Inconsistencies in distance and window modules have been fixed.
241+
245242
## Version 1.9.7:
246243

247244
* Upgrade for compatibility with google colab

cmsisdsp/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Python wrapper version
2-
__version__ = "1.9.7"
2+
__version__ = "1.9.8"

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
requires = [
33
"setuptools>=42",
44
"wheel",
5-
"numpy>=1.22, < 1.23"
5+
"numpy>=1.22"
66
]
7-
build-backend = "setuptools.build_meta"
7+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,7 @@ def build():
160160

161161
setup (name = 'cmsisdsp',
162162
version = main_ns['__version__'],
163-
packages=["cmsisdsp",
164-
"cmsisdsp.cg",
165-
"cmsisdsp.cg.nodes",
166-
"cmsisdsp.cg.nodes.host",
167-
"cmsisdsp.cg.scheduler",
168-
"cmsisdsp.cg.scheduler.templates"],
163+
packages=["cmsisdsp"],
169164
description = 'CMSIS-DSP Python API',
170165
long_description=open("PythonWrapper_README.md").read(),
171166
long_description_content_type='text/markdown',
@@ -205,7 +200,8 @@ def build():
205200
"Intended Audience :: Developers",
206201
],
207202
keywords=['development','dsp','cmsis','cmsis-dsp','Arm','signal processing','maths','ml','cortex-m','cortex-a'],
208-
install_requires=['numpy>=1.22, < 1.23 ',
203+
install_requires=[
204+
'numpy>=1.22',
209205
'networkx>=3.0',
210206
'jinja2>= 3.1.2, <4.0',
211207
'sympy>=1.7.1',
@@ -218,4 +214,4 @@ def build():
218214
)
219215

220216

221-
build()
217+
build()

0 commit comments

Comments
 (0)