pyomeca / ezc3d

Easy to use C3D reader/writer for C++, Python and Matlab
https://pyomeca.github.io/Documentation/ezc3d/index.html
MIT License
142 stars 44 forks source link

Error in writing a c3d file: TypeError: Wrong number or type of arguments for overloaded function 'c3d_point'. #238

Closed NLantos closed 2 years ago

NLantos commented 2 years ago

Hello,

From a c3d file generated by Optitrack, I read the file with ezc3d. Everything goes without problem. (Remark: the reading of the 3.06 GB file is a bit long, about 6 minutes. I don't know if this is normal). Then I cut the data in 5 pieces and try to rewrite 5 smaller files. I've already apply this on a number of c3d files and it works fine, but not on this one where you get the following error:

Traceback (most recent call last): File "/Users/lantos/PycharmProjects/Expe_Stage_Kelly/run_PP_ezc3d.py", line 161, in c_i.write(output_filename) File "/opt/miniconda3/lib/python3.9/site-packages/ezc3d/init.py", line 505, in write new_c3d.point(point_label) File "/opt/miniconda3/lib/python3.9/site-packages/ezc3d/ezc3d.py", line 1752, in point return _ezc3d.c3d_point(self, *args) TypeError: Wrong number or type of arguments for overloaded function 'c3d_point'. Possible C/C++ prototypes are: ezc3d::c3d::point(std::string const &) ezc3d::c3d::point(std::string const &,std::vector< ezc3d::DataNS::Frame,std::allocator< ezc3d::DataNS::Frame > > const &) ezc3d::c3d::point(std::vector< std::string,std::allocator< std::string > > const &) ezc3d::c3d::point(std::vector< std::string,std::allocator< std::string > > const &,std::vector< ezc3d::DataNS::Frame,std::allocator< ezc3d::DataNS::Frame > > const &)

My configuration is a Macbook pro 2.6 GHz Intel Core i7 4 cores and Python 3.9. ezc3d was installed with miniconda. I can send you the script with the necessary files.

Thanks in advance.

pariterre commented 2 years ago

Hi @NLantos I would not be surprised that a file that huge takes time to read. Six minutes seem a bit long though. If you compiled by yourself, did you compile using Release or Debug level? That may explain that it is slower that usual.

For your problem, this is a very generic message generated by the wrapper SWIG. When you call a C function from Python interface by SWIG, it creates some entry points (in that case, the method point can be called using str, str, np.array, [str] or [str], np.array). It basically tells you that you did not call the method with proper input parameter.

I suspect your point_label variable is a None or a non-expected value such as an int, but wihtout actual code, it is impossible to tell

NLantos commented 2 years ago

Thanks for your answer. ezc3d was installed in its default version with miniconda. I can send you the code if you wish via wetransfer or a similar service.

pariterre commented 2 years ago

Yep that could help :)

NLantos commented 2 years ago

I uploaded the case to wetransfer last night via your hotmail address. Let me know if you get it.

pariterre commented 2 years ago

I received the email! Thanks :)

pariterre commented 2 years ago

Dear @NLantos I tried the snippet you sent me, but it did not raise any error. I suspect the error you had was related to #233 and is therefore already fixed!

NLantos commented 1 year ago

Hi @pariterre , With much delay, I apologize but I worked on other project since. Anyway, I just downloaded the version 1.5.0 of ezc3d to retest and unfortunately, I fall on the same error:

ezc3d 1.5.0 input_filename 0_Inputs/4_Optitrack/P5/bloc4_orientation_ok.c3d Reading ezc3d 2022-09-15 17:15:54.870817 time Reading 0:07:05.175539 point_rate [30.00109482] 1./point_rate [0.03333212] point_count 12058 Nb frames 15873

i_di 1 t[0] 4.129003896871177 t[-1] 533.1763635424326 (4, 12058, 244) Traceback (most recent call last): File "/Users/lantos/PycharmProjects/Expe_Stage_Kelly/run_PP_ezc3d.py", line 122, in c_i.write(output_filename) File "/opt/miniconda3/lib/python3.9/site-packages/ezc3d/init.py", line 539, in write new_c3d.point(point_label) File "/opt/miniconda3/lib/python3.9/site-packages/ezc3d/ezc3d.py", line 1971, in point return _ezc3d.c3d_point(self, *args) TypeError: Wrong number or type of arguments for overloaded function 'c3d_point'. Possible C/C++ prototypes are: ezc3d::c3d::point(std::string const &) ezc3d::c3d::point(std::string const &,std::vector< ezc3d::DataNS::Frame,std::allocator< ezc3d::DataNS::Frame > > const &) ezc3d::c3d::point(std::vector< std::string,std::allocator< std::string > > const &) ezc3d::c3d::point(std::vector< std::string,std::allocator< std::string > > const &,std::vector< ezc3d::DataNS::Frame,std::allocator< ezc3d::DataNS::Frame > > const &)

Is it possible that the patch of correction is not integrated in the new version? Thanks in advance