Skip to content

Commit

Permalink
Revert last change on r value of histogram feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarandas committed Aug 21, 2024
1 parent aa65d12 commit 7dcaa08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tsfel/feature_extraction/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@
"function": "tsfel.hist",
"parameters": {
"nbins": 10,
"r": null
"r": 1
},
"n_features": "nbins",
"use": "yes"
Expand Down
8 changes: 3 additions & 5 deletions tsfel/feature_extraction/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def entropy(signal, prob="standard"):


@set_domain("domain", "statistical")
def hist(signal, nbins=10, r=None):
def hist(signal, nbins=10, r=1):
"""Computes histogram of the signal.
Feature computational cost: 1
Expand All @@ -488,10 +488,8 @@ def hist(signal, nbins=10, r=None):
nd-array
The values of the histogram
"""
if r is not None:
r = [-r, r]

histsig, bin_edges = np.histogram(signal, bins=nbins, range=r)
# 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)]

Expand Down

0 comments on commit 7dcaa08

Please sign in to comment.