Skip to content
Snippets Groups Projects
Commit 3bc04d65 authored by Felix Fischer's avatar Felix Fischer :shrimp:
Browse files

Merge branch 'smooth_3D' into 'master'

added stubs for wiener etc.

See merge request !46
parents 95e37349 dbf15927
No related branches found
No related tags found
1 merge request!46added stubs for wiener etc.
Pipeline #1110543 failed
...@@ -182,7 +182,10 @@ class Axes: ...@@ -182,7 +182,10 @@ class Axes:
def set_zscale(self, scale: str) -> None: ... def set_zscale(self, scale: str) -> None: ...
def plot_surface(self, X: In2D, Y: In2D, Z: In2D, *, def plot_surface(self, X: In2D, Y: In2D, Z: In2D, *,
cmap: str = "", alpha: Optional[float] = None) -> None: ... cmap: str = "", alpha: Optional[float] = None,
ccount: int = 50, rcount: int = 50,
antialiased: bool = False,
linewidth: float = 1) -> None: ...
def scatter(self, X: In, Y: In, Z: In, def scatter(self, X: In, Y: In, Z: In,
cmap: Union[str, colors.ColorMap] = "jet") -> None: ... cmap: Union[str, colors.ColorMap] = "jet") -> None: ...
......
...@@ -231,13 +231,16 @@ def plot_surface(X: In2D, Y: In2D, Z: In2D, ...@@ -231,13 +231,16 @@ def plot_surface(X: In2D, Y: In2D, Z: In2D,
filename: Union[str, Path], *, filename: Union[str, Path], *,
log_scale: bool = False, log_scale: bool = False,
set_z_lim: bool = True, set_z_lim: bool = True,
colorscheme: str = "rwth_gradient", colorscheme: str = "rwth_gradient_simple",
figsize: tuple[float, float] = (4.33, 3.5), figsize: tuple[float, float] = (4.33, 3.5),
labelpad: Optional[float] = None, labelpad: Optional[float] = None,
nbins: Optional[int] = None, nbins: Optional[int] = None,
xlim: Optional[Tuple[float, float]] = None, xlim: Optional[Tuple[float, float]] = None,
ylim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None,
zlim: Optional[Tuple[float, float]] = None) -> None: zlim: Optional[Tuple[float, float]] = None,
linewidth: float = 0,
antialiased: bool = True,
rcount: int = 200, ccount: int = 200) -> None:
"""create a 2D surface plot of meshgrid-like valued Xs, Ys and Zs""" """create a 2D surface plot of meshgrid-like valued Xs, Ys and Zs"""
if not check_inputs( if not check_inputs(
np.array(X).flatten(), np.array(X).flatten(),
...@@ -246,7 +249,9 @@ def plot_surface(X: In2D, Y: In2D, Z: In2D, ...@@ -246,7 +249,9 @@ def plot_surface(X: In2D, Y: In2D, Z: In2D,
fig = plt.figure() fig = plt.figure()
ax = fig.add_subplot(projection="3d") ax = fig.add_subplot(projection="3d")
fig.subplots_adjust(left=-0.02, right=0.75, bottom=0.15, top=0.98) fig.subplots_adjust(left=-0.02, right=0.75, bottom=0.15, top=0.98)
ax.plot_surface(X, Y, Z, cmap=colorscheme) ax.plot_surface(X, Y, Z, cmap=colorscheme,
rcount=rcount, ccount=ccount,
linewidth=linewidth, antialiased=antialiased)
ax.set_box_aspect(aspect=None, zoom=.8) ax.set_box_aspect(aspect=None, zoom=.8)
if labelpad is None: if labelpad is None:
......
...@@ -112,11 +112,19 @@ rwth_gradient_map = make_colormap( ...@@ -112,11 +112,19 @@ rwth_gradient_map = make_colormap(
[ [
((None, None, None), 0., hks_44), ((None, None, None), 0., hks_44),
(hks_44_75, 0.33, hks_44_75), (hks_44_75, 0.33, hks_44_75),
(rwth_orange_75, 0.66, rwth_orange), (rwth_orange, 0.66, rwth_orange),
(rwth_bordeux, 1., (None, None, None)) (rwth_bordeux, 1., (None, None, None))
] ]
) )
rwth_gradient_map_simple = make_colormap(
[
((None, None, None), 0., hks_44),
(rwth_orange, 1., (None, None, None))
],
name="rwth_gradient_simple")
mpl.colormaps.register(rwth_gradient_map) mpl.colormaps.register(rwth_gradient_map)
mpl.colormaps.register(rwth_gradient_map_simple)
def _germanify(ax: Axes, reverse: bool = False) -> None: def _germanify(ax: Axes, reverse: bool = False) -> None:
...@@ -437,6 +445,7 @@ def set_serif() -> None: ...@@ -437,6 +445,7 @@ def set_serif() -> None:
mpl.rcParams["font.serif"] = [ mpl.rcParams["font.serif"] = [
"cmr10", "stix", "Times New Roman"] "cmr10", "stix", "Times New Roman"]
mpl.rcParams["mathtext.fontset"] = "cm" mpl.rcParams["mathtext.fontset"] = "cm"
mpl.rcParams["axes.formatter.use_mathtext"] = True
def set_sans_serif() -> None: def set_sans_serif() -> None:
......
...@@ -55,3 +55,9 @@ def sosfiltfilt( ...@@ -55,3 +55,9 @@ def sosfiltfilt(
def butter( def butter(
N: int, Wn: Single, btype: str = "low", analog: bool = False, N: int, Wn: Single, btype: str = "low", analog: bool = False,
output: str = "ba", fs: Optional[float] = None) -> Vector: ... output: str = "ba", fs: Optional[float] = None) -> Vector: ...
def wiener(
im: Union[Vector, list[float], tuple[float]],
noise: Optional[float] = None,
mysize: Optional[Union[int, Vector]] = None) -> Vector: ...
...@@ -68,8 +68,8 @@ def test_skip_color() -> None: ...@@ -68,8 +68,8 @@ def test_skip_color() -> None:
@mark.use_style @mark.use_style
def test_two_d_plot() -> None: def test_two_d_plot() -> None:
"""Test the creation of a two dimensional surface plot.""" """Test the creation of a two dimensional surface plot."""
x_test: Vector = linspace(-10, 10, 100) x_test: Vector = linspace(-10, 10, 300)
y_test: Vector = linspace(-10, 10, 100) y_test: Vector = linspace(-10, 10, 300)
x_test_grid, y_test_grid = meshgrid( x_test_grid, y_test_grid = meshgrid(
x_test, y_test) x_test, y_test)
z_grid = x_test_grid**2 - y_test_grid z_grid = x_test_grid**2 - y_test_grid
...@@ -89,7 +89,7 @@ def test_fallback() -> None: ...@@ -89,7 +89,7 @@ def test_fallback() -> None:
filename.parent.mkdir(exist_ok=True) filename.parent.mkdir(exist_ok=True)
x_test: Vector = linspace(-10, 10, 100) x_test: Vector = linspace(-10, 10, 100)
y_test = x_test**2 y_test = x_test**2 * .1**x_test
@apply_styles(_fallback=True) @apply_styles(_fallback=True)
def simple_plot() -> None: def simple_plot() -> None:
...@@ -98,6 +98,7 @@ def test_fallback() -> None: ...@@ -98,6 +98,7 @@ def test_fallback() -> None:
plt.xlabel("$x$ [m]") plt.xlabel("$x$ [m]")
plt.ylabel(r"$\sqrt{y_c}$ [1/m]") plt.ylabel(r"$\sqrt{y_c}$ [1/m]")
plt.legend() plt.legend()
plt.gca().set_yscale("log")
plt.tight_layout() plt.tight_layout()
plt.savefig(LOCATION5) plt.savefig(LOCATION5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment