Code Monkey home page Code Monkey logo

img2net's Issues

Some file paths seem to be fixed and not dependent on the file system where this git project is cloned

Hi, I was trying to run the test file, and I found a couple of issues. First, when running the test python test_img2net.py I get the following output:

carlose@GLaDOS:~/GitProjects/Img2net/code/test$ python test_img2net.py 
Traceback (most recent call last):
  File "test_img2net.py", line 6, in <module>
    import img2net
  File "/home/carlose/GitProjects/Img2net/code/test/../img2net-core/img2net.py", line 10, in <module>
    import filtering
  File "/home/carlose/GitProjects/Img2net/code/test/../img2net-core/filtering.py", line 14, in <module>
    with open("/Users/dtheuerkauf/Nextrout/nextrout_location.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/dtheuerkauf/Nextrout/nextrout_location.txt'

After changing it to point to where I cloned Nextrout (in the same directory as Img2net) I stop getting that error, but I get another one:

carlose@GLaDOS:~/GitProjects/Img2net/code/test$ python test_img2net.py 
root /home/carlose/GitProjects/Nextrout
Global repo non found
Traceback (most recent call last):
  File "test_img2net.py", line 6, in <module>
    import img2net
  File "/home/carlose/GitProjects/Img2net/code/test/../img2net-core/img2net.py", line 10, in <module>
    import filtering
  File "/home/carlose/GitProjects/Img2net/code/test/../img2net-core/filtering.py", line 28, in <module>
    import meshtools as mt
ModuleNotFoundError: No module named 'meshtools'

Looking into this, I found that the file "Img2net/code/img2net-core/filtering.py" refers to the dmk utilities cloned when running Nextrout in a directory called "dmk", while Nextrout clones them into the directory "dmk_utilities".

After changing references to ".../dmk/..." to ".../dmk_utilities/...", the example seems to work, but I do get a path printed which I don't think exists in my machine: /home/dtheuerkauf/Nextrout/python_scripts/, and I also get the following message printed: rm: cannot remove '../../data/output/test/angolan_river_crop/nextrout/': No such file or directory.
I feel like this is an issue of making a few paths be relative instead of fixed, but I don't know enough python yet to confidently submit a branch with a proposal. Let me know if you need more information on the results of what I ran.

Thanks for your time

Too many relative paths make the exec of `test_img2net.py` break

Change the following snippet of code inside filtering.py:

# Now you can use the 'root' variable to construct the path to nextrout_location.txt
nextrout_location_file = os.path.join(root, "nextrout_location.txt")

with open(nextrout_location_file) as f:
    lines = f.readlines()

# Import I/O for timedata
try:
    sys.path.append(root + "/../dmk/globals/python/timedata/")
    import timedata as td
except:
    print("Global repo non found")

# Import geometry tools
sys.path.append(root + "/../dmk/geometry/python/")
import meshtools as mt

sys.path.append(root + "/../dmk/dmk_solver/otp_solver/preprocess/assembly/")
import example_grid

# Import dmk tools
sys.path.append(root + "/../dmk/dmk_solver/otp_solver/python/")
import dmk_p1p0

sys.path.append(
    root + "/../dmk/dmk_solver/build/python/fortran_python_interface/"
)

Missing `Global` dir and `meshtools` pkg

There's a problem with meshtools needed from Nextrout, together with the Global dir needed from Gitlab dmk source code:

Global repo non found
Traceback (most recent call last):
  File "test_img2net.py", line 6, in <module>
    import img2net
  File "/home/dtheuerkauf/Contributions/Img2net/code/test/../img2net-core/img2net.py", line 10, in <module>
    import filtering
  File "/home/dtheuerkauf/Contributions/Img2net/code/test/../img2net-core/filtering.py", line 32, in <module>
    import meshtools as mt
ModuleNotFoundError: No module named 'meshtools'

What to do about it? Improved the way the requirements from Nextrout are presented, so it is more easily installable.

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.