Code Monkey home page Code Monkey logo

arlpy's People

Contributors

harivnkochi avatar ivanaescobar avatar john-ragland avatar mchitre avatar notthetup avatar patel999jay avatar philipbl avatar toddrme2178 avatar vlaskine avatar ymtoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arlpy's Issues

Getting the list of signals from the signal file failing with latest unet

The latest UnetStack from dev branch logs as following in the signal-*.txt, which the current arlpy parser arlpy.unet.get_signals is unable to parse.

1545811881973|RxBasebandSignalNtf:INFORM[adc:1 rxTime:181862730010 rssi:-54.3 preamble:1 fc:24000 fs:24000 (11280 baseband samples)]

The difference from the earlier one (which works) is just the addition of square brackets. Below is the log for which the parser works.

946694822721|RxBasebandSignalNtf:INFORM rxTime:106164994 rssi:-30.3 adc:1 preamble:1 fc:24000 fs:24000 (10680 baseband samples)

Error in demo1.py

Error reported via email by Sérgio Miguel:

Gave me this error when I simulated the demo1.py file that is in arlpy,
can you explain to me what I can do in order to correct this error.
I´m new in Python language.

File "D:\Anaconda3\lib\site-packages\arlpy\comms.py", line 16, in
from signal import time as _time

ImportError: cannot import name 'time'

asig.envelope artefacts

asig.envelope has a strange window like artefact in the first few samples.

Screenshot 2020-06-28 08 01 56

d = np.concatenate([np.random.normal(-0.001,0.001,200), np.random.normal(-0.1,0.1,200)])
e = asig.envelope(d)
plt.plot(d, hold=True)
plt.plot(e)

call to uwapm.models() gives error

Having installed the acoustic toolbox and the arlpy library, I tried to replicate the bellhop notebook, but failed at the very first step. The call to pm.models() gives me the following error:

At line 39 of file ReadEnvironment.f90 (unit = 5, file = '/tmp/tmp61mcdwv1.env')
Fortran runtime error: End of file

Error termination. Backtrace:
#0  0x7f3665d362da in ???
#1  0x7f3665d36ec5 in ???
#2  0x7f3665d3768d in ???
#3  0x7f3665eada33 in ???
#4  0x7f3665ea69c4 in ???
#5  0x7f3665ea80f9 in ???
#6  0x55cfad042bcb in ???
#7  0x55cfad035e3c in ???
#8  0x55cfad03091e in ???
#9  0x7f3665395b96 in ???
#10  0x55cfad030979 in ???
#11  0xffffffffffffffff in ???

The problem seems to be that the bellhop.exe program tries to read the empty .env file (/tmp/tmp61mcdwv1.env), while it expects a .env with some appropriately formatted content.

I am using Ubuntu 18, gfortran compiler, and python 3.6.5 64 bit.

failed to calculate eigen rays with newer version of arlpy (ubuntu 20.04)

Newer version is failed to calculate ray tracing.

Here is the output of my pip freeze -
pip_freeze.txt

Here is the error while computing eigen rays. I had also attached copy of example notebook for reference.

bellhop-Copy1.pdf

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-25-1af3b30f110e> in <module>
----> 1 rays = pm.compute_eigenrays(env)
      2 pm.plot_rays(rays, env=env, width=900)

~/.local/lib/python3.8/site-packages/arlpy/uwapm.py in compute_eigenrays(env, tx_depth_ndx, rx_depth_ndx, rx_range_ndx, model, debug)
    352     if debug:
    353         print('[DEBUG] Model: '+model_name)
--> 354     return model.run(env, eigenrays, debug)
    355 
    356 def compute_rays(env, tx_depth_ndx=0, model=None, debug=False):

~/.local/lib/python3.8/site-packages/arlpy/uwapm.py in run(self, env, task, debug)
    605             else:
    606                 try:
--> 607                     results = taskmap[task][1](fname_base)
    608                 except FileNotFoundError:
    609                     print('[WARN] Bellhop did not generate expected output file')

~/.local/lib/python3.8/site-packages/arlpy/uwapm.py in _load_rays(self, fname_base)
    819                     'ray': [ray]
    820                 }))
--> 821         return _pd.concat(rays)
    822 
    823     def _load_shd(self, fname_base):

