population-trend 5.9.1__py3-none-any.whl → 5.10.0__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.
@@ -1,6 +1,6 @@
1
1
  """A population growth model package"""
2
2
 
3
- __version__ = "5.9.1"
3
+ __version__ = "5.10.0"
4
4
  from .calculate_growth_rates import * # noqa
5
5
  from .cli import * # noqa
6
6
  from .filter_data import * # noqa
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
- output_path=None,
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,6 +4,9 @@ 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)
@@ -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,12 +46,13 @@ 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
51
  self.data = data
58
- self.plot_seasons = self.data["Temporada"][:] - self.data["Temporada"].iloc[0] + 1
59
- self.ticks_text = normalize_seasons(self.data)
60
- self.ticks_positions = ticks_positions_array(self.ticks_text)
52
+ self.tick_mode = tick_mode
53
+ self.ticks_text = self.data.Temporada.values.astype(int)
54
+ self.ticks_positions = ticks_positions_array(self.data)
55
+ self.plot_seasons = self.data.index.values + 1
61
56
  self.plot_domain = np.linspace(self.ticks_positions.min(), self.ticks_positions.max(), 100)
62
57
  self.population_model = population_model
63
58
  self.interest_variable = population_model.interest_variable
@@ -148,14 +143,19 @@ class Plotter_Population_Trend_Model:
148
143
  plt.xlabel("Seasons", size=20)
149
144
 
150
145
  def set_ticks(self):
146
+ self.get_tick_step()
151
147
  plt.xticks(
152
- self.ticks_positions,
153
- self.ticks_text,
148
+ self.ticks_positions[:: self.tick_step],
149
+ self.ticks_text[:: self.tick_step],
154
150
  rotation=90,
155
151
  size=20,
156
152
  )
157
153
  plt.yticks(size=20)
158
154
 
155
+ def get_tick_step(self):
156
+ tick_modes = {"sparse": 2, "full": 1}
157
+ self.tick_step = tick_modes[self.tick_mode]
158
+
159
159
  def draw(self):
160
160
  plt.gcf().subplots_adjust(bottom=0.2)
161
161
  plt.draw()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: population_trend
3
- Version: 5.9.1
3
+ Version: 5.10.0
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=WEnt5bUqsnO-BLEmO9jIKRoHh3tuHj0wyK7FxTP2yuk,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=Ig499pjnUdhkNs4rT71fkAU4j7RpLeqTNKX-JH1Ju_o,1478
7
+ population_trend/population_growth_model.py,sha256=XftOLHs5cigocvU5GpUnwA6yWK-ospr8iSlIa0hEcyU,6003
8
+ population_trend/regional_lambdas.py,sha256=5eCRXf9RWS0c6BG5F-Exico0GNMuUNyexZ0ZJKgOmp4,5274
9
+ population_trend-5.10.0.dist-info/entry_points.txt,sha256=qVw9tnlMx7q2AnksVC2H4oK4ufQrdrbBzSODLH-bcac,61
10
+ population_trend-5.10.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ population_trend-5.10.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
12
+ population_trend-5.10.0.dist-info/METADATA,sha256=OZsrguT89x12gQtmWrQsE7WwZlXywVvcHO0rlZxNz_g,1353
13
+ population_trend-5.10.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.9.0
2
+ Generator: flit 3.12.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -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,,