Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ repos:
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
language: system
args: ["--install-types", "--non-interactive"]
pass_filenames: false
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.11.1
# hooks:
# - id: mypy
# language: system
# args: ["--install-types", "--non-interactive"]
# pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ruff:
test:
uv run pytest

mypy:
uv run mypy --install-types --non-interactive
#mypy:
# uv run mypy --install-types --non-interactive

docker: build run

Expand Down
2 changes: 1 addition & 1 deletion config_land.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ outbounds_is_land = [false]
popsize = [500]
L = [200]
num_pieces = [1]
K = [12]
K = [9]
sigma0 = [2]
tolfun = [1e-3]
damping = [1.0]
Expand Down
1 change: 1 addition & 0 deletions config_noland.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ sigma0 = [0.5, 1, 1.5, 2, 2.5, 3]
tolfun = [1e-3]
damping = [1.0]
maxfevals = [500000]
cmaes_seed = [0, 1, 2, 3, 4]

[refiner.fms]
tolfun = [1e-6]
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"fastapi",
"uvicorn",
"typer-slim",
"jax[cuda12]>=0.4.33",
"jax>=0.4.33",
"matplotlib>=3.9.2",
"cma>=4.0.0",
"pytest>=8.3.2",
Expand Down Expand Up @@ -93,4 +93,7 @@ dev-dependencies = [
"ipykernel",
]

[project.optional-dependencies]
cuda = ["jax[cuda]>=0.4.33"]


20 changes: 14 additions & 6 deletions routetools/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
"FMS": "green",
}

DICT_VF_NAMES = {
"circular": "Circular",
"fourvortices": "Four Vortices",
"doublegyre": "Double Gyre",
"techy": "Techy",
"swirlys": "Swirlys",
}


def plot_curve(
vectorfield: Callable[
Expand Down Expand Up @@ -108,7 +116,7 @@ def plot_curve(
curve[:, 0],
curve[:, 1],
marker="o",
markersize=2,
markersize=1,
label=label,
zorder=2,
color=color,
Expand Down Expand Up @@ -186,6 +194,8 @@ def plot_route_from_json(path_json: str) -> tuple[Figure, Axes]:
water_level = data["water_level"]
resolution = data.get("resolution", 0)
random_seed = data.get("random_seed", 0)
k = data.get("K")
sigma0 = data.get("sigma0")

# Generate the land
if resolution != 0:
Expand Down Expand Up @@ -219,12 +229,10 @@ def plot_route_from_json(path_json: str) -> tuple[Figure, Axes]:
)
# Set the title and tight layout
if water_level == 1:
title = vfname
vf = DICT_VF_NAMES.get(vfname, vfname)
title = f"{vf} | K = {int(k)} | " + r"$\sigma_0$ = " + f"{sigma0:.1f}"
else:
title = (
f"Water level: {water_level} | Resolution: {resolution} | "
+ f"Seed: {random_seed}"
)
title = f"Water level: {water_level:.1f} | Resolution: {int(resolution)}"
ax.set_title(title)
fig.tight_layout()
return fig, ax
Expand Down
Loading
Loading