pytrendy 2.0.0.dev8__tar.gz → 2.0.0.dev9__tar.gz
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.
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/PKG-INFO +2 -1
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pyproject.toml +3 -2
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/plot_pytrendy.py +16 -1
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/process_signals.py +9 -7
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/LICENSE +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/README.md +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/__init__.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/detect_trends.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/__init__.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/data/classes_signals.csv +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/data/series_synthetic.csv +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/data_loader.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/prep_index.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/prep_signal_params.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/io/results_pytrendy.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/__init__.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_analyse.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_get.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/__init__.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/abrupt_shaving.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/artifact_cleanup.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/gradual_expand_contract.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/segment_grouping.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/trend_classify.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/update_neighbours.py +0 -0
- {pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/simpledtw.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytrendy
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev9
|
|
4
4
|
Summary: Trend Detection in Python. Applicable for real-world industry use cases in time series.
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -52,6 +52,7 @@ Requires-Dist: mkdocstrings (>=0.28.3,<1) ; extra == "docs"
|
|
|
52
52
|
Requires-Dist: mkdocstrings-python (>=1.16,<2) ; extra == "docs"
|
|
53
53
|
Requires-Dist: numpy
|
|
54
54
|
Requires-Dist: pandas
|
|
55
|
+
Requires-Dist: pymdown-extensions (<12.2) ; extra == "docs"
|
|
55
56
|
Requires-Dist: pytest ; extra == "dev"
|
|
56
57
|
Requires-Dist: pytest-cov ; extra == "dev"
|
|
57
58
|
Requires-Dist: pytest-mpl ; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pytrendy"
|
|
3
|
-
version = "2.0.0.
|
|
3
|
+
version = "2.0.0.dev9"
|
|
4
4
|
description = "Trend Detection in Python. Applicable for real-world industry use cases in time series."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Russell Sammut Bonnici", email = "r.sammutbonnici@gmail.com" },
|
|
@@ -62,7 +62,8 @@ docs = [
|
|
|
62
62
|
"mkdocs-api-autonav==0.4.0",
|
|
63
63
|
"mkdocstrings>=0.28.3,<1",
|
|
64
64
|
"mkdocstrings-python>=1.16,<2",
|
|
65
|
-
"mkdocs-jupyterlite==0.4.1"
|
|
65
|
+
"mkdocs-jupyterlite==0.4.1",
|
|
66
|
+
"pymdown-extensions<12.2"
|
|
66
67
|
]
|
|
67
68
|
|
|
68
69
|
[project.urls]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
import numpy as np
|
|
5
|
+
import matplotlib
|
|
5
6
|
import matplotlib.pyplot as plt
|
|
6
7
|
import matplotlib.dates as mdates
|
|
7
8
|
import matplotlib.patches as mpatches
|
|
@@ -44,6 +45,19 @@ def _annotation_color(color):
|
|
|
44
45
|
return (r * 0.7, g * 0.7, b * 0.7)
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
def _show_plot() -> None:
|
|
49
|
+
"""Display the current figure, skipping backends that cannot show a window.
|
|
50
|
+
|
|
51
|
+
Non-interactive backends (e.g. Agg under CI or a headless environment) emit
|
|
52
|
+
a ``UserWarning`` from ``plt.show()``; callers such as ``suppress_show=False``
|
|
53
|
+
still expect the figure to be drawn to its canvas, so only skip the display
|
|
54
|
+
call itself.
|
|
55
|
+
"""
|
|
56
|
+
from matplotlib.backends.registry import BackendFilter, backend_registry
|
|
57
|
+
if matplotlib.get_backend().lower() not in backend_registry.list_builtin(BackendFilter.NON_INTERACTIVE):
|
|
58
|
+
plt.show()
|
|
59
|
+
|
|
60
|
+
|
|
47
61
|
def _safe_adjacent(index, pos, offset):
|
|
48
62
|
"""
|
|
49
63
|
Safely get an adjacent index value with bounds checking.
|
|
@@ -624,5 +638,6 @@ def plot_pytrendy(df: pd.DataFrame, value_col: str, segments_enhanced: list[dict
|
|
|
624
638
|
|
|
625
639
|
plt.tight_layout()
|
|
626
640
|
if not suppress_show:
|
|
627
|
-
|
|
641
|
+
_show_plot()
|
|
628
642
|
return fig
|
|
643
|
+
|
|
@@ -216,40 +216,42 @@ def process_signals(df: pd.DataFrame, value_col: str, method_params: dict, signa
|
|
|
216
216
|
if debug:
|
|
217
217
|
import matplotlib.pyplot as plt
|
|
218
218
|
|
|
219
|
+
from .io.plot_pytrendy import _show_plot
|
|
220
|
+
|
|
219
221
|
ax = df[[value_col, 'snr']].plot(figsize=(20,3), secondary_y='snr')
|
|
220
222
|
ax.right_ax.axhline(y=signal_params['threshold_noise'], color='gray', linestyle='--', linewidth=2)
|
|
221
223
|
plt.title("Signal-Noise Ratio (SNR)")
|
|
222
|
-
|
|
224
|
+
_show_plot()
|
|
223
225
|
|
|
224
226
|
ax = df[[value_col, 'noise_flag']].plot(figsize=(20,3), secondary_y='noise_flag')
|
|
225
227
|
ax.right_ax.axhline(y=0, color='gray', linestyle='--', linewidth=2)
|
|
226
228
|
plt.title("Noise Flag")
|
|
227
|
-
|
|
229
|
+
_show_plot()
|
|
228
230
|
|
|
229
231
|
ax = df[[value_col, 'smoothed']].plot(figsize=(20,3), secondary_y='smoothed')
|
|
230
232
|
ax.right_ax.axhline(y=0, color='gray', linestyle='--', linewidth=2)
|
|
231
233
|
plt.title("Smoothed")
|
|
232
|
-
|
|
234
|
+
_show_plot()
|
|
233
235
|
|
|
234
236
|
ax = df[[value_col, 'smoothed_std']].plot(figsize=(20,3), secondary_y='smoothed_std')
|
|
235
237
|
ax.right_ax.axhline(y=0, color='gray', linestyle='--', linewidth=2)
|
|
236
238
|
plt.title("Smoothed Std")
|
|
237
|
-
|
|
239
|
+
_show_plot()
|
|
238
240
|
|
|
239
241
|
ax = df[[value_col, 'flat_flag']].plot(figsize=(20,3), secondary_y='flat_flag')
|
|
240
242
|
ax.right_ax.axhline(y=0, color='gray', linestyle='--', linewidth=2)
|
|
241
243
|
plt.title("Flat Flag")
|
|
242
|
-
|
|
244
|
+
_show_plot()
|
|
243
245
|
|
|
244
246
|
ax = df[[value_col, 'smoothed_deriv']].plot(figsize=(20,3), secondary_y='smoothed_deriv')
|
|
245
247
|
ax.right_ax.axhline(y=derivative_limit, color='gray', linestyle='--', linewidth=2)
|
|
246
248
|
ax.right_ax.axhline(y=-derivative_limit, color='gray', linestyle=':', linewidth=2)
|
|
247
249
|
plt.title("Smoothed Derivative")
|
|
248
|
-
|
|
250
|
+
_show_plot()
|
|
249
251
|
|
|
250
252
|
ax = df[[value_col, 'trend_flag']].plot(figsize=(20,3), secondary_y='trend_flag')
|
|
251
253
|
ax.right_ax.axhline(y=0, color='gray', linestyle='--', linewidth=2)
|
|
252
254
|
plt.title("Trend Flag")
|
|
253
|
-
|
|
255
|
+
_show_plot()
|
|
254
256
|
|
|
255
257
|
return df
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrendy-2.0.0.dev8 → pytrendy-2.0.0.dev9}/pytrendy/post_processing/segments_refine/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|