Universite-Gustave-Eiffel / I-Simpa

An Open Source software for 3D sound propagation modelling
https://i-simpa.univ-gustave-eiffel.fr/
GNU General Public License v3.0
234 stars 57 forks source link

Python Gabe_rw.ToList() not working #112

Open wbinek opened 7 years ago

wbinek commented 7 years ago

I've tried running script spps_conversion_resultats.py script (from python_bindings/samples) but I have problem with Gabe_rw.ToList mehod. It returns:

>>> data=reader.ToList()

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\I-SIMPA\libsimpa\__init__.py", line 17, in ToList
    func_binding={ GABE_OBJECTTYPE.GABE_OBJECTTYPE_SHORTSTRING : self.ReadColStr,
NameError: global name 'GABE_OBJECTTYPE' is not defined

I've tried it both on mine and yours build.

nicolas-f commented 7 years ago

Thanks for the report, it seems that this class has not survived the transition from boost python to swig. I will looking at it.

wbinek commented 7 years ago

Thanks. I found that I can go around it using Gabe_rw.ReadCol() and array objects from libsimpa.

wbinek commented 7 years ago

I've changed the ToList() method in init file to:

def ToList(self):
    """
        Retourne les données sous forme de listes python
    """
    lstret=[]
    for idcol in range(0,self.size()):
        lstret.append([ self.GetColTitle(idcol)] + list(self.Index(idcol)))
    return lstret                    

setattr(Gabe_rw,"ToList",ToList)

This works fine, but float values are truncated. I think it not a problem as usually such high precision isn't needed. I couldn't figure out how to use GetTabTypes() mehtod as it returned only pointers to gabe_io::COLTYPE *.

wbinek commented 7 years ago

I wrote GabeToCsv script based on the example. It supports both file and folder processing. https://github.com/d-cooper/I-Simpa/commit/3d8c86bc1430e4b1e019df1a3e25a0f021fe8233 and https://github.com/d-cooper/I-Simpa/commit/fed54742b69843a726d4c9283bbbfde8c9292130