population-trend 5.9.1__py3-none-any.whl → 5.10.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- population_trend/__init__.py +1 -1
- population_trend/cli.py +3 -2
- population_trend/plotter_population_trend_from_cpue.py +4 -1
- population_trend/population_growth_model.py +25 -16
- {population_trend-5.9.1.dist-info → population_trend-5.10.1.dist-info}/METADATA +3 -2
- population_trend-5.10.1.dist-info/RECORD +13 -0
- {population_trend-5.9.1.dist-info → population_trend-5.10.1.dist-info}/WHEEL +1 -1
- population_trend-5.9.1.dist-info/RECORD +0 -13
- {population_trend-5.9.1.dist-info → population_trend-5.10.1.dist-info}/entry_points.txt +0 -0
- {population_trend-5.9.1.dist-info → population_trend-5.10.1.dist-info/licenses}/LICENSE +0 -0
population_trend/__init__.py
CHANGED
population_trend/cli.py
CHANGED
|
@@ -68,7 +68,8 @@ def plot_population_trend(
|
|
|
68
68
|
intervals_path: Annotated[str, typer.Option()],
|
|
69
69
|
island: Annotated[str, typer.Option()] = "Guadalupe",
|
|
70
70
|
variable_of_interest: Annotated[str, typer.Option()] = "Maxima_cantidad_nidos",
|
|
71
|
-
|
|
71
|
+
tick_mode: Annotated[str, typer.Option()] = "full",
|
|
72
|
+
output_path: Annotated[str, typer.Option()] = "",
|
|
72
73
|
):
|
|
73
74
|
fit_data = pd.read_csv(data_path)
|
|
74
75
|
intervals_json = read_json(intervals_path)
|
|
@@ -77,7 +78,7 @@ def plot_population_trend(
|
|
|
77
78
|
Modelo_Tendencia_Poblacional = Population_Trend_Model(
|
|
78
79
|
fit_data, intervals_json, variable_of_interest
|
|
79
80
|
)
|
|
80
|
-
Graficador = Plotter_Population_Trend_Model(fit_data, Modelo_Tendencia_Poblacional)
|
|
81
|
+
Graficador = Plotter_Population_Trend_Model(fit_data, Modelo_Tendencia_Poblacional, tick_mode)
|
|
81
82
|
Graficador.plot_smooth()
|
|
82
83
|
Graficador.plot_model()
|
|
83
84
|
Graficador.plot_data()
|
|
@@ -4,13 +4,16 @@ import matplotlib.pyplot as plt
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Plotter_Population_Trend_Model_From_CPUE(Plotter_Population_Trend_Model):
|
|
7
|
+
def __init__(self, data, population_model, tick_mode="full"):
|
|
8
|
+
super().__init__(data, population_model, tick_mode)
|
|
9
|
+
|
|
7
10
|
def set_labels(self):
|
|
8
11
|
plt.ylabel("CPUE", size=20)
|
|
9
12
|
plt.xlabel("Seasons", size=20)
|
|
10
13
|
|
|
11
14
|
def plot_data(self):
|
|
12
15
|
plt.plot(
|
|
13
|
-
self.
|
|
16
|
+
self.seasons_to_plot,
|
|
14
17
|
self.data[self.interest_variable],
|
|
15
18
|
"-Dk",
|
|
16
19
|
label="Maximum CPUE",
|
|
@@ -4,12 +4,6 @@ from bootstrapping_tools import power_law, lambda_calculator
|
|
|
4
4
|
import matplotlib.pyplot as plt
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def normalize_seasons(df):
|
|
8
|
-
first_season = int(df.Temporada.min())
|
|
9
|
-
last_season = int(df.Temporada.max())
|
|
10
|
-
return np.linspace(first_season, last_season, last_season - first_season + 1).astype(int)
|
|
11
|
-
|
|
12
|
-
|
|
13
7
|
def calculate_model_domain(data):
|
|
14
8
|
last_value = data.Temporada.max() - data.Temporada.min()
|
|
15
9
|
return np.linspace(0, last_value, 100)
|
|
@@ -52,16 +46,25 @@ class Population_Trend_Model:
|
|
|
52
46
|
|
|
53
47
|
|
|
54
48
|
class Plotter_Population_Trend_Model:
|
|
55
|
-
def __init__(self, data, population_model):
|
|
49
|
+
def __init__(self, data, population_model, tick_mode):
|
|
56
50
|
self.fig, self.ax = geci_plot()
|
|
57
|
-
self.data
|
|
58
|
-
self.
|
|
59
|
-
self.
|
|
60
|
-
self.ticks_positions = ticks_positions_array(self.
|
|
51
|
+
self.fill_missing_seasons(data)
|
|
52
|
+
self.tick_mode = tick_mode
|
|
53
|
+
self.seasons_to_plot = self.filled_data.index.values + 1
|
|
54
|
+
self.ticks_positions = ticks_positions_array(self.filled_data)
|
|
61
55
|
self.plot_domain = np.linspace(self.ticks_positions.min(), self.ticks_positions.max(), 100)
|
|
62
56
|
self.population_model = population_model
|
|
63
57
|
self.interest_variable = population_model.interest_variable
|
|
64
58
|
|
|
59
|
+
def fill_missing_seasons(self, data):
|
|
60
|
+
self.data = data
|
|
61
|
+
self.data.Temporada = self.data.Temporada.astype(int)
|
|
62
|
+
self.data = self.data.set_index("Temporada")
|
|
63
|
+
full_seasons = range((self.data.index.min()), self.data.index.max() + 1)
|
|
64
|
+
self.filled_data = (
|
|
65
|
+
self.data.reindex(full_seasons).reset_index().rename(columns={"index": "Temporada"})
|
|
66
|
+
)
|
|
67
|
+
|
|
65
68
|
def plot_smooth(self):
|
|
66
69
|
self.ax.fill_between(
|
|
67
70
|
self.plot_domain,
|
|
@@ -113,9 +116,9 @@ class Plotter_Population_Trend_Model:
|
|
|
113
116
|
return self.fig
|
|
114
117
|
|
|
115
118
|
def plot_data(self):
|
|
116
|
-
|
|
117
|
-
self.
|
|
118
|
-
self.
|
|
119
|
+
self.ax.plot(
|
|
120
|
+
self.seasons_to_plot,
|
|
121
|
+
self.filled_data[self.interest_variable],
|
|
119
122
|
"-Dk",
|
|
120
123
|
label="Active Nests",
|
|
121
124
|
)
|
|
@@ -148,14 +151,20 @@ class Plotter_Population_Trend_Model:
|
|
|
148
151
|
plt.xlabel("Seasons", size=20)
|
|
149
152
|
|
|
150
153
|
def set_ticks(self):
|
|
154
|
+
self.get_tick_step()
|
|
155
|
+
self.ticks_text = self.filled_data.Temporada.values.astype(int)
|
|
151
156
|
plt.xticks(
|
|
152
|
-
self.ticks_positions,
|
|
153
|
-
self.ticks_text,
|
|
157
|
+
self.ticks_positions[:: self.tick_step],
|
|
158
|
+
self.ticks_text[:: self.tick_step],
|
|
154
159
|
rotation=90,
|
|
155
160
|
size=20,
|
|
156
161
|
)
|
|
157
162
|
plt.yticks(size=20)
|
|
158
163
|
|
|
164
|
+
def get_tick_step(self):
|
|
165
|
+
tick_modes = {"sparse": 2, "full": 1}
|
|
166
|
+
self.tick_step = tick_modes[self.tick_mode]
|
|
167
|
+
|
|
159
168
|
def draw(self):
|
|
160
169
|
plt.gcf().subplots_adjust(bottom=0.2)
|
|
161
170
|
plt.draw()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: population_trend
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.10.1
|
|
4
4
|
Summary: A population growth model package
|
|
5
5
|
Home-page: https://github.com/IslasGECI/population_trend
|
|
6
6
|
Author: Ciencia de Datos • GECI
|
|
@@ -8,6 +8,7 @@ Author-email: ciencia.datos@islas.org.mx
|
|
|
8
8
|
Requires-Python: >=3.9
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
11
|
+
License-File: LICENSE
|
|
11
12
|
Requires-Dist: bootstrapping-tools==3.*
|
|
12
13
|
Requires-Dist: geci-plots
|
|
13
14
|
Requires-Dist: typer[all]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
population_trend/__init__.py,sha256=TkjYAYGUs5qD3YS0-vKhNCOzMvcymInP2K-54zG1F2k,317
|
|
2
|
+
population_trend/calculate_growth_rates.py,sha256=qD-a6O17CEhgKo0KmGzVGRpGuKpDQnno16MD3DgjVrk,6003
|
|
3
|
+
population_trend/cli.py,sha256=nSj4noSN7walhWoR02qUiSUx1LNIZsgD0MkeIdb4mI8,5534
|
|
4
|
+
population_trend/filter_data.py,sha256=D0Y1vztcbbo98af9q7wRhlHfH__bNFI8tnVOdJY6hu0,403
|
|
5
|
+
population_trend/plotter_growth_rate.py,sha256=jWMETGAahYNedyGJmxEzvjJdSNSPDsrpGlXrGIgDLQQ,1175
|
|
6
|
+
population_trend/plotter_population_trend_from_cpue.py,sha256=qXqqI-yDOMCx7LNCAQJz9Yaxbcw1IyS-dh-qyWBvMIs,1481
|
|
7
|
+
population_trend/population_growth_model.py,sha256=QKwxy4yOL00WVjhASwL_vz6WKzbgyOZWITQStjcm6J0,6456
|
|
8
|
+
population_trend/regional_lambdas.py,sha256=5eCRXf9RWS0c6BG5F-Exico0GNMuUNyexZ0ZJKgOmp4,5274
|
|
9
|
+
population_trend-5.10.1.dist-info/entry_points.txt,sha256=qVw9tnlMx7q2AnksVC2H4oK4ufQrdrbBzSODLH-bcac,61
|
|
10
|
+
population_trend-5.10.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
11
|
+
population_trend-5.10.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
12
|
+
population_trend-5.10.1.dist-info/METADATA,sha256=8MoyczHBwYEXw0cGVyZ4OtoFEBdubapm1mxR4bctATA,1353
|
|
13
|
+
population_trend-5.10.1.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
population_trend/__init__.py,sha256=IKO9fZhfnavlCZgtkAkXVvIOV4zIie7auj4Ec9IjSNk,316
|
|
2
|
-
population_trend/calculate_growth_rates.py,sha256=qD-a6O17CEhgKo0KmGzVGRpGuKpDQnno16MD3DgjVrk,6003
|
|
3
|
-
population_trend/cli.py,sha256=wsAYBTBpegnvom_UCQqTyDgdE6OqraZ68EjcfXO3lJg,5435
|
|
4
|
-
population_trend/filter_data.py,sha256=D0Y1vztcbbo98af9q7wRhlHfH__bNFI8tnVOdJY6hu0,403
|
|
5
|
-
population_trend/plotter_growth_rate.py,sha256=jWMETGAahYNedyGJmxEzvjJdSNSPDsrpGlXrGIgDLQQ,1175
|
|
6
|
-
population_trend/plotter_population_trend_from_cpue.py,sha256=US8h948Mtb9AQpDYfvt1c-35i2if9HxqcOp1q_R-rio,1351
|
|
7
|
-
population_trend/population_growth_model.py,sha256=LWgMyEJqHY9M5Xuv9nVFSfX5_X61tXCBS2n-kvY8pNk,6002
|
|
8
|
-
population_trend/regional_lambdas.py,sha256=5eCRXf9RWS0c6BG5F-Exico0GNMuUNyexZ0ZJKgOmp4,5274
|
|
9
|
-
population_trend-5.9.1.dist-info/entry_points.txt,sha256=qVw9tnlMx7q2AnksVC2H4oK4ufQrdrbBzSODLH-bcac,61
|
|
10
|
-
population_trend-5.9.1.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
11
|
-
population_trend-5.9.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
12
|
-
population_trend-5.9.1.dist-info/METADATA,sha256=vs5I3SAYU6Kvv3PS8_otOxkwFKTCMiBJtm7WhDWA6u0,1330
|
|
13
|
-
population_trend-5.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|