-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change importing format to comply with develop mode * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Solve that curtain could not dynamically render * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Select box correctly when not inverting y-axis * local testing * y-axis testing * Y-axis testing * add options for echogram * del testing files * add options * set y-axis inversion * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * 06/06/2023 - testing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
3031dcd
commit 55e46f0
Showing
7 changed files
with
1,270 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pkg_resources import DistributionNotFound, get_distribution | ||
|
||
try: | ||
VERSION = get_distribution(__name__).version | ||
except DistributionNotFound: # pragma: no cover | ||
try: | ||
from .version import version as VERSION # noqa | ||
except ImportError: # pragma: no cover | ||
raise ImportError( | ||
"Failed to find (autogenerated) version.py. " | ||
"This might be because you are installing from GitHub's tarballs, " | ||
"use the PyPI ones." | ||
) | ||
__version__ = VERSION |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from typing import Dict, Union | ||
|
||
import holoviews | ||
import panel | ||
import param | ||
import xarray | ||
|
||
|
||
@xarray.register_dataset_accessor("eshader") | ||
class Echogram(param.Parameterized): | ||
def __init__(self, MVBS_ds): | ||
super().__init__() | ||
|
||
self.MVBS_ds = MVBS_ds | ||
|
||
self.gram_opts = { | ||
"Image": { | ||
"cmap": "jet", | ||
"colorbar": True, | ||
"cmap": "jet", | ||
"tools": ["box_select", "lasso_select", "hover"], | ||
"invert_yaxis": False, | ||
"width": 600, | ||
} | ||
} | ||
|
||
def echogram( | ||
self, | ||
cmap: str = "jet", | ||
layout: Union[ | ||
str("single_frequency"), str("multiple_frequency"), str("composite") | ||
] = "single_frequency", | ||
vmin: float = None, | ||
vmax: float = None, | ||
rgb_map: Dict[str, str] = None, | ||
*args, | ||
**kwargs | ||
): | ||
if vmin == None: | ||
vmin = self.MVBS_ds.Sv.actual_range[0] | ||
|
||
if vmax == None: | ||
vmax = self.MVBS_ds.Sv.actual_range[-1] | ||
|
||
self.gram_opts["Image"]["clim"] = (vmin, vmax) | ||
self.gram_opts["Image"]["cmap"] = cmap | ||
|
||
if layout == "single_frequency": | ||
tabs = panel.Tabs() | ||
|
||
for index, channel in enumerate(self.MVBS_ds.channel.values): | ||
plot = ( | ||
holoviews.Dataset(self.MVBS_ds.sel(channel=channel)) | ||
.to( | ||
holoviews.Image, vdims=["Sv"], kdims=["ping_time", "echo_range"] | ||
) | ||
.opts(self.gram_opts) | ||
) | ||
tab = panel.Column(panel.pane.Markdown("## " + channel), plot) | ||
tabs.append(("channel" + " " + str(index + 1), tab)) | ||
|
||
return tabs | ||
|
||
elif layout == "multiple_frequency": | ||
col = panel.Column() | ||
|
||
for index, channel in enumerate(self.MVBS_ds.channel.values): | ||
plot = ( | ||
holoviews.Dataset(self.MVBS_ds.sel(channel=channel)) | ||
.to( | ||
holoviews.Image, vdims=["Sv"], kdims=["ping_time", "echo_range"] | ||
) | ||
.opts(self.gram_opts) | ||
) | ||
|
||
col.append(panel.pane.Markdown("## " + channel)) | ||
col.append(plot) | ||
|
||
return col | ||
|
||
elif layout == "composite": | ||
if rgb_map == None: | ||
pass |
Large diffs are not rendered by default.
Oops, something went wrong.