Giter Site home page Giter Site logo

Comments (6)

prisae avatar prisae commented on July 26, 2024

Thanks for reporting @jingxu94 . The entire construct_mesh()-functionality is very new, so unfortunately it is possible that there are bugs, even though I tried to avoid them ;-)

As I explained in our earlier discussion, I can currently not reproduce the problem, so I cannot do debugging myself. I will therefore ask some questions, it would be great if you could help me with that. Hopefully we will get to the bottom of it.

Could you try to run the following and post the output?

import emg3d
z0, hz = emg3d.meshes.get_origin_widths(
    frequency=1.0,
    min_width_limits=100.0,
    properties=[0.3, 2, 100],
    center=-1000,
    seasurface=0.0,
    domain=[-2500, 0],
    verb=2,
)

Just to ensure if the issue is in construct_mesh or in get_origin_widths.

from emg3d.

jingxu94 avatar jingxu94 commented on July 26, 2024

Similar error as follows:

Traceback (most recent call last):
  File "c:/Users/JingXu/Desktop/code/start_emg3d/model_property_mapping/test_issue.py", line 9, in <module>
    verb=2,
  File "D:\Anaconda3\envs\tdem\lib\site-packages\emg3d\meshes.py", line 626, in get_origin_widths
    thxr = hx[-1]*sa**np.arange(nx)
IndexError: index -1 is out of bounds for axis 0 with size 0

from emg3d.

prisae avatar prisae commented on July 26, 2024

That is really strange, I get the following without any issues:

Skin depth          [m] : 276 / 712 / 5033  [corresponding to `properties`]
Survey domain DS    [m] : -2500 - 0
Comp. domain DC     [m] : -6974 - 31623
Final extent        [m] : -8729 - 32628
Cell widths         [m] : 100 / 100 / 9085  [min(DS) / max(DS) / max(DC)]
Number of cells         : 48 (25 / 23 / 0)  [Total (DS/DC/remain)]
Max stretching          : 1.000 (1.000) / 1.380  [DS (seasurface) / DC]

I even recreated an environment fixing all the package versions to match yours, but I do not encounter the problem. I also tried it with pip and with conda, both work fine. The only difference that remains between your system and mine is Windows/Linux.

I will try and get hold of a Windows machine to test it.

from emg3d.

prisae avatar prisae commented on July 26, 2024

OK, I found the problem, it is a Windows issue. Int's default to 64 on Linux/Mac, but on Windows they default to 32. This caused an overflow problem in emg3d.meshes.good_mg_cell_nr.

If you change line 780 (emg3d v0.14.1) from

    primes = np.array([2, 3, 5, 7, 11, 13, 17, 19])

to

    primes = np.array([2, 3, 5, 7, 11, 13, 17, 19], dtype=np.int64)

the problem will be fixed.

I will push an update shortly.

Thanks for reporting!

from emg3d.

jingxu94 avatar jingxu94 commented on July 26, 2024

Thinks, it works. That's a helpful tip for programming!

from emg3d.

prisae avatar prisae commented on July 26, 2024

(With #144 I will hopefully start to also test on Windows and Mac machines, which should avoid these sort of issues in the future, hopefully.)

from emg3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.