Skip to content

Commit 1d81bc0

Browse files
committed
Modify gui import
1 parent caff46f commit 1d81bc0

File tree

19 files changed

+61
-58
lines changed

19 files changed

+61
-58
lines changed

examples/06_grid_manipulation/pet_advect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from matplotlib.animation import FuncAnimation
1111
from numpy import arange, isnan, meshgrid, ones
1212

13-
import py_eddy_tracker.gui
1413
from py_eddy_tracker.data import get_demo_path
1514
from py_eddy_tracker.dataset.grid import RegularGridDataset
15+
from py_eddy_tracker.gui import GUI_AXES
1616
from py_eddy_tracker.observations.observation import EddiesObservations
1717

1818
# %%
@@ -32,7 +32,7 @@
3232
# %%
3333
# Quiver from u/v with eddies
3434
fig = plt.figure(figsize=(10, 5))
35-
ax = fig.add_axes([0, 0, 1, 1], projection="full_axes")
35+
ax = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)
3636
ax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()
3737
x, y = meshgrid(g.x_c, g.y_c)
3838
a.filled(ax, facecolors="r", alpha=0.1), c.filled(ax, facecolors="b", alpha=0.1)
@@ -82,7 +82,7 @@ def save(self, *args, **kwargs):
8282
def anim_ax(**kw):
8383
t = 0
8484
fig = plt.figure(figsize=(10, 5), dpi=55)
85-
axes = fig.add_axes([0, 0, 1, 1], projection="full_axes")
85+
axes = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)
8686
axes.set_xlim(19, 30), axes.set_ylim(31, 36.5), axes.grid()
8787
a.filled(axes, facecolors="r", alpha=0.1), c.filled(axes, facecolors="b", alpha=0.1)
8888
line = axes.plot([], [], "k", **kw)[0]

examples/06_grid_manipulation/pet_lavd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
from matplotlib.animation import FuncAnimation
2525
from numpy import arange, meshgrid, zeros
2626

27-
import py_eddy_tracker.gui
2827
from py_eddy_tracker.data import get_demo_path
2928
from py_eddy_tracker.dataset.grid import RegularGridDataset
29+
from py_eddy_tracker.gui import GUI_AXES
3030
from py_eddy_tracker.observations.observation import EddiesObservations
3131

3232

3333
# %%
3434
def start_ax(title="", dpi=90):
3535
fig = plt.figure(figsize=(16, 9), dpi=dpi)
36-
ax = fig.add_axes([0, 0, 1, 1], projection="full_axes")
36+
ax = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)
3737
ax.set_xlim(0, 32), ax.set_ylim(28, 46)
3838
ax.set_title(title)
3939
return fig, ax, ax.text(3, 32, "", fontsize=20)

examples/07_cube_manipulation/pet_cube.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from matplotlib.animation import FuncAnimation
1313
from numpy import arange, isnan, meshgrid, ones
1414

15-
import py_eddy_tracker.gui
1615
from py_eddy_tracker import start_logger
1716
from py_eddy_tracker.data import get_demo_path
1817
from py_eddy_tracker.dataset.grid import GridCollection
18+
from py_eddy_tracker.gui import GUI_AXES
1919

2020
start_logger().setLevel("ERROR")
2121

@@ -70,7 +70,7 @@ def save(self, *args, **kwargs):
7070
# Function
7171
def anim_ax(**kw):
7272
fig = plt.figure(figsize=(10, 5), dpi=55)
73-
axes = fig.add_axes([0, 0, 1, 1], projection="full_axes")
73+
axes = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)
7474
axes.set_xlim(19, 30), axes.set_ylim(31, 36.5), axes.grid()
7575
line = axes.plot([], [], "k", **kw)[0]
7676
return fig, axes.text(21, 32.1, ""), line

examples/07_cube_manipulation/pet_lavd_detection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
from matplotlib import pyplot as plt
2424
from numpy import arange, isnan, ma, meshgrid, zeros
2525

26-
import py_eddy_tracker.gui
2726
from py_eddy_tracker import start_logger
2827
from py_eddy_tracker.data import get_demo_path
2928
from py_eddy_tracker.dataset.grid import GridCollection, RegularGridDataset
29+
from py_eddy_tracker.gui import GUI_AXES
3030

3131
start_logger().setLevel("ERROR")
3232

@@ -47,7 +47,7 @@ def from_(cls, x, y, z):
4747
# %%
4848
def start_ax(title="", dpi=90):
4949
fig = plt.figure(figsize=(12, 5), dpi=dpi)
50-
ax = fig.add_axes([0.05, 0.08, 0.9, 0.9], projection="full_axes")
50+
ax = fig.add_axes([0.05, 0.08, 0.9, 0.9], projection=GUI_AXES)
5151
ax.set_xlim(-6, 36), ax.set_ylim(31, 45)
5252
ax.set_title(title)
5353
return fig, ax, ax.text(3, 32, "", fontsize=20)

examples/16_network/pet_atlas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from matplotlib import pyplot as plt
66
from numpy import ma
77

