From 475e220877f880504efba5bf30db6bf0a81ffdd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 19:52:32 +0000 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 16d6ad0..decf17d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,4 @@ +import warnings import pandas as pd from typer.testing import CliRunner from population_trend import ( @@ -252,6 +253,7 @@ def test_render_population_trend_new_command_works(): ], ) + assert result.exit_code == 0 gtt.assert_exist(output_figure_render) gtt.if_exist_remove(output_figure_render) From 58ed9436947d94e1826f20290807f44a6d08a0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 20:00:02 +0000 Subject: [PATCH 02/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index decf17d..16d6ad0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,3 @@ -import warnings import pandas as pd from typer.testing import CliRunner from population_trend import ( @@ -253,7 +252,6 @@ def test_render_population_trend_new_command_works(): ], ) - assert result.exit_code == 0 gtt.assert_exist(output_figure_render) gtt.if_exist_remove(output_figure_render) From bb1087507293d952deb0efce7c51e82569c47e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 21:43:25 +0000 Subject: [PATCH 03/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20add=20mis?= =?UTF-8?q?sing=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/population_growth_model.py | 4 ++-- tests/test_Population_trend.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/population_trend/population_growth_model.py b/population_trend/population_growth_model.py index fc6df94..220a077 100644 --- a/population_trend/population_growth_model.py +++ b/population_trend/population_growth_model.py @@ -148,8 +148,8 @@ def set_x_lim(self): def set_labels(self): labels = {"english": {"ylabel": "Number of breeding pairs", "xlabel": "Seasons"}} - plt.ylabel(labels["english"]["ylabel"], size=20) - plt.xlabel(labels["english"]["xlabel"], size=20) + self.ax.set_ylabel(labels["english"]["ylabel"], size=20) + self.ax.set_xlabel(labels["english"]["xlabel"], size=20) def set_ticks(self): self.get_tick_step() diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index f4f0734..7c7da79 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -63,8 +63,8 @@ def tests_calculate_upper_limit(): Plotter = Plotter_Population_Trend_Model(cormorant_data_for_plotter, pop_model, tick_mode="full") -class Tests_Plotter_Population_Trend_Model: +class Tests_Plotter_Population_Trend_Model: def tests_init_(self): fig, ax = geci_plot() assert type(fig) == type(Plotter.fig) # noqa @@ -86,6 +86,12 @@ def tests_time_to_model(self): expected_last_point = 4.05 assert obtained[-1] == expected_last_point + def tests_set_labels(self): + Plotter.set_labels() + obtained_labels = [Plotter.ax.get_xlabel(), Plotter.ax.get_ylabel()] + expected_labels = ["Seasons", "Number of breeding pairs"] + assert obtained_labels == expected_labels + def tests_savefig(self): islet = "morro" default_path = f"reports/figures/cormorant_population_trend_{islet}.png" From e35a819155db27c0c033c1f932260b7d9933869c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 21:44:37 +0000 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=9B=91=F0=9F=A7=AA=20Fail=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_Population_trend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index 7c7da79..2e6e8a5 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -91,6 +91,10 @@ def tests_set_labels(self): obtained_labels = [Plotter.ax.get_xlabel(), Plotter.ax.get_ylabel()] expected_labels = ["Seasons", "Number of breeding pairs"] assert obtained_labels == expected_labels + Plotter.set_labels("spanish") + obtained_labels = [Plotter.ax.get_xlabel(), Plotter.ax.get_ylabel()] + expected_labels = ["Temporadas", "Número de parejas reproductivas"] + assert obtained_labels == expected_labels def tests_savefig(self): islet = "morro" From f81cb113eb72b034c1edac1d8e794d3038aa6fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Wed, 6 May 2026 21:46:02 +0000 Subject: [PATCH 05/10] =?UTF-8?q?=E2=9C=85=20Pass=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/population_growth_model.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/population_trend/population_growth_model.py b/population_trend/population_growth_model.py index 220a077..e6a16c1 100644 --- a/population_trend/population_growth_model.py +++ b/population_trend/population_growth_model.py @@ -146,10 +146,13 @@ def set_x_lim(self): self.ticks_positions.max(), ) - def set_labels(self): - labels = {"english": {"ylabel": "Number of breeding pairs", "xlabel": "Seasons"}} - self.ax.set_ylabel(labels["english"]["ylabel"], size=20) - self.ax.set_xlabel(labels["english"]["xlabel"], size=20) + def set_labels(self, language="english"): + labels = { + "english": {"ylabel": "Number of breeding pairs", "xlabel": "Seasons"}, + "spanish": {"ylabel": "Número de parejas reproductivas", "xlabel": "Temporadas"}, + } + self.ax.set_ylabel(labels[language]["ylabel"], size=20) + self.ax.set_xlabel(labels[language]["xlabel"], size=20) def set_ticks(self): self.get_tick_step() From 0029f65b0baa47d4958ba6ccb879fcd5928ecee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Thu, 7 May 2026 18:51:28 +0000 Subject: [PATCH 06/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20?= =?UTF-8?q?=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/plotter_population_trend_from_cpue.py | 4 ++-- population_trend/population_growth_model.py | 9 +++++---- tests/test_Population_trend.py | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/population_trend/plotter_population_trend_from_cpue.py b/population_trend/plotter_population_trend_from_cpue.py index aa5b66f..0303865 100644 --- a/population_trend/plotter_population_trend_from_cpue.py +++ b/population_trend/plotter_population_trend_from_cpue.py @@ -4,8 +4,8 @@ class Plotter_Population_Trend_Model_From_CPUE(Plotter_Population_Trend_Model): - def __init__(self, data, population_model, tick_mode="full"): - super().__init__(data, population_model, tick_mode) + def __init__(self, data, population_model, tick_mode="full", language="english"): + super().__init__(data, population_model, tick_mode, language) def set_labels(self): plt.ylabel("CPUE", size=20) diff --git a/population_trend/population_growth_model.py b/population_trend/population_growth_model.py index e6a16c1..81384a3 100644 --- a/population_trend/population_growth_model.py +++ b/population_trend/population_growth_model.py @@ -46,10 +46,11 @@ def max_model(self): class Plotter_Population_Trend_Model: - def __init__(self, data, population_model, tick_mode): + def __init__(self, data, population_model, tick_mode, language="english"): self.fig, self.ax = geci_plot() self.fill_missing_seasons(data) self.tick_mode = tick_mode + self.language = language self.seasons_to_plot = self.filled_data.index.values + 1 self.ticks_positions = ticks_positions_array(self.filled_data) self.plot_domain = np.linspace(self.ticks_positions.min(), self.ticks_positions.max(), 100) @@ -146,13 +147,13 @@ def set_x_lim(self): self.ticks_positions.max(), ) - def set_labels(self, language="english"): + def set_labels(self): labels = { "english": {"ylabel": "Number of breeding pairs", "xlabel": "Seasons"}, "spanish": {"ylabel": "Número de parejas reproductivas", "xlabel": "Temporadas"}, } - self.ax.set_ylabel(labels[language]["ylabel"], size=20) - self.ax.set_xlabel(labels[language]["xlabel"], size=20) + self.ax.set_ylabel(labels[self.language]["ylabel"], size=20) + self.ax.set_xlabel(labels[self.language]["xlabel"], size=20) def set_ticks(self): self.get_tick_step() diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index 2e6e8a5..af99a35 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -91,7 +91,8 @@ def tests_set_labels(self): obtained_labels = [Plotter.ax.get_xlabel(), Plotter.ax.get_ylabel()] expected_labels = ["Seasons", "Number of breeding pairs"] assert obtained_labels == expected_labels - Plotter.set_labels("spanish") + Plotter.language = "spanish" + Plotter.set_labels() obtained_labels = [Plotter.ax.get_xlabel(), Plotter.ax.get_ylabel()] expected_labels = ["Temporadas", "Número de parejas reproductivas"] assert obtained_labels == expected_labels From 47c64f32e202c20eee65d58f7f1096351d905186 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Thu, 7 May 2026 11:51:58 -0700 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=94=A8=20add=20message=20variable?= =?UTF-8?q?=20for=20commit=20customization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c86d84d..87af6c7 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ setup: clean install tests: pytest --verbose -tdd_current_test_file = tests/test_cli.py +tdd_current_test_file = tests/test_Population_trend.py red: format pytest --verbose $(tdd_current_test_file) \ && git restore tests/*.py \ @@ -87,7 +87,7 @@ green: format refactor: format pytest --verbose $(tdd_current_test_file) \ - && (git add ${module}/*.py tests/*.py && git commit -m "♻️ Refactor") \ + && (git add ${module}/*.py tests/*.py && git commit -m "♻️ Refactor ${m}") \ || git restore ${module}/*.py tests/*.py chmod g+w -R . From b01e6b73da4ddc09bf566aa9c74b81c41b072eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciencia=20de=20Datos=20=E2=80=A2=20GECI?= Date: Thu, 7 May 2026 18:58:15 +0000 Subject: [PATCH 08/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- population_trend/population_growth_model.py | 16 ++++++++-------- tests/test_Population_trend.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/population_trend/population_growth_model.py b/population_trend/population_growth_model.py index 81384a3..e1e76d0 100644 --- a/population_trend/population_growth_model.py +++ b/population_trend/population_growth_model.py @@ -53,7 +53,7 @@ def __init__(self, data, population_model, tick_mode, language="english"): self.language = language self.seasons_to_plot = self.filled_data.index.values + 1 self.ticks_positions = ticks_positions_array(self.filled_data) - self.plot_domain = np.linspace(self.ticks_positions.min(), self.ticks_positions.max(), 100) + self.domain_plot = np.linspace(self.ticks_positions.min(), self.ticks_positions.max(), 100) self.population_model = population_model self.interest_variable = population_model.interest_variable @@ -68,20 +68,20 @@ def fill_missing_seasons(self, data): def plot_smooth(self): self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.min_model, self.population_model.med_model, label="Confidence zone", color="powderblue", ) self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.med_model, self.population_model.max_model, color="powderblue", ) self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.min_model, self.population_model.max_model, color="powderblue", @@ -89,19 +89,19 @@ def plot_smooth(self): number_of_samples = len(self.population_model.bootstrap_distribution) for i in range(0, number_of_samples - 1, 10): self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.intern_model(i), self.population_model.med_model, color="powderblue", ) self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.intern_model(i), self.population_model.intern_model(i + 1), color="powderblue", ) self.ax.fill_between( - self.plot_domain, + self.domain_plot, self.population_model.intern_model(i + 1), self.population_model.med_model, color="powderblue", @@ -109,7 +109,7 @@ def plot_smooth(self): def plot_model(self): plt.plot( - self.plot_domain, + self.domain_plot, self.population_model.med_model, label="Population growth model", color="b", diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index af99a35..7120341 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -80,7 +80,7 @@ def test_Plotter_plot_data(self): assert len(Plotter.ax.get_lines()) == expected_one_line def tests_time_to_model(self): - obtained = Plotter.plot_domain + obtained = Plotter.domain_plot expected_first_point = 1 assert obtained[0] == expected_first_point expected_last_point = 4.05 From 412bcfe265ffb44cf034ad215acc0d1d34b9d4d2 Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 11 May 2026 14:41:45 -0700 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=8E=A8=20Pass=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_Population_trend.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_Population_trend.py b/tests/test_Population_trend.py index 7120341..dae38cc 100644 --- a/tests/test_Population_trend.py +++ b/tests/test_Population_trend.py @@ -63,7 +63,6 @@ def tests_calculate_upper_limit(): Plotter = Plotter_Population_Trend_Model(cormorant_data_for_plotter, pop_model, tick_mode="full") - class Tests_Plotter_Population_Trend_Model: def tests_init_(self): fig, ax = geci_plot() From 5e2b5d0d32f3ce93f54281166b18d01bf70c5cef Mon Sep 17 00:00:00 2001 From: Mario Villasante Date: Mon, 11 May 2026 14:56:01 -0700 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=92=AB=F0=9F=94=8A=20update=20CHANG?= =?UTF-8?q?ELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b19eb53..5abe5d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Spanish language support — `Plotter_Population_Trend_Model` and `Plotter_Population_Trend_Model_From_CPUE` now accept a language parameter "english" / "spanish") controlling axis label language. ### Fixed