Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs fix #88

Merged
merged 15 commits into from
Jun 7, 2023
20 changes: 13 additions & 7 deletions echoshader/echogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ def __init__(self, MVBS_ds):
self.upper_time = pandas.to_datetime(self.MVBS_ds.ping_time.data[-1])

# http://holoviews.org/user_guide/Applying_Customizations.html
self.gram_opts = holoviews.opts(invert_yaxis=True)
self.gram_opts = holoviews.opts(
invert_yaxis=False, tools=["hover", "box_select"]
)

self.bound_opts = holoviews.opts(line_width=1.5, line_color="white")

Expand Down Expand Up @@ -301,9 +303,9 @@ def view_gram(self):
source=self.gram,
bounds=(
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[0],
self.MVBS_ds.echo_range.values[-1],
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[-1],
self.MVBS_ds.echo_range.values[0],
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[-1],
self.MVBS_ds.echo_range.values[-1],
),
)

Expand Down Expand Up @@ -394,9 +396,9 @@ def view_all_gram(self):
source=self.all_gram[0],
bounds=(
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[0],
self.MVBS_ds.echo_range.values[-1],
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[-1],
self.MVBS_ds.echo_range.values[0],
self.MVBS_ds.sel(ping_time=time_range).ping_time.values[-1],
self.MVBS_ds.echo_range.values[-1],
),
)

Expand All @@ -419,7 +421,9 @@ def get_box_data(self):
return self.MVBS_ds.sel(
channel=self.channel_select.value,
ping_time=slice(self.box.bounds[0], self.box.bounds[2]),
echo_range=slice(self.box.bounds[3], self.box.bounds[1]),
echo_range=slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1]),
)

def get_all_box_data(self):
Expand All @@ -432,7 +436,9 @@ def get_all_box_data(self):
"""
return self.MVBS_ds.sel(
ping_time=slice(self.box.bounds[0], self.box.bounds[2]),
echo_range=slice(self.box.bounds[3], self.box.bounds[1]),
echo_range=slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1]),
)


Expand Down
23 changes: 12 additions & 11 deletions echoshader/echomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import pandas
import panel
import param

from .curtain import plot_curtain
from .echogram import Echogram
from curtain import plot_curtain
from echogram import Echogram


def plot_track(
Expand Down Expand Up @@ -402,7 +401,11 @@ def view_curtain(self):

time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

channel = self.channel_select.value

Expand All @@ -421,13 +424,11 @@ def view_curtain(self):
ratio=ratio,
)

curtain_panel = panel.Row(
panel.panel(
self.curtain.ren_win,
height=self.curtain_height,
width=self.curtain_width,
orientation_widget=True,
)
curtain_panel = panel.panel(
self.curtain.ren_win,
height=self.curtain_height,
width=self.curtain_width,
orientation_widget=True,
)

return curtain_panel
39 changes: 31 additions & 8 deletions echoshader/echostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import pandas
import panel
import param

from .echogram import Echogram
from echogram import Echogram


def simple_hist(echogram):
Expand Down Expand Up @@ -254,7 +253,11 @@ def view_table(self):
"""
time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

channel = self.channel_select.value

Expand Down Expand Up @@ -287,7 +290,11 @@ def view_hist(self):

time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

channel = self.channel_select.value

Expand All @@ -312,7 +319,11 @@ def view_all_table(self):
"""
time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

# Apply current ranges
obj_df = self.MVBS_ds.sel(
Expand Down Expand Up @@ -366,7 +377,11 @@ def view_sum_hist(self):

time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

# Apply current ranges
obj_df = self.MVBS_ds.sel(
Expand All @@ -389,7 +404,11 @@ def view_overlay_hist(self):
"""
time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

return (
self.MVBS_ds.sel(ping_time=time_range, echo_range=echo_range)
Expand All @@ -416,7 +435,11 @@ def view_layout_hist(self):
"""
time_range = slice(self.box.bounds[0], self.box.bounds[2])

echo_range = slice(self.box.bounds[3], self.box.bounds[1])
echo_range = (
slice(self.box.bounds[1], self.box.bounds[3])
if self.box.bounds[3] > self.box.bounds[1]
else slice(self.box.bounds[3], self.box.bounds[1])
)

return (
self.MVBS_ds.sel(ping_time=time_range, echo_range=echo_range)
Expand Down