8-
import py_eddy_tracker.gui
98
from py_eddy_tracker.data import get_remote_demo_sample
9+
from py_eddy_tracker.gui import GUI_AXES
1010
from py_eddy_tracker.observations.network import NetworkObservations
1111

1212
n = NetworkObservations.load_file(
@@ -26,7 +26,7 @@
2626
# Functions
2727
def start_axes(title):
2828
fig = plt.figure(figsize=(13, 5))
29-
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection="full_axes")
29+
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection=GUI_AXES)
3030
ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)
3131
ax.set_aspect("equal")
3232
ax.set_title(title, weight="bold")

examples/16_network/pet_ioannou_2017_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
from matplotlib.ticker import FuncFormatter
1717
from numpy import arange, where
1818

19-
import py_eddy_tracker.gui
2019
from py_eddy_tracker.appli.gui import Anim
2120
from py_eddy_tracker.data import get_demo_path
21+
from py_eddy_tracker.gui import GUI_AXES
2222
from py_eddy_tracker.observations.network import NetworkObservations
2323

2424

@@ -48,7 +48,7 @@ def formatter(x, pos):
4848

4949
def start_axes(title=""):
5050
fig = plt.figure(figsize=(13, 6))
51-
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection="full_axes")
51+
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection=GUI_AXES)
5252
ax.set_xlim(19, 29), ax.set_ylim(31, 35.5)
5353
ax.set_aspect("equal")
5454
ax.set_title(title, weight="bold")

examples/16_network/pet_relative.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from matplotlib import pyplot as plt
66
from numpy import where
77

8-
import py_eddy_tracker.gui
98
from py_eddy_tracker import data
9+
from py_eddy_tracker.gui import GUI_AXES
1010
from py_eddy_tracker.observations.network import NetworkObservations
1111

1212
# %%
@@ -266,7 +266,7 @@
266266
# %%
267267
# Only a map can be tricky to understand, with a timeline it's easier!
268268
fig = plt.figure(figsize=(15, 8))
269-
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection="full_axes")
269+
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection=GUI_AXES)
270270
n.plot(ax, color_cycle=n.COLORS)
271271
ax.set_xlim(17.5, 27.5), ax.set_ylim(31, 36), ax.grid()
272272
ax = fig.add_axes([0.08, 0.7, 0.7, 0.3])
@@ -278,7 +278,7 @@
278278
# -----------------
279279
# Display the position of the eddies after a merging
280280
fig = plt.figure(figsize=(15, 8))
281-
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
281+
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection=GUI_AXES)
282282
n.plot(ax, color_cycle=n.COLORS)
283283
m1, m0, m0_stop = n.merging_event(triplet=True)
284284
m1.display(ax, color="violet", lw=2, label="Eddies after merging")
@@ -296,7 +296,7 @@
296296
# ------------------
297297
# Display the position of the eddies before a splitting
298298
fig = plt.figure(figsize=(15, 8))
299-
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
299+
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection=GUI_AXES)
300300
n.plot(ax, color_cycle=n.COLORS)
301301
s0, s1, s1_start = n.spliting_event(triplet=True)
302302
s0.display(ax, color="violet", lw=2, label="Eddies before splitting")
@@ -314,7 +314,7 @@
314314
# ---------------
315315
# Display the starting position of non-splitted eddies
316316
fig = plt.figure(figsize=(15, 8))
317-
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
317+
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection=GUI_AXES)
318318
birth = n.birth_event()
319319
birth.display(ax)
320320
ax.set_xlim(17.5, 27.5), ax.set_ylim(31, 36), ax.grid()
@@ -325,7 +325,7 @@
325325
# ---------------
326326
# Display the last position of non-merged eddies
327327
fig = plt.figure(figsize=(15, 8))
328-
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection="full_axes")
328+
ax = fig.add_axes([0.04, 0.06, 0.90, 0.88], projection=GUI_AXES)
329329
death = n.death_event()
330330
death.display(ax)
331331
ax.set_xlim(17.5, 27.5), ax.set_ylim(31, 36), ax.grid()

examples/16_network/pet_replay_segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from matplotlib.ticker import FuncFormatter
1212
from numpy import where
1313

14-
import py_eddy_tracker.gui
1514
from py_eddy_tracker.data import get_demo_path
15+
from py_eddy_tracker.gui import GUI_AXES
1616
from py_eddy_tracker.observations.network import NetworkObservations
1717
from py_eddy_tracker.observations.tracking import TrackEddiesObservations
1818

@@ -24,7 +24,7 @@ def formatter(x, pos):
2424

2525
def start_axes(title=""):
2626
fig = plt.figure(figsize=(13, 6))
27-
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection="full_axes")
27+
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection=GUI_AXES)
2828
ax.set_xlim(19, 29), ax.set_ylim(31, 35.5)
2929
ax.set_aspect("equal")
3030
ax.set_title(title, weight="bold")

examples/16_network/pet_segmentation_anim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from matplotlib.colors import ListedColormap
1111
from numpy import ones, where
1212

