Skip to content

Commit

Permalink
Code lintting
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarandas committed Aug 27, 2024
1 parent 4fa882f commit 7005201
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
5 changes: 0 additions & 5 deletions tsfel/feature_extraction/calc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ def time_series_features_extractor(
DataFrame
Extracted features
"""
# if verbose == 1:
# print("*** Feature extraction started ***")

window_size = kwargs.get("window_size", None)
overlap = kwargs.get("overlap", 0)
Expand Down Expand Up @@ -385,9 +383,6 @@ def time_series_features_extractor(
single_window=True,
)

# if verbose == 1:
# print("\n" + "*** Feature extraction finished ***")

# Assuring the same feature extraction order
features_final = features_final.reindex(sorted(features_final.columns), axis=1)
return features_final.reset_index(drop=True)
Expand Down
16 changes: 10 additions & 6 deletions tsfel/feature_extraction/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,20 @@ def hist(signal, nbins=10, r=1):

if not future_warn_flag:
warnings.warn(
("The histogram feature was deprecated in version 0.1.8 and will be replaced by the mode of histogram in 0.1.9."
" From then on, only a single feature value will be returned."),
FutureWarning
(
"The histogram feature was deprecated in version 0.1.8 and will be replaced by the mode of histogram in 0.1.9."
" From then on, only a single feature value will be returned."
),
FutureWarning,
)
future_warn_flag = True

# TODO: r value must be revised!
histsig, bin_edges = np.histogram(signal, bins=nbins, range=[-r, r])

names = [str(np.around(bin_edges[i], 2)) + ':' + str(np.around(bin_edges[i + 1], 2)) for i in range(len(bin_edges) - 1)]
names = [
str(np.around(bin_edges[i], 2)) + ":" + str(np.around(bin_edges[i + 1], 2)) for i in range(len(bin_edges) - 1)
]

return {"names": names, "values": histsig}

Expand Down Expand Up @@ -1563,7 +1567,7 @@ def spectrogram_mean_coeff(signal, fs, bins=32):
frequencies, _, Sxx = scipy.signal.spectrogram(signal, fs, nperseg=bins * 2 - 2)
Sxx_mean = Sxx.mean(1)
f_keys = np.round(frequencies, 2).astype(str)

return {"names": [f + "Hz" for f in f_keys], "values": Sxx_mean}


Expand Down
4 changes: 2 additions & 2 deletions tsfel/feature_extraction/features_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_features_by_domain(domain=None, json_path=None):
Dict
Dictionary with the features settings
"""

valid_domains = ["statistical", "temporal", "spectral", "fractal", "all"]

if json_path is None:
Expand Down Expand Up @@ -77,7 +77,7 @@ def get_features_by_domain(domain=None, json_path=None):
for k in dict_features[d]:
dict_features[d][k]["use"] = "yes"
d_feat.update({d: dict_features[d]})
return d_feat
return d_feat


def get_features_by_tag(tag=None, json_path=None):
Expand Down

0 comments on commit 7005201

Please sign in to comment.