Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarandas committed May 6, 2022
2 parents 3770557 + b611f4f commit ff706bf
Show file tree
Hide file tree
Showing 17 changed files with 2,301 additions and 1,398 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Changelog
=========

Version 0.1.5-dev
=============
- Changes
- Feature ``total energy`` changed name to ``average power``
- Features ``peak to peak``, ``absolute energy`` and ``entropy`` are now classified as statistical


Version 0.1.4
=============
- Bugfixes
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ X = tsfel.feature_extraction.calc_features.time_series_features_extractor(cfg, d
#### Statistical domain
| Features | Computational Cost |
|----------------------------|:------------------:|
| Absolute energy | 1 |
| Average power | 1 |
| ECDF | 1 |
| ECDF Percentile | 1 |
| ECDF Percentile Count | 1 |
| Entropy | 1 |
| Histogram | 1 |
| Interquartile range | 1 |
| Kurtosis | 1 |
Expand All @@ -70,11 +73,9 @@ X = tsfel.feature_extraction.calc_features.time_series_features_extractor(cfg, d
#### Temporal domain
| Features | Computational Cost |
|----------------------------|:------------------:|
| Absolute energy | 1 |
| Area under the curve | 1 |
| Autocorrelation | 1 |
| Centroid | 1 |
| Entropy | 1 |
| Mean absolute diff | 1 |
| Mean diff | 1 |
| Median absolute diff | 1 |
Expand All @@ -85,7 +86,6 @@ X = tsfel.feature_extraction.calc_features.time_series_features_extractor(cfg, d
| Signal distance | 1 |
| Slope | 1 |
| Sum absolute diff | 1 |
| Total energy | 1 |
| Zero crossing rate | 1 |
| Neighbourhood peaks | 1 |

Expand Down
958 changes: 958 additions & 0 deletions notebooks/TSFEL_regression_RUL_estimation.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.black]
line-length = 88
color = true
target-version = ['py37', 'py38', 'py39']
target-version = ['py37', 'py38']
include = '\.pyi?$'
exclude = '''
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def find_requirements(filename):

setup(
name="tsfel",
version="0.1.5",
version="0.2.0",
author="Fraunhofer Portugal",
description="Library for time series feature extraction.",
long_description=long_description,
Expand Down
37 changes: 26 additions & 11 deletions tests/test_calc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def pre_process(sensor_data):
if "Accelerometer" in sensor_data:
sensor_data["Accelerometer"].iloc[:, 1] = (
sensor_data["Accelerometer"].iloc[:, 1] * 0
sensor_data["Accelerometer"].iloc[:, 1] * 10
)
return sensor_data

Expand Down Expand Up @@ -59,6 +59,7 @@ def pre_process(sensor_data):
)

# DEFAULT PARAM for testing
n_jobs = -1
time_unit = 1e9 # seconds
resample_rate = 30 # resample sampling frequency
window_size = 100 # number of points
Expand All @@ -72,7 +73,7 @@ def pre_process(sensor_data):
sensor_data[key] = pd.read_csv(folders[-1] + key + ".txt", header=None)

# add personal feature
add_feature_json(personal_features_path, personal_path_json)
# add_feature_json(personal_features_path, personal_path_json)

# Features Dictionary
settings0 = json.load(open(tsfel_path_json))
Expand All @@ -88,16 +89,30 @@ def pre_process(sensor_data):
data_new = merge_time_series(sensor_data, resample_rate, time_unit)
windows = signal_window_splitter(data_new, window_size, overlap)


# time_series_features_extractor
features0 = time_series_features_extractor(
settings4, windows, fs=resample_rate, verbose=1
)
features1 = time_series_features_extractor(
settings2, data_new, fs=resample_rate, window_size=70, overlap=0.5, verbose=1
)
features2 = time_series_features_extractor(
settings3, windows, fs=resample_rate, verbose=1
)

# multi windows and multi axis
# input: list
features0 = time_series_features_extractor(settings5, windows, fs=resample_rate, n_jobs=n_jobs)

# multiple windows and single axis
# input: np.array
features1 = time_series_features_extractor(settings5, data_new.values[:, 0], fs=resample_rate, n_jobs=n_jobs, window_size=window_size, overlap=overlap)
# input: pd.series
features2 = time_series_features_extractor(settings5, data_new.iloc[:, 0], fs=resample_rate, n_jobs=n_jobs, window_size=window_size, overlap=overlap)

# single window and multi axis
# input: pd.DataFrame
features3 = time_series_features_extractor(settings5, data_new, fs=resample_rate, n_jobs=n_jobs)
# input: np.array
features4 = time_series_features_extractor(settings4, data_new.values, fs=resample_rate, n_jobs=n_jobs)

# single window and single axis
# input: pd.Series
features5 = time_series_features_extractor(settings1, data_new.iloc[:, 0], fs=resample_rate, n_jobs=n_jobs)
# input: np.array
features6 = time_series_features_extractor(settings4, data_new.values[:, 0], fs=resample_rate, n_jobs=n_jobs)

# Dataset features extractor
data = dataset_features_extractor(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_personal_features.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import numpy as np

from tsfel.feature_extraction.features_utils import set_domain
from tsfel.feature_extraction.features_utils import set_domain, vectorize


@set_domain("domain", "statistical")
@vectorize
def new_feature(signal):
"""Computes a new feature
Parameters
Expand All @@ -20,6 +21,7 @@ def new_feature(signal):


@set_domain("domain", "statistical")
@vectorize
def new_feature_with_parameter(signal, weight=0.5):
"""A new feature
Parameters
Expand Down
Loading

0 comments on commit ff706bf

Please sign in to comment.