Hello All,
Is a Python version of k-Wave possible? If so, has someone implemented it in Python? If not, I am trying to figure out the smallest possible set of functions I can implement on my own to do this.
Thanks
Hello All,
Is a Python version of k-Wave possible? If so, has someone implemented it in Python? If not, I am trying to figure out the smallest possible set of functions I can implement on my own to do this.
Thanks
Hi rehmanali1994,
I don't think so. Actually, what benefit against Matlab should that bring? No Matlab license needed? Higher speed than Matlab/C++(very unlikely)? Faster development than Matlab (questionable) / C++ (maybe)?
I have been thinking of implementing the framework in python, however, all computational kernels would still have to be implemented in C++/CUDA. Otherwise, the Python implementation will be 100x slower than Matlab!
If you wanted to code your own Python k-Wave to give it a try, I recommend to take a look at the C++ version of the code. Recoding will be very straightforward, but as I said, FFTW/MKL and C++ kernels (numpy?) would have to be used to get any reasonable execution time.
Best
Jiri
Hi Jiri,
Rewriting k-Wave in Python wouldn't make much sense as you pointed out. However being able to call the C++/CUDA k-Wave from Python to essentially remove Matlab from the equation would be very useful.
-G
Hi,
I agree with G. I think a script to generate input.h5 and call C++ binary and read output.h5 back into Python would be sufficient. Should not be that difficult if once HDF5 structure is known. Can be a contribution of a user as well.
Umit,
Hi Umit,
We now have a prototype version of code to save the input file from Python. See this topic for the download link.
Brad.
As an alternative, embedding Matlab in Python is officially supported since some time. So your Python code can just prepare parameters and input data, and then call a Matlab function/script directly in Python and the recover the data. If saving in Matlab 7.0 file format, scipy can read it with out too much trouble. Even reading from the new 7.3 format is quite easy do using h5py as 7.3 is based on HDF5.
Hi all,
I will be releasing a ported version of kWave in Python shortly on GitHub. I would be happy to receive feedback on the draft. This version goes beyond the prototype to generate files and takes an object oriented approach in python to generating the h5 files. We tried to remain true to the architecture, but modified it in some places to reduce complexity. To ensure compatibility, we test the python implementation on all of the examples listed on the website by comparing the generated h5 files in both cases.
Currently, the elastic simulation, and temperature simulations have been omitted, from the python version.
Looking forward to your feedback.
Best,
Walter
Also @Jiri, I believe GPU acceleration in native python could be achieved with something like [numba](http://numba.pydata.org/), but We have omitted this for now for the sake of simplicity.
Thanks for your efforts with this Walter - looking forward to having a play!
Hi all,
the k-Wave python package is now available on PYPI. Here is the link to the package. If you have any questions or issues, please open an issue on Github or ask in the dedicated telegram channel.
https://pypi.org/project/k-Wave-python/
Looking forward to your feedback,
Walter
As a follow up, the project is still being actively developed. Here is the link to our GitHub repo!
Hi All,
as a follow-up, k-wave-python now supports MacOS out of the box in the latest release.
Hope you find this helpful!
Best,
Walter
You must log in to post.