~/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
    269     ValueError: Indexes have overlapping values: ['a']
    270     """
--> 271     op = _Concatenator(
    272         objs,
    273         axis=axis,

~/.local/lib/python3.8/site-packages/pandas/core/reshape/concat.py in __init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort)
    327 
    328         if len(objs) == 0:
--> 329             raise ValueError("No objects to concatenate")
    330 
    331         if keys is None:

ValueError: No objects to concatenate

Python 3 no longer supports implicit relative import

In Python 3, the following error occurs when arlpy is imported:

>>> import arlpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/arl/anaconda3/lib/python3.6/site-packages/arlpy/__init__.py", line 14, in <module> import geo ModuleNotFoundError: No module named 'geo' .

Since Python 3 does not allow implicit relative import, we can replace

import geo import uwa import utils import comms import signal

in __init__.py with

from arlpy import geo, uwa, utils, comms, signal ,

and

from signal import time as _time

in comms.py with

from arlpy.signal import time as _time .

The changes are due to the fact that absolute imports are recommended by Python developers. (https://www.python.org/dev/peps/pep-0008/#imports)

Possible divide by zero in plot_rays

The greyscale color of the ray lines in plot_rays() are calculated using

max_amp = _np.max(_np.abs(rays.bottom_bounces))
...
c = int(255*_np.abs(row.bottom_bounces)/max_amp)

In the case of no bottom bounces (which isn't uncommon for eigen rays in sufficiently close-range/deep environments), this results in a divide by zero error.

Possible fix:

#Get the range, using one less than the minimum number of bottom bounces so that the minimum doesn't plot white.
amp_range = [_np.min(_np.abs(rays.bottom_bounces)) - 1, _np.max(_np.abs(rays.bottom_bounces))]
...
c = int(_np.interp(_np.abs(row.bottom_bounces), amp_range, [0, 255])) 

Link to relevent code

Problem with Bellhop version

Hi,
I'm testing the software, but i have some problem. The problem i am exposing now has already been treated in issue #21: i tried to use the latest version of bellhop (bellhop.exe) and i obtain the sequent error:
first_problem, but plotray and eigenray work better.
So i tried to use previus version of bellop and the error described above no longer occurs, but plot_ray and eigenray don't work, obtaining the following error:
second_problem.
Can you give me any suggestion? how can i proceed?

Thanks very much in advance.

Axis label and tick label size to be passed as parameters to plot.image

It would be great if we could have control over the font size of the axis labels (x, y, color) and tick labels for 2D images plotted by plot.image by passing them as parameters.

Currently the function is
arlpy.plot.image(img, x=None, y=None, colormap='Plasma256', clim=None, clabel=None, title=None, xlabel=None, ylabel=None, xlim=None, ylim=None, xtype='auto', ytype='auto', width=None, height=None, hold=False, interactive=None)

arrivals_to_impulse_response incorrect time scale

As shown in In https://arlpy.readthedocs.io/en/latest/_static/bellhop.html , it seems like arrivals_to_impulse_response gives an incorrect time scale. According to the preceding table and graph, the final arrival is recorded at 0.721796 seconds, but the plot of arrivals_to_impulse_response shows the final arrival at ~0.055 seconds. Likewise, the output of arrivals_to_impulse_response (ir) only contains 5293 elements, but given a total time of 0.721796 seconds and a rate of 96000 Hz, I'd have instead expected ~69292 elements.

Question about fan of angles for uwapm.compute_eigenrays()

I read through arlpy documentation and couldn't find this, but sorry if it's already been answered:

Is there a way to change to a 'finer fan' when computing the eigen rays? (as mentioned on p. 17 paragraph 2 of the Bellhop User Manual)

one question about _select_model

File "../uwapm.py", line 570, in _select_model
raise ValueError('No suitable propagation model available')
ValueError: No suitable propagation model available

Surface reflection coefficient

I am trying to model long-range sound propagation under the surface sea-ice. It appears from the bellhop manual that it is possible to provide a surface reflection coefficient, but this does not seem to be supported by arlpy yet? Many thanks.

ValueError: could not convert string to float: "'2D'" in bellhop.ipynb

Hi,

In the ipython bellhop sample I'm getting the following error:


arrivals = pm.compute_arrivals(env)
pm.plot_arrivals(arrivals, width=900)
arrivals = pm.compute_arrivals(env)
pm.plot_arrivals(arrivals, width=900)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-3843dd94e0a3> in <module>
----> 1 arrivals = pm.compute_arrivals(env)
      2 pm.plot_arrivals(arrivals, width=900)

~/.virtualenvs/dsp3/lib/python3.5/site-packages/arlpy/uwapm.py in compute_arrivals(env, model, debug)
    292     if debug:
    293         print('[DEBUG] Model: '+model_name)
--> 294     return model.run(env, arrivals, debug)
    295 
    296 def compute_eigenrays(env, tx_depth_ndx=0, rx_depth_ndx=0, rx_range_ndx=0, model=None, debug=False):

~/.virtualenvs/dsp3/lib/python3.5/site-packages/arlpy/uwapm.py in run(self, env, task, debug)
    563         fname_base = self._create_env_file(env, taskmap[task][0])
    564         if self._bellhop(fname_base):
--> 565             results = taskmap[task][1](fname_base)
    566         else:
    567             results = None

~/.virtualenvs/dsp3/lib/python3.5/site-packages/arlpy/uwapm.py in _load_arrivals(self, fname_base)
    669     def _load_arrivals(self, fname_base):
    670         with open(fname_base+'.arr', 'rt') as f:
--> 671             freq, tx_depth_count, rx_depth_count, rx_range_count = self._readf(f, (float, int, int, int))
    672             tx_depth = self._readf(f, (float,)*tx_depth_count)
    673             rx_depth = self._readf(f, (float,)*rx_depth_count)

~/.virtualenvs/dsp3/lib/python3.5/site-packages/arlpy/uwapm.py in _readf(self, f, types)
    664         for j in range(len(p)):
    665             if len(types) > j:
--> 666                 p[j] = types[j](p[j])
    667         return tuple(p)
    668 

ValueError: could not convert string to float: "'2D'"

Using Python version 3.5.2 on virtual env. Ubuntu 16.04.

I suspect that this may be because of python version. Could you please state the version of Python that you're using?

Thanks!

Eigen rays are not correct

Hei

Great python package!

I tried scenarios as shown by the figures, the eigen rays are not correct somehow.

  1. It is wrong in env setup, as the Rx is below the bottom, but it gives all rays.

rays_37km

  1. It should not give all rays.
    rays_46km

By the way, using Bokeh plot is resource consuming, and it takes much time to give a figure of low resolution in saving it. While it is much faster in zoom-in/out

Thanks

`arrival_number` backwards

In https://arlpy.readthedocs.io/en/latest/_static/bellhop.html , it indicates ("...the first 10 arrivals...") that arrival_number gives the order in which the rays arrived. However, the associated code (the one with arrivals[arrivals.arrival_number < 10]) shows a resulting table with the last 10 arrivals - arrival 0, for instance, has many bounces and a time_of_arrival of 0.721796, which decrease as arrival_number increases.

Bokeh - Deprecation warning and Bad 'legend' parameter value:

I had installed arlpy with new version with pip install arlpy and pip also installed newer version of bokeh 1.3.4 but unfortunately arlpy didn't work with newer version of Bokeh and throws you Deprecation warning and ValueError: Bad 'legend' parameter value: None while plotting.

BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\jay_p\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arlpy\uwapm.py", line 225, in plot_env _plt.plot([min_x, max_x], [0, 0], xlabel=xlabel, ylabel='Depth (m)', xlim=(min_x-mgn_x, max_x+mgn_x), ylim=(-max_y-mgn_y, -min_y+mgn_y), color=surface_color, **kwargs) File "C:\Users\jay_p\AppData\Local\Programs\Python\Python37-32\lib\site-packages\arlpy\plot.py", line 396, in plot _figure.line(x, y, line_color=color, line_dash=style, line_width=thickness, legend=legend) File "fakesource", line 5, in line File "C:\Users\jay_p\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bokeh\plotting\helpers.py", line 932, in func _update_legend(self, legend_kwarg, glyph_renderer) File "C:\Users\jay_p\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bokeh\plotting\helpers.py", line 489, in _update_legend _LEGEND_KWARG_HANDLERS[kwarg](value, legend, glyph_renderer) File "C:\Users\jay_p\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bokeh\plotting\helpers.py", line 416, in _handle_legend_deprecated raise ValueError("Bad 'legend' parameter value: %s" % label) ValueError: Bad 'legend' parameter value: None

You can solve this error with degrade the version of Bokeh 1.3, Please install manually Bokeh 1.3 by following command :

python -m pip install bokeh==1.3.0

if you don't know your current version of bokeh then please check with following command :

python -m pip freeze

uwapm seems broken after bokeh upgrade to 1.4

I just upgraded bokeh to version 1.4, and I'm getting errors using uwapm (specifically, the create_env2d() function).

When I revert back to bokeh version 1.3, the error goes away.
I get the following warning

BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead

followed by the error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-41565c6176c8> in <module>
     13     nbeams=2500 #at 2500, u see an extra surface-reflected ray of different type
     14 )
---> 15 pm.plot_ssp(env)

~/opt/anaconda3/lib/python3.7/site-packages/arlpy/uwapm.py in plot_ssp(env, **kwargs)
    270         tck = _interp.splrep(s[:,0], s[:,1], s=0)
    271         xnew = _interp.splev(ynew, tck, der=0)
--> 272         _plt.plot(xnew, -ynew, xlabel='Soundspeed (m/s)', ylabel='Depth (m)', hold=True, **kwargs)
    273         _plt.plot(s[:,1], -s[:,0], marker='.', style=None, **kwargs)
    274     else:

~/opt/anaconda3/lib/python3.7/site-packages/arlpy/plot.py in plot(x, y, fs, maxpts, pooling, color, style, thickness, marker, filled, size, mskip, title, xlabel, ylabel, xlim, ylim, xtype, ytype, width, height, legend, hold, interactive)
    394         _figure.add_layout(_bmodels.Label(x=5, y=5, x_units='screen', y_units='screen', text=desc, text_font_size="8pt", text_alpha=0.5))
    395     if style is not None:
--> 396         _figure.line(x, y, line_color=color, line_dash=style, line_width=thickness, legend=legend)
    397     if marker is not None:
    398         scatter(x[::(mskip+1)], y[::(mskip+1)], marker=marker, filled=filled, size=size, color=color, legend=legend, hold=True)

fakesource in line(self, x, y, **kwargs)

~/opt/anaconda3/lib/python3.7/site-packages/bokeh/plotting/helpers.py in func(self, **kwargs)
    930 
    931         if legend_kwarg:
--> 932             _update_legend(self, legend_kwarg, glyph_renderer)
    933 
    934         self.renderers.append(glyph_renderer)

~/opt/anaconda3/lib/python3.7/site-packages/bokeh/plotting/helpers.py in _update_legend(plot, legend_kwarg, glyph_renderer)
    487     kwarg, value = list(legend_kwarg.items())[0]
    488 
--> 489     _LEGEND_KWARG_HANDLERS[kwarg](value, legend, glyph_renderer)
    490 
    491 

~/opt/anaconda3/lib/python3.7/site-packages/bokeh/plotting/helpers.py in _handle_legend_deprecated(label, legend, glyph_renderer)
    414 
    415     if not isinstance(label, (string_types, dict)):
--> 416         raise ValueError("Bad 'legend' parameter value: %s" % label)
    417 
    418     if isinstance(label, dict):

ValueError: Bad 'legend' parameter value: None

Arlpy donot plot correctly

Hei

I can see arlpy.plot_ray will not show the rays who have the maks number of bottom bounces.

Some times, I can see it has some reasons coz no returning rays will be shown.

In my trial, I can see that the ray that has max bottom bounces is appearent correct.

On draging the plot, the hided plot is shown. see below zooming in
2018-10-31_15-31-39
2018-10-31_15-36-27

Error with pm.models()

Hi,

I've just installed Bellhop and am trying to run the notebook https://arlpy.readthedocs.io/en/latest/_static/bellhop.html to verify functionality.

I have compiled bellhop using gfortran, and have added Bellhop.exe to the PATH (trying both copying and pasting the file to the working directory and by using below sequece)
import sys sys.path.append(bellhop_dir)

When I run pm.models(), the output is an empty list. I'm not sure what the issue is.

Thanks for the help!

Incorrect amplitude showing in plot_arrivals()

The amplitude is calculated: y = np.abs(arrival_amplitude), but abs takes the magnitude of the complex arrival_amplitude. It should only be using the real part of the amplitude as the complex portion discribes the phase: y = np.abs(np.real(arrival_amplitude))

call to uwapm.models() gives error - continues to be an issue under Windows/10 x64 with Anaconda Python 3.6.7 and arlpy 1.6

Believing specified environment may have been to complex, replaced bathymetry and ssp with a simple set-up. Results remain the same - receive error related to missing .ray file (in jupyter-notebook window) and mis-formed env file (in Win cli).
Have attached Jupyter notebook and resultant .env/.prt/.bty file(s) for examination and debugging.

Regards

USS
Platform info.......

# Name                    Version                   Build  Channel
arlpy                     1.6                      pypi_0    pypi

     active environment : arlpy
...
               platform : win-64
             user-agent : conda/4.7.5 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.17763
          administrator : False
             netrc file : None
           offline mode : False

arlpy-uwapm-test.9Jul2019pdf.pdf
arlpy-uwapm-test.9Jul2019CLI-error_output.txt
arlpy-uwapm-test.9Jul2019_PRT_ENV_BTY_files.txt

parsing custom env failed to recreate environment

I parsed custom env to module but it failed to regenerate simulation scenarios. I had successfully tested the same scenario files with bellhop using matlab, works perfectly fine. Also is there any way to parse non-monotonic ssp ? I am using Bathmetry from GEBCO 2019. Any help would be appreciated.

Here is the example env file that i use.

'BELLHOP - run id = 0; run = 0'
25000              ! FREQUENCY [HZ]
1                      ! NMEDIA
'CVWT'                    ! OPTIONS1
0 0.0 5500        ! NMESH SIGMAS Z(NSSP)
0  1453.8265380859375  / 
171.875  1484.99903106689453  / 
343.75  1487.60022735595703  / 
515.625  1490.45523834228516  / 
687.5  1493.31779479980469  / 
859.375  1496.18764877319336  / 
1031.25  1499.06432342529297  / 
1203.125  1501.94766235351562  / 
1375  1504.838134765625  / 
1546.875  1507.73603057861328  / 
1718.75  1510.63935852050781  / 
1890.625  1513.55051422119141  / 
2062.5  1516.46852111816406  / 
2234.375  1519.39547348022461  / 
2406.25  1522.32242584228516  / 
2578.125  1525.25769424438477  / 
2750  1528.20294189453125  / 
2921.875  1531.14818954467773  / 
3093.75  1534.10316467285156  / 
3265.625  1537.06624603271484  / 
3437.5  1540.02932739257812  / 
3609.375  1543.00338363647461  / 
3781.25  1545.98371124267578  / 
3953.125  1548.96403884887695  / 
4125  1551.95657348632812  / 
4296.875  1554.95368576049805  / 
4468.75  1557.95079803466797  / 
4640.625  1560.96119689941406  / 
4812.5  1563.97454833984375  / 
4984.375  1566.98789978027344  / 
5156.25  1570.01551818847656  / 
5328.125  1573.04456329345703  / 
5500  1576.0736083984375  / 
'A*' 0.0                 ! BOTTOM TYPE
5500 1702.5 409.139 1.935 0.73 2.15  /  ! SAND * 0.65 + GRAVEL * 0.35 BOTTOM TYPE 
1           ! NUMBER OF SOURCES
50  /              ! SOURCE'S DEPTH
2       ! NUMBER OF RX DEPTH(S)
49.899999999068676  50.0999999990686788  /                 ! RX'S DEPTHS
2        !NUMBER OF RX RANGE(S)
3.91162739655877489  3.91182739655877443  /                 ! RX'S RANGES
'AB'                 ! RAY OPTIONS
0              ! NUMBER OF RAYS
-180 180   /           ! START, END ANGLES
0.0 301.109658813476585 4.30301013621465245 ,  ! RAY-STEP , BOX DEPTH, BOX RANGE

Feature request: Table of angle of interactions of each raypath with bottom

Currently, compute_eigenrays(), and compute_arrivals() compute_rays() returns dataframes containing information on raypaths with number of surface/bottom bounces, angle of launch, angle of arrival, etc.

It would also be useful to know the angle(s) of incidence of each raypath with the bottom. This can then help us determine which rays went through supercritical/subcritical interactions.

If we look at the ray information from Bellhop with info on the path, we may be able to pull this out by simply looking at the angles of the raypath before and after it interacts with the bottom (i.e angle of incidence and reflection).

Request: Gaussian Beam and 'Ibeam' option for computing TL

Hi! I would like to request an edition to arlpy, the option to use Gaussian Beams when computing Transmition Loss. On the screenshot shows as 'CB' in line 37, 'R/C/I/S' .

Also complementary to this, extra option is 'Ibeam' in order for Bellhop to compute only 1 beam. On the screenshot shows as 'Ibeam' = 12 (meaning, compute beam 12 of 21 beams).

The screenshot attached, shows the lines in the enviromental file, in which both options are written. (page 36 in the Bellhop manual)

Maybe both options could be implemented as parameters inside the arlpy.uwapm.compute_transmission_loss( ) ?

Thank you!

ScreenHunter_1467 Nov  09 13 59

pm.plot_rays(rays, env=env, width=900) does not work with arlpy

Hello,

I was using arlpy during Sep. to Oct. last year (using python version 2x) and it was working fine. But I see that you made an update to the library in April. I installed alrpy and Acoustic Toolbox today and I have been trying to plot rays and arrivals but it does not work. I used a simple code as follows,

import arlpy.uwapm as pm
import arlpy.plot as plt
import numpy as np
env = pm.create_env2d()
rays = pm.compute_eigenrays(env, model='bellhop')
pm.plot_rays(rays, env=env, width=900)

I get the below error.

[WARN] Bellhop did not generate expected output file
Traceback (most recent call last):
File "model.py", line 7, in
pm.plot_rays(rays, env=env, width=900)
File "/python/Plot_test/venv/lib/python3.8/site-packages/arlpy/uwapm.py", line 478, in plot_rays
rays = rays.sort_values('bottom_bounces', ascending=False)
AttributeError: 'NoneType' object has no attribute 'sort_values'

I looked up online and I understand that "NoneType" means no value is passed to sort_values and bellhop did not generate an output file to be passed to pm.plot_rays method. I am not sure if your recent update in April affected the arlpy library. Could you please check and help me.

I am using python version - 3.8.5 on Mac OSX. I installed arlpy using pip (pip install arlpy). Are there any dependencies that I should add for python version - 3.8.5 ? Could you please let me know. Appreciate your help.

ValueError when running with latest bokeh.

plot.psd gives an error when running with bokeh 1.4.0.

Since the dep is defined as bokeh>=1.2.0 it automagically installs bokeh 1.4.0 when installing arlpy

The actual error :

BokehDeprecationWarning: 'legend' keyword is deprecated, use explicit 'legend_label', 'legend_field', or 'legend_group' keywords instead
ValueError                                Traceback (most recent call last)
<ipython-input-9-0e6f7195dc3c> in <module>
      1 calib = adcV * 10**((rxSensitivity-gain)/20)
----> 2 plt.psd(np.array(file['noise']['dut'])*calib, fs=dutfs, hold=True, color='blue', xlim=[0, 96000/2])
      3 plt.psd(np.array(file['noise']['golden'])*calib, fs=goldenfs, color='goldenrod')

~/Library/Python/3.7/lib/python/site-packages/arlpy/plot.py in psd(x, fs, nfft, noverlap, window, color, style, thickness, marker, filled, size, title, xlabel, ylabel, xlim, ylim, width, height, legend, hold, interactive)
    683     if ylim is None:
    684         ylim = (_np.max(Pxx)-50, _np.max(Pxx)+10)
--> 685     plot(f, Pxx, color=color, style=style, thickness=thickness, marker=marker, filled=filled, size=size, title=title, xlabel=xlabel, ylabel=ylabel, xlim=xlim, ylim=ylim, maxpts=len(f), width=width, height=height, hold=hold, legend=legend, interactive=interactive)
    686 
    687 def iqplot(data, marker='.', color=None, labels=None, filled=False, size=None, title=None, xlabel=None, ylabel=None, xlim=[-2, 2], ylim=[-2, 2], width=None, height=None, hold=False, interactive=None):

~/Library/Python/3.7/lib/python/site-packages/arlpy/plot.py in plot(x, y, fs, maxpts, pooling, color, style, thickness, marker, filled, size, mskip, title, xlabel, ylabel, xlim, ylim, xtype, ytype, width, height, legend, hold, interactive)
    394         _figure.add_layout(_bmodels.Label(x=5, y=5, x_units='screen', y_units='screen', text=desc, text_font_size="8pt", text_alpha=0.5))
    395     if style is not None:
--> 396         _figure.line(x, y, line_color=color, line_dash=style, line_width=thickness, legend=legend)
    397     if marker is not None:
    398         scatter(x[::(mskip+1)], y[::(mskip+1)], marker=marker, filled=filled, size=size, color=color, legend=legend, hold=True)

fakesource in line(self, x, y, **kwargs)

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in func(self, **kwargs)
    930 
    931         if legend_kwarg:
--> 932             _update_legend(self, legend_kwarg, glyph_renderer)
    933 
    934         self.renderers.append(glyph_renderer)

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in _update_legend(plot, legend_kwarg, glyph_renderer)
    487     kwarg, value = list(legend_kwarg.items())[0]
    488 
--> 489     _LEGEND_KWARG_HANDLERS[kwarg](value, legend, glyph_renderer)
    490 
    491 

~/Library/Python/3.7/lib/python/site-packages/bokeh/plotting/helpers.py in _handle_legend_deprecated(label, legend, glyph_renderer)
    414 
    415     if not isinstance(label, (string_types, dict)):
--> 416         raise ValueError("Bad 'legend' parameter value: %s" % label)
    417 
    418     if isinstance(label, dict):

ValueError: Bad 'legend' parameter value: None

MS windows execution of bellhop notebook

Hello,

I'm trying to use arlpy as interface for the Acoustic Toolbox.

I've installed arlpy on a python 3.6 environment using Anaconda on a Windows 7 system.
At the moment when I run pm.models() I obtain Fotran errors like the following:

In [2]: pm.models()
At line 39 of file ReadEnvironment.f90 (unit = 5, file = 'C:\Users\~~~~\AppData\Local\Temp\tmpl45gufmo.env')
Fortran runtime error: End of file

Error termination. Backtrace:

Could not print backtrace: libbacktrace could not find executable to open
#0  0xffffffff
#1  0xffffffff
#2  0xffffffff
#3  0xffffffff
#4  0xffffffff
#5  0xffffffff
#6  0xffffffff
#7  0xffffffff
#8  0xffffffff
#9  0xffffffff
#10  0xffffffff
#11  0xffffffff
#12  0xffffffff
#13  0xffffffff

Out[2]: ['bellhop']

Then if I run the command rays = pm.compute_eigenrays(env) seems working fine.
Any suggestion?
After going through the open issues, maybe this is related to #9

Range Dependent Sound Speed Profile Error

I am trying to run a simulation using a range dependent sound speed profile. I am working on my own data, but for this post I will use example code modified from arlpy documentation and the Bellhop Example Notebook

So setting the bathymetry and sound speed profile (I should note that ssp comes from arlpy docs with the last depth of profile incremented by 1 due to error I received):

bathy = [
    [0, 30],    # 30 m water depth at the transmitter
    [300, 20],  # 20 m water depth 300 m away
    [1000, 25]  # 25 m water depth at 1 km
]

ssp = pd.DataFrame({
          0: [1540, 1530, 1532, 1533],     # profile at 0 m range
        500: [1540, 1535, 1530, 1533],     # profile at 100 m range
        1000: [1530, 1520, 1522, 1525] },   # profile at 200 m range
        index=[0, 10, 20, 31])             # depths of the profile entries in m

and then creating the 2D environment:

env = pm.create_env2d(
    depth=bathy,
    soundspeed=ssp,
    bottom_soundspeed=1450,
    bottom_density=1200,
    bottom_absorption=1.0,
    tx_depth=15
)

I get the following error message when computing the eigenrays rays = pm.compute_eigenrays(env):

None
[WARN] Bellhop did not generate expected output file
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-1af3b30f110e> in <module>
      1 rays = pm.compute_eigenrays(env)
----> 2 pm.plot_rays(rays, env=env, width=900)

~/opt/anaconda3/envs/ooi/lib/python3.7/site-packages/arlpy/uwapm.py in plot_rays(rays, env, invert_colors, **kwargs)
    477     >>> pm.plot_rays(rays, width=1000)
    478     """
