Skip to content

Commit

Permalink
Merge pull request #152 from fraunhoferportugal/refactor/remove_eval
Browse files Browse the repository at this point in the history
Fixed ResourceWarning.
  • Loading branch information
dmfolgado committed May 9, 2024
2 parents 10de8d3 + 28ceebf commit 96f4e32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/test_calc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pandas as pd

from tsfel.feature_extraction.calc_features import dataset_features_extractor, time_series_features_extractor
from tsfel.feature_extraction.features_settings import get_features_by_domain, get_features_by_tag, get_number_features
from tsfel.feature_extraction.features_settings import get_features_by_domain, get_number_features, load_json
from tsfel.utils.add_personal_features import add_feature_json
from tsfel.utils.signal_processing import merge_time_series, signal_window_splitter

Expand Down Expand Up @@ -171,7 +171,7 @@ def test_input_array_window_single_axis_single(self):

def test_personal_features(self):
# personal features
settings1 = json.load(open(personal_path_json))
settings1 = load_json(personal_path_json)
add_feature_json(personal_features_path, personal_path_json)
features7 = time_series_features_extractor(
settings1,
Expand Down
15 changes: 9 additions & 6 deletions tsfel/feature_extraction/features_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@


def load_json(json_path):
"""Loads the json file given by filename.
"""A convenient method that wraps the built-in `json.load`. This method
might be handy to load customized feature configuration files.
Parameters
----------
json_path : string
Json path
json_path : file-like object, string, or pathlib.Path.
The json file to read.
Returns
-------
Dict
Dictionary
dict
Data stored in the file.
"""
with open(json_path) as f:
out = json.load(f)

return json.load(open(json_path))
return out


def get_features_by_domain(domain=None, json_path=None):
Expand Down

0 comments on commit 96f4e32

Please sign in to comment.