groupeLIAMG / ttcr

Codes to do raytracing for geophysical applications
GNU General Public License v3.0
85 stars 34 forks source link

ValueError: type mismatch in tmesh.Mesh2d #65

Closed bjornrommel closed 11 months ago

bjornrommel commented 12 months ago

https://github.com/groupeLIAMG/ttcr/blob/42cdc71f19bf3abe100a35718eaea7ae028ca0a6/src/ttcrpy/tmesh.pyx#L1228

Bernard,

I get a ValueError when running your example 5 inside Spyder.

Traceback (most recent call last):

File ~\AppData\Local\Programs\Anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)

File c:\users\bjorn\documents\projekt\ambiguity\example5.py:199 mesh = Mesh2d(nodes, triangles.astype(int), method='SPM', n_secondary=10, aniso='weakly_anelliptical')

File src\ttcrpy\tmesh.pyx:1228 in ttcrpy.tmesh.Mesh2d.cinit

ValueError: Buffer dtype mismatch, expected 'int64_t' but got 'long'

I am confused as Jupyter works fine???

Pylint also reports an Error

E0611(no-name-in-module) ... No name 'Mesh2d' in module 'tt.crpy.tmesh'

but that could be due to a missing __init__.py' in the directory scr.

Björn

bernard-giroux commented 11 months ago

Hi,

Please try editing the notebook to read

mesh = Mesh2d(nodes, triangles.astype(np.int64),

instead of

mesh = Mesh2d(nodes, triangles.astype(int),

For the second error, there must have been a . that has been added between tt and crpy, you shoud have ttcrpy