13-
import py_eddy_tracker.gui
1413
from py_eddy_tracker.data import get_demo_path
14+
from py_eddy_tracker.gui import GUI_AXES
1515
from py_eddy_tracker.observations.network import NetworkObservations
1616
from py_eddy_tracker.observations.tracking import TrackEddiesObservations
1717

@@ -104,7 +104,7 @@ def update(i_frame):
104104

105105

106106
fig = plt.figure(figsize=(16, 9), dpi=60)
107-
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection="full_axes")
107+
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection=GUI_AXES)
108108
ax.set_title(f"{len(e)} observations to segment")
109109
ax.set_xlim(19, 29), ax.set_ylim(31, 35.5), ax.grid()
110110
vmax = TRACKS[-1].max()
@@ -121,6 +121,6 @@ def update(i_frame):
121121
# Final Result
122122
# ------------
123123
fig = plt.figure(figsize=(16, 9))
124-
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection="full_axes")
124+
ax = fig.add_axes([0.04, 0.06, 0.94, 0.88], projection=GUI_AXES)
125125
ax.set_xlim(19, 29), ax.set_ylim(31, 35.5), ax.grid()
126126
_ = ax.scatter(e.lon, e.lat, c=TRACKS[-1], cmap=cmap, vmin=0, vmax=vmax, s=20)

notebooks/python_module/06_grid_manipulation/pet_advect.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"import re\n\nfrom matplotlib import pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nfrom numpy import arange, isnan, meshgrid, ones\n\nimport py_eddy_tracker.gui\nfrom py_eddy_tracker.data import get_demo_path\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker.observations.observation import EddiesObservations"
29+
"import re\n\nfrom matplotlib import pyplot as plt\nfrom matplotlib.animation import FuncAnimation\nfrom numpy import arange, isnan, meshgrid, ones\n\nfrom py_eddy_tracker.data import get_demo_path\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker.gui import GUI_AXES\nfrom py_eddy_tracker.observations.observation import EddiesObservations"
3030
]
3131
},
3232
{
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"fig = plt.figure(figsize=(10, 5))\nax = fig.add_axes([0, 0, 1, 1], projection=\"full_axes\")\nax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()\nx, y = meshgrid(g.x_c, g.y_c)\na.filled(ax, facecolors=\"r\", alpha=0.1), c.filled(ax, facecolors=\"b\", alpha=0.1)\n_ = ax.quiver(x.T, y.T, g.grid(\"u\"), g.grid(\"v\"), scale=20)"
83+
"fig = plt.figure(figsize=(10, 5))\nax = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)\nax.set_xlim(19, 30), ax.set_ylim(31, 36.5), ax.grid()\nx, y = meshgrid(g.x_c, g.y_c)\na.filled(ax, facecolors=\"r\", alpha=0.1), c.filled(ax, facecolors=\"b\", alpha=0.1)\n_ = ax.quiver(x.T, y.T, g.grid(\"u\"), g.grid(\"v\"), scale=20)"
8484
]
8585
},
8686
{
@@ -145,7 +145,7 @@
145145
},
146146
"outputs": [],
147147
"source": [
148-
"def anim_ax(**kw):\n t = 0\n fig = plt.figure(figsize=(10, 5), dpi=55)\n axes = fig.add_axes([0, 0, 1, 1], projection=\"full_axes\")\n axes.set_xlim(19, 30), axes.set_ylim(31, 36.5), axes.grid()\n a.filled(axes, facecolors=\"r\", alpha=0.1), c.filled(axes, facecolors=\"b\", alpha=0.1)\n line = axes.plot([], [], \"k\", **kw)[0]\n return fig, axes.text(21, 32.1, \"\"), line, t\n\n\ndef update(i_frame, t_step):\n global t\n x, y = p.__next__()\n t += t_step\n l.set_data(x, y)\n txt.set_text(f\"T0 + {t:.1f} days\")"
148+
"def anim_ax(**kw):\n t = 0\n fig = plt.figure(figsize=(10, 5), dpi=55)\n axes = fig.add_axes([0, 0, 1, 1], projection=GUI_AXES)\n axes.set_xlim(19, 30), axes.set_ylim(31, 36.5), axes.grid()\n a.filled(axes, facecolors=\"r\", alpha=0.1), c.filled(axes, facecolors=\"b\", alpha=0.1)\n line = axes.plot([], [], \"k\", **kw)[0]\n return fig, axes.text(21, 32.1, \"\"), line, t\n\n\ndef update(i_frame, t_step):\n global t\n x, y = p.__next__()\n t += t_step\n l.set_data(x, y)\n txt.set_text(f\"T0 + {t:.1f} days\")"
149149
]
150150
},
151151
{
@@ -262,7 +262,7 @@
262262
"name": "python",
263263
"nbconvert_exporter": "python",
264264
"pygments_lexer": "ipython3",
265-
"version": "3.7.7"
265+
"version": "3.9.2"
266266
}
267267
},
268268
"nbformat": 4,

0 commit comments

Comments
 (0)