--> 479     rays = rays.sort_values('bottom_bounces', ascending=False)
    480     max_amp = _np.max(_np.abs(rays.bottom_bounces)) if len(rays.bottom_bounces) > 0 else 0
    481     if max_amp <= 0:

AttributeError: 'NoneType' object has no attribute 'sort_values'

arlpy plotting is not showing the plots

Tried this in a couple of machines. Ran the following in Jupyter lab:

import arlpy.plot

arlpy.plot.plot([0,20], [0,10], hold=True)
arlpy.plot.box(left=5, right=10, top=8)

The output is not showing the plot. The following is the output:

screen shot 2018-05-18 at 11 52 03 am

Bellhop run failing on Linux

Screenshot from 2020-09-30 17-52-53
ValueError: could not convert string to float: ' 0.00000000 5.00000000 \n'
I am using ubuntu18.04
python3.8
i have been trying to run bellhop model for under water channel simulation .
I have install the at_Linux.taz.gz for acoustic toolbox
please help

uwapm.compute_arrivals(env) doesnt work if multiple very close receiver ranges are specified

Looks like there is a minimum range separation at which the receivers should be placed in order to avoid this error. It might be good to be able to catch/pre-empt this error.

Example code and error:

env = pm.create_env2d(
    frequency=2000,
    depth= 150,
    soundspeed= 1540,
    bottom_soundspeed=1600,
    bottom_density=1200,
    bottom_absorption=10.0,
    tx_depth=tx_depth,
    rx_depth= np.arange(1,5,1),#
    rx_range= np.arange(10,10.1,.01),
    min_angle=-45,
    max_angle=45,
    nbeams=2500 
)
arrivals = pm.compute_arrivals(env)

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-43-19a6d64bab5c> in <module>
----> 1 arrivals = pm.compute_arrivals(env)

