Skip to content

Commit 460e8e3

Browse files
Merge pull request AntSimi#78 from AntSimi/visvalingam
Visvalingam
2 parents 4bf8147 + 8dfa98b commit 460e8e3

26 files changed

+155
-140
lines changed

.github/workflows/python-app.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
name: Pytest & Flake8
55

6-
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
6+
on: [push, pull_request]
117

128
jobs:
139
build:

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, array, pi
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
from py_eddy_tracker.generic import coordinates_to_local, local_to_coordinates
@@ -52,7 +52,7 @@ def formatter(x, pos):
5252

5353
def start_axes(title=""):
5454
fig = plt.figure(figsize=(13, 6))
55-
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection="full_axes")
55+
ax = fig.add_axes([0.03, 0.03, 0.90, 0.94], projection=GUI_AXES)
5656
ax.set_xlim(19, 29), ax.set_ylim(31, 35.5)
5757
ax.set_aspect("equal")
5858
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)

0 commit comments

Comments
 (0)