direl-ts-tool-kit 0.8.0__tar.gz → 0.9.0__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.
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/LICENCE +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/PKG-INFO +23 -1
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/README.md +22 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/__init__.py +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/plot/__init__.py +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/plot/plot_style.py +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/plot/plot_ts.py +76 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/utilities/__init__.py +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/utilities/data_prep.py +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/PKG-INFO +23 -1
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/SOURCES.txt +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/dependency_links.txt +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/requires.txt +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/top_level.txt +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/setup.cfg +0 -0
- {direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/setup.py +1 -1
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: direl-ts-tool-kit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: A toolbox for time series analysis and visualization.
|
|
5
5
|
Home-page: https://gitlab.com/direl/direl_tool_kit
|
|
6
6
|
Author: Diego Restrepo-Leal
|
|
@@ -89,6 +89,7 @@ This function automatically sets major and minor time-based locators
|
|
|
89
89
|
on the x-axis based on the specified time unit, and formats the y-axis
|
|
90
90
|
to use scientific notation.
|
|
91
91
|
|
|
92
|
+
|
|
92
93
|
#### plot_interpolation_analysis
|
|
93
94
|
`plot_interpolation_analysis(df_original, variable, units="", method="polynomial", order=2, imputation_se=None, time_unit="Year", rot=90)`
|
|
94
95
|
|
|
@@ -105,6 +106,7 @@ Saves a Matplotlib figure in three common high-quality formats (PNG, PDF, SVG).
|
|
|
105
106
|
The function creates a consistent file name structure:
|
|
106
107
|
{path}/{file_name}_{variable_name}.{extension}.
|
|
107
108
|
|
|
109
|
+
|
|
108
110
|
#### heat_map
|
|
109
111
|
`heat_map(X, y, colors="Blues")`
|
|
110
112
|
|
|
@@ -113,6 +115,7 @@ Generates a correlation heatmap plot for a set of features and a target variable
|
|
|
113
115
|
This function concatenates the feature DataFrame (X) and the target Series (y)
|
|
114
116
|
to compute and visualize the full pairwise correlation matrix using Seaborn.
|
|
115
117
|
|
|
118
|
+
|
|
116
119
|
#### pair_plot
|
|
117
120
|
`pair_plot(X, y)`
|
|
118
121
|
|
|
@@ -133,6 +136,25 @@ Generates a histogram plot for a specified numerical variable.
|
|
|
133
136
|
The plot visualizes the distribution of the data, with the Y-axis dynamically
|
|
134
137
|
labeled as 'Density' or 'Count' based on the `density` parameter.
|
|
135
138
|
|
|
139
|
+
|
|
140
|
+
#### plot_data_boxplot
|
|
141
|
+
`plot_data_boxplot(df, variable=None, x_label="", y_label="", grid=False, notch=False)`
|
|
142
|
+
|
|
143
|
+
Generates a boxplot visualization, either for all numerical columns in the
|
|
144
|
+
DataFrame or for a single specified variable.
|
|
145
|
+
|
|
146
|
+
The function applies consistent styling for the boxes, outliers, and median
|
|
147
|
+
lines using predefined colors from 'paper_colors'.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
#### plot_periodogram
|
|
151
|
+
|
|
152
|
+
`plot_periodogram(ts, detrend="linear", ax=None, fs=365.0, color="BLUE_LINES")`
|
|
153
|
+
|
|
154
|
+
Plots the power spectrum (periodogram) of a time series to identify
|
|
155
|
+
dominant frequencies (periodicity).
|
|
156
|
+
|
|
157
|
+
|
|
136
158
|
# Examples
|
|
137
159
|
- [Example 1](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_01.md?ref_type=heads)
|
|
138
160
|
- [Example 2](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_02.md?ref_type=heads)
|
|
@@ -56,6 +56,7 @@ This function automatically sets major and minor time-based locators
|
|
|
56
56
|
on the x-axis based on the specified time unit, and formats the y-axis
|
|
57
57
|
to use scientific notation.
|
|
58
58
|
|
|
59
|
+
|
|
59
60
|
#### plot_interpolation_analysis
|
|
60
61
|
`plot_interpolation_analysis(df_original, variable, units="", method="polynomial", order=2, imputation_se=None, time_unit="Year", rot=90)`
|
|
61
62
|
|
|
@@ -72,6 +73,7 @@ Saves a Matplotlib figure in three common high-quality formats (PNG, PDF, SVG).
|
|
|
72
73
|
The function creates a consistent file name structure:
|
|
73
74
|
{path}/{file_name}_{variable_name}.{extension}.
|
|
74
75
|
|
|
76
|
+
|
|
75
77
|
#### heat_map
|
|
76
78
|
`heat_map(X, y, colors="Blues")`
|
|
77
79
|
|
|
@@ -80,6 +82,7 @@ Generates a correlation heatmap plot for a set of features and a target variable
|
|
|
80
82
|
This function concatenates the feature DataFrame (X) and the target Series (y)
|
|
81
83
|
to compute and visualize the full pairwise correlation matrix using Seaborn.
|
|
82
84
|
|
|
85
|
+
|
|
83
86
|
#### pair_plot
|
|
84
87
|
`pair_plot(X, y)`
|
|
85
88
|
|
|
@@ -100,6 +103,25 @@ Generates a histogram plot for a specified numerical variable.
|
|
|
100
103
|
The plot visualizes the distribution of the data, with the Y-axis dynamically
|
|
101
104
|
labeled as 'Density' or 'Count' based on the `density` parameter.
|
|
102
105
|
|
|
106
|
+
|
|
107
|
+
#### plot_data_boxplot
|
|
108
|
+
`plot_data_boxplot(df, variable=None, x_label="", y_label="", grid=False, notch=False)`
|
|
109
|
+
|
|
110
|
+
Generates a boxplot visualization, either for all numerical columns in the
|
|
111
|
+
DataFrame or for a single specified variable.
|
|
112
|
+
|
|
113
|
+
The function applies consistent styling for the boxes, outliers, and median
|
|
114
|
+
lines using predefined colors from 'paper_colors'.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
#### plot_periodogram
|
|
118
|
+
|
|
119
|
+
`plot_periodogram(ts, detrend="linear", ax=None, fs=365.0, color="BLUE_LINES")`
|
|
120
|
+
|
|
121
|
+
Plots the power spectrum (periodogram) of a time series to identify
|
|
122
|
+
dominant frequencies (periodicity).
|
|
123
|
+
|
|
124
|
+
|
|
103
125
|
# Examples
|
|
104
126
|
- [Example 1](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_01.md?ref_type=heads)
|
|
105
127
|
- [Example 2](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_02.md?ref_type=heads)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,6 +2,7 @@ import numpy as np
|
|
|
2
2
|
import pandas as pd
|
|
3
3
|
from .plot_style import *
|
|
4
4
|
from scipy.stats import pearsonr
|
|
5
|
+
from scipy.signal import periodogram
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def plot_time_series(
|
|
@@ -548,3 +549,78 @@ def plot_data_boxplot(
|
|
|
548
549
|
ax.tick_params(axis="x")
|
|
549
550
|
|
|
550
551
|
return fig
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
def plot_periodogram(
|
|
555
|
+
ts,
|
|
556
|
+
detrend="linear",
|
|
557
|
+
ax=None,
|
|
558
|
+
fs=365.0,
|
|
559
|
+
color="BLUE_LINES",
|
|
560
|
+
):
|
|
561
|
+
"""
|
|
562
|
+
Plots the power spectrum (periodogram) of a time series to identify
|
|
563
|
+
dominant frequencies (periodicity).
|
|
564
|
+
|
|
565
|
+
Parameters
|
|
566
|
+
----------
|
|
567
|
+
ts : pd.Series or np.ndarray
|
|
568
|
+
The time series data to analyze.
|
|
569
|
+
detrend : str, optional
|
|
570
|
+
Method to remove the linear trend ('linear' or 'constant'). Defaults to 'linear'.
|
|
571
|
+
ax : matplotlib.axes.Axes, optional
|
|
572
|
+
Existing Axes to draw the plot on. If None, a new figure and axes are created.
|
|
573
|
+
fs : float, optional
|
|
574
|
+
The sampling frequency of the time series (cycles per unit of time).
|
|
575
|
+
Default value 365.0 assumes daily data, leading to frequencies in cycles/year.
|
|
576
|
+
color : str, optional
|
|
577
|
+
Key corresponding to the line color in the global 'paper_colors' dictionary.
|
|
578
|
+
Defaults to "BLUE_LINES".
|
|
579
|
+
|
|
580
|
+
Returns
|
|
581
|
+
-------
|
|
582
|
+
matplotlib.figure.Figure
|
|
583
|
+
The generated Matplotlib Figure object.
|
|
584
|
+
|
|
585
|
+
Notes
|
|
586
|
+
-----
|
|
587
|
+
The X-axis labels are hardcoded to common periodicities (Annual, Monthly, Weekly)
|
|
588
|
+
and assume a sampling frequency of 365.0 (daily data).
|
|
589
|
+
"""
|
|
590
|
+
|
|
591
|
+
freqencies, spectrum = periodogram(
|
|
592
|
+
ts,
|
|
593
|
+
fs=fs,
|
|
594
|
+
detrend=detrend,
|
|
595
|
+
window="boxcar",
|
|
596
|
+
scaling="spectrum",
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
if ax is None:
|
|
600
|
+
fig, ax = plt.subplots()
|
|
601
|
+
else:
|
|
602
|
+
fig = ax.figure
|
|
603
|
+
|
|
604
|
+
ax.step(freqencies, spectrum, linewidth=3, color=paper_colors[color])
|
|
605
|
+
ax.set_xscale("log")
|
|
606
|
+
ax.set_xticks([1, 2, 4, 6, 12, 26, 52, 104])
|
|
607
|
+
|
|
608
|
+
ax.set_xticklabels(
|
|
609
|
+
[
|
|
610
|
+
"Annual (1)",
|
|
611
|
+
"Semiannual (2)",
|
|
612
|
+
"Quarterly (4)",
|
|
613
|
+
"Bimonthly (6)",
|
|
614
|
+
"Monthly (12)",
|
|
615
|
+
"Biweekly (26)",
|
|
616
|
+
"Weekly (52)",
|
|
617
|
+
"Semiweekly (104)",
|
|
618
|
+
],
|
|
619
|
+
rotation=90,
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
ax.ticklabel_format(axis="y", style="sci", scilimits=(0, 0))
|
|
623
|
+
ax.set_ylabel("Variance")
|
|
624
|
+
ax.grid(alpha=0.8, linestyle="--")
|
|
625
|
+
|
|
626
|
+
return fig
|
|
File without changes
|
{direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit/utilities/data_prep.py
RENAMED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: direl-ts-tool-kit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: A toolbox for time series analysis and visualization.
|
|
5
5
|
Home-page: https://gitlab.com/direl/direl_tool_kit
|
|
6
6
|
Author: Diego Restrepo-Leal
|
|
@@ -89,6 +89,7 @@ This function automatically sets major and minor time-based locators
|
|
|
89
89
|
on the x-axis based on the specified time unit, and formats the y-axis
|
|
90
90
|
to use scientific notation.
|
|
91
91
|
|
|
92
|
+
|
|
92
93
|
#### plot_interpolation_analysis
|
|
93
94
|
`plot_interpolation_analysis(df_original, variable, units="", method="polynomial", order=2, imputation_se=None, time_unit="Year", rot=90)`
|
|
94
95
|
|
|
@@ -105,6 +106,7 @@ Saves a Matplotlib figure in three common high-quality formats (PNG, PDF, SVG).
|
|
|
105
106
|
The function creates a consistent file name structure:
|
|
106
107
|
{path}/{file_name}_{variable_name}.{extension}.
|
|
107
108
|
|
|
109
|
+
|
|
108
110
|
#### heat_map
|
|
109
111
|
`heat_map(X, y, colors="Blues")`
|
|
110
112
|
|
|
@@ -113,6 +115,7 @@ Generates a correlation heatmap plot for a set of features and a target variable
|
|
|
113
115
|
This function concatenates the feature DataFrame (X) and the target Series (y)
|
|
114
116
|
to compute and visualize the full pairwise correlation matrix using Seaborn.
|
|
115
117
|
|
|
118
|
+
|
|
116
119
|
#### pair_plot
|
|
117
120
|
`pair_plot(X, y)`
|
|
118
121
|
|
|
@@ -133,6 +136,25 @@ Generates a histogram plot for a specified numerical variable.
|
|
|
133
136
|
The plot visualizes the distribution of the data, with the Y-axis dynamically
|
|
134
137
|
labeled as 'Density' or 'Count' based on the `density` parameter.
|
|
135
138
|
|
|
139
|
+
|
|
140
|
+
#### plot_data_boxplot
|
|
141
|
+
`plot_data_boxplot(df, variable=None, x_label="", y_label="", grid=False, notch=False)`
|
|
142
|
+
|
|
143
|
+
Generates a boxplot visualization, either for all numerical columns in the
|
|
144
|
+
DataFrame or for a single specified variable.
|
|
145
|
+
|
|
146
|
+
The function applies consistent styling for the boxes, outliers, and median
|
|
147
|
+
lines using predefined colors from 'paper_colors'.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
#### plot_periodogram
|
|
151
|
+
|
|
152
|
+
`plot_periodogram(ts, detrend="linear", ax=None, fs=365.0, color="BLUE_LINES")`
|
|
153
|
+
|
|
154
|
+
Plots the power spectrum (periodogram) of a time series to identify
|
|
155
|
+
dominant frequencies (periodicity).
|
|
156
|
+
|
|
157
|
+
|
|
136
158
|
# Examples
|
|
137
159
|
- [Example 1](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_01.md?ref_type=heads)
|
|
138
160
|
- [Example 2](https://gitlab.com/direl/direl_tool_kit/-/blob/main/example/example_02.md?ref_type=heads)
|
|
File without changes
|
{direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{direl_ts_tool_kit-0.8.0 → direl_ts_tool_kit-0.9.0}/direl_ts_tool_kit.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="direl-ts-tool-kit",
|
|
5
|
-
version="0.
|
|
5
|
+
version="0.9.0",
|
|
6
6
|
description="A toolbox for time series analysis and visualization.",
|
|
7
7
|
long_description=open("README.md", encoding="utf-8").read(),
|
|
8
8
|
long_description_content_type="text/markdown",
|