libigl-python-bindings
libigl-python-bindings copied to clipboard
How to serialize from Xcode and deserialize from python
Hey, I'm trying to serialize from Xcode and deserialize from python. I fail to find the interface to deserialize from python. Can you please refer to some example? Best, Anna
Originally posted by @stigersh in https://github.com/libigl/libigl/issues/496#issuecomment-1104841542
Hi,
In the new version of python binding, serialization is not yet implemented. I would recommend using pickle/numpy in a pure python environment, and use hdf5 in a mixed C++/python environment
Thanks for the quick reply
I found https://github.com/garrison/eigen3-hdf5 for eigen to hdf5, but I still need to come up with some convention parsing it from python into numpy - like saving matrix size, if it's sparse and so on.. Right?
How can I use the old interface? May be it's easier.. It's very convenient for debugging matrices in python vs Xcode
Hi Anna,
The tools I personally use is https://github.com/BlueBrain/HighFive on the C++ side and https://pypi.org/project/h5py/ on the python side (this is very good)
But admittedly dense matrices are not supported very well, you need a separate parser of the indices.
If you really want to use the old pipeline, there are two ways to go
- Use the legacy version of libigl (release from circa 2018), not recommended.
- Use pybind11 to wrap a python interface. https://pybind11.readthedocs.io/en/stable/
- @teseoch how much effort it is to add deserialize function in the new python binding? Would there be confusion about class names, layout etc?
my workaround was serialize through matfiles which can be read from python
I'm personally not going to add the serialization bindings. Happy to merge a PR if someone else does.