Skip to content

transmission loss x-axis isn't right #119

@Vanillaholic

Description

@Vanillaholic

Hi, when plotting transmission loss in a long range scenario, the x--axis went wrong

env['rx_range'] = np.linspace(0, 200000, 1001)
env['rx_depth'] = np.linspace(0, 5000, 101)

tloss = pm.compute_transmission_loss(env)
pm.plot_transmission_loss(tloss,env=env,width=900)

the attribute of tloss--columns isn't correponded to the figure ,which leads to a wrong x-coordinate.
Image

should fix the function plot_transmission_loss() in file uwapm.py ,

def plot_transmission_loss(tloss,env, **kwargs):
    if env is None:
        raise ValueError("Environment is required")
    xr = (env['rx_range'].min(), env['rx_range'].max())
    yr = (-max(tloss.index), -min(tloss.index))
    xlabel = 'Range (m)'
    if xr[1]-xr[0] > 10000:
        xr = (env['rx_range'].min()/1000, env['rx_range'].max()/1000)
        xlabel = 'Range (km)'
    oh = _plt.hold()
    _plt.image(20*_np.log10(_fi.epsilon+_np.abs(_np.flipud(_np.array(tloss)))), x=xr, y=yr, xlabel=xlabel, ylabel='Depth (m)', xlim=xr, ylim=yr, **kwargs)
    _plt.hold(oh)

the correct result is below
Image

all the best

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions