org-arl / arlpy

ARL Python Tools
BSD 3-Clause "New" or "Revised" License
118 stars 37 forks source link

Bellhop throws an unexpected error with arlpy default env file #73

Closed patel999jay closed 8 months ago

patel999jay commented 2 years ago

I am trying to trace an error that bellhop is throwing when it takes arlpy default env file.

I don't think it is running bellhop incorrectly because the print file with and without arlpy are exactly same.

Here is what i am using right now to test this:

jay@jay-VirtualBox:/tmp$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
jay@jay-VirtualBox:/tmp$ python3 --version
Python 3.10.4

When I called the pm.models() from python or in ipython terminal. bellhop returns with the error that STOP Fatal Error: Check the print file for details

jay@jay-VirtualBox:~$ ipython3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 
   ...: import arlpy.uwapm as pm
   ...: import arlpy.plot as plt
   ...: import numpy as np
   ...: import pandas as pd

In [2]: 
   ...: 
   ...: pm.models()

STOP Fatal Error: Check the print file for details
Out[2]: ['bellhop']

In [3]: env = pm.create_env2d()

In [4]: pm.print_env(env)
                name : arlpy
   bottom_absorption : 0.1
      bottom_density : 1600
    bottom_roughness : 0
   bottom_soundspeed : 1600
               depth : 25
        depth_interp : linear
           frequency : 25000
           max_angle : 80
           min_angle : -80
              nbeams : 0
            rx_depth : 10
            rx_range : 1000
          soundspeed : 1500
   soundspeed_interp : spline
             surface : None
      surface_interp : linear
            tx_depth : 5
   tx_directionality : None
                type : 2D

In [5]: pm.plot_env(env, width=900)

In [6]: rays = pm.compute_eigenrays(env)
STOP Fatal Error: Check the print file for details

In [7]: rays = pm.compute_eigenrays(env,debug=True)
    ...: pm.plot_rays(rays, env=env, width=900)
STOP Fatal Error: Check the print file for details
[DEBUG] Model: bellhop
[DEBUG] Bellhop working files: /tmp/tmpvpslno76.*

In [8]: arrivals = pm.compute_arrivals(env)
STOP Fatal Error: Check the print file for details

In [9]: pm.plot_arrivals(arrivals)

I checked the print files at temporary location and it looks fine. Only difference would be(that is acceptable) :

jay@jay-hp-laptop:~/Documents/stack/g$ git diff arlpy_print.prt without_arlpy_tmpvpslno76.prt
diff --git a/arlpy_print.prt b/arlpy_print.prt
index f3def08..289a310 100644
--- a/arlpy_print.prt
+++ b/arlpy_print.prt
@@ -125,4 +125,4 @@ Tracing beam    4701     70.43
 Tracing beam    4801     73.63
 Tracing beam    4901     76.83

- CPU Time =       0.234    s
+ CPU Time =       0.181    s
jay@jay-hp-laptop:~/Documents/stack/g$ 

I am attaching both files as zip if that helps. arlpy_run_tmpvpslno76.zip without_arlpy_tmpvpslno76.zip

so i thought it may be bellhop/acoustic toolbox throwing an error but it is running fine just as normal.

jay@jay-VirtualBox:~/Desktop$ ls
MunkS.env  MunkS.env.prt  MunkS.prt  Test.env
jay@jay-VirtualBox:~/Desktop$ bellhop.exe Test
jay@jay-VirtualBox:~/Desktop$

It looks like it took an empty env file first somehow and then it retrieve a temporary default *.env file or am i missing something ?

P.S. I thought there is something wrong my old bellhop installation so i install a fresh new ubuntu 22.04 and acoustic toolbox and tested this ; also tested this with windows 10 and windows 11. I am experiencing the issue on all platforms. Is there a workaround this ?

Update

I back-trace the issue and found out that this is when bellhop run *.env which is empty.

This is behavior of arlpy when we calls pm.models()

# behavior of `arlpy` 
(myproject) jay@jay-VirtualBox:~/Documents/arlpy$ python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import arlpy.uwapm as pm
>>> pm.models()
This is fname_base:  /tmp/tmpc7v3_6wz
The fname_base size is empty and filesize is : 0
At line 47 of file ReadEnvironmentBell.f90 (unit = 5, file = '/tmp/tmpc7v3_6wz.env')
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x7f67268d5ae0 in ???
#1  0x7f67268d6659 in ???
#2  0x7f67268d728f in ???
#3  0x7f6726b2afcb in ???
#4  0x7f6726b24494 in ???
#5  0x7f6726b250ba in ???
#6  0x555f9205b0e0 in ???
#7  0x555f920600f8 in ???
#8  0x555f9203e35e in ???
#9  0x7f67265acd8f in __libc_start_call_main
    at ../sysdeps/nptl/libc_start_call_main.h:58
#10  0x7f67265ace3f in __libc_start_main_impl
    at ../csu/libc-start.c:392
#11  0x555f9203e3b4 in ???
#12  0xffffffffffffffff in ???
['bellhop']
>>> 

I made an empty *.env file and when i run the bellhop.exe from command line, it behaves exactly the same way as above, below is the traceback of the same.

# `bellhop.exe` commandline behavior 
(myproject) jay@jay-VirtualBox:~/Desktop$ bellhop.exe e1
At line 47 of file ReadEnvironmentBell.f90 (unit = 5, file = 'e1.env')
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x7fdc9521bae0 in ???
#1  0x7fdc9521c659 in ???
#2  0x7fdc9521d28f in ???
#3  0x7fdc95470fcb in ???
#4  0x7fdc9546a494 in ???
#5  0x7fdc9546b0ba in ???
#6  0x558e52f400e0 in ???
#7  0x558e52f450f8 in ???
#8  0x558e52f2335e in ???
#9  0x7fdc94ef2d8f in __libc_start_call_main
    at ../sysdeps/nptl/libc_start_call_main.h:58
#10  0x7fdc94ef2e3f in __libc_start_main_impl
    at ../csu/libc-start.c:392
#11  0x558e52f233b4 in ???
#12  0xffffffffffffffff in ???
(myproject) jay@jay-VirtualBox:~/Desktop$
mchitre commented 2 years ago

Nothing has changed in arlpy recently, so I suspect this is a problem with version mismatch between the tested bellhop.exe and what you're using. What version of OALIB Acoustics Toolbox have you installed?

patel999jay commented 2 years ago

First I thought it may be something to do with my installation but I installed a fresh ubuntu and downloaded the newest version of acoustic toolbox(i guess the one updated on 2020_11_4).

I think arlpy is running an empty env file when we call an function pm.models() and that is why it is throwing that error but works fine when we're supplying an env. I will take a closer look tomorrow and keep updating the issue.

Thanks for your time and help.

mchitre commented 2 years ago

I recall there was a known issue (and perhaps a resolution) for this, but don't offhand remember details. Let me check and get back on this.

mchitre commented 2 years ago

This is the previous issue and discussion re this: https://github.com/org-arl/arlpy/issues/9

mchitre commented 1 year ago

@patel999jay has this been resolved for you?

patel999jay commented 1 year ago

No, This has not resolved yet. I still has the same issue.

patel999jay commented 8 months ago

with the newer AT models (released on 5/2023), it works fine. we can close this now.