~/opt/anaconda3/lib/python3.7/site-packages/arlpy/uwapm.py in compute_arrivals(env, model, debug)
    293     if debug:
    294         print('[DEBUG] Model: '+model_name)
--> 295     return model.run(env, arrivals, debug)
    296 
    297 def compute_eigenrays(env, tx_depth_ndx=0, rx_depth_ndx=0, rx_range_ndx=0, model=None, debug=False):

~/opt/anaconda3/lib/python3.7/site-packages/arlpy/uwapm.py in run(self, env, task, debug)
    569         fname_base = self._create_env_file(env, taskmap[task][0])
    570         if self._bellhop(fname_base):
--> 571             results = taskmap[task][1](fname_base)
    572         else:
    573             results = None

~/opt/anaconda3/lib/python3.7/site-packages/arlpy/uwapm.py in _load_arrivals(self, fname_base)
    679 
    680     def _load_arrivals(self, fname_base):
--> 681         with open(fname_base+'.arr', 'rt') as f:
    682             hdr = f.readline()
    683             if hdr.find('2D') >= 0:

FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/s4/0jrt39zs65j81br7ll9g8nfc0000gn/T/tmpen87jupi.arr'

uwapm error: No such file or directory

I am getting a No such file or directory error for any compute call using the arlpy.uwapm package.

For example, even following the default Bellhop example:

import arlpy.uwapm as pm

env = pm.create_env2d()
arrivals = pm.compute_arrivals(env)

Here is the error I get:

---------------------------------------------------------------------------

FileNotFoundError                         Traceback (most recent call last)

<ipython-input-5-c9e594c6a409> in <module>
      2 
      3 env = pm.create_env2d()
----> 4 arrivals = pm.compute_arrivals(env)
      5 

~/anaconda3/envs/spring2019/lib/python3.7/site-packages/arlpy/uwapm.py in compute_arrivals(env, model, debug)
    293     if debug:
    294         print('[DEBUG] Model: '+model_name)
--> 295     return model.run(env, arrivals, debug)
    296 
    297 def compute_eigenrays(env, tx_depth_ndx=0, rx_depth_ndx=0, rx_range_ndx=0, model=None, debug=False):

~/anaconda3/envs/spring2019/lib/python3.7/site-packages/arlpy/uwapm.py in run(self, env, task, debug)
    569         fname_base = self._create_env_file(env, taskmap[task][0])
    570         if self._bellhop(fname_base):
--> 571             results = taskmap[task][1](fname_base)
    572         else:
    573             results = None

~/anaconda3/envs/spring2019/lib/python3.7/site-packages/arlpy/uwapm.py in _load_arrivals(self, fname_base)
    679 
    680     def _load_arrivals(self, fname_base):
--> 681         with open(fname_base+'.arr', 'rt') as f:
    682             hdr = f.readline()
    683             if hdr.find('2D') >= 0:

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpwande4tb.arr'

Possibility to change the number of output beams from the source in uwapm

Hello,
I'm using arlpy library. I desired to change the number of output beams from the source.
For example, if i want to visualize only 2 or 3 rays when i run plot_ray routine, how can i do that?
I notice that in the routine create_env2d there isn't any parameters who permits to modify the number of beams.
I desired, to modify as in Matlab in the .env file, the number of beam.
Waiting for an answer I send my best regards.

Cristian Tesconi

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.