Skip to content

Commit

Permalink
🙏 disable dev dependency pycatch22 on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jvdd committed Apr 23, 2024
1 parent 0c4be8f commit 69b43cb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ pyarrow = [
{ version = ">=12", python = ">=3.7,<3.8" },
{ version = ">=15", python = ">=3.8"}
]
pycatch22 = ">=0.4" # Temporarily lock this version to avoid Windows install error
# Temporarily lock this version to avoid Windows install error
pycatch22 = { version = ">=0.4", platform = "~win32" }
antropy = [
{ version = "^0.1.5", python = "<3.8" },
{ version = ">=0.1.6", python = ">=3.8" }
Expand Down
13 changes: 12 additions & 1 deletion tests/test_features_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,18 @@ def test_catch22_all_features(dummy_data):
feature_collection = FeatureCollection(catch22_feats)

res_df = feature_collection.calculate(dummy_data.first("15min"), return_df=True)
assert (res_df.shape[0] > 0) and (res_df.shape[1]) > 0
assert (res_df.shape[0] > 0) and (res_df.shape[1] == 22 * 2)

catch24_feats = MultipleFeatureDescriptors(
functions=catch22_wrapper(catch22_all, catch24=True),
series_names=["EDA", "TMP"],
windows="2.5min",
strides="10min",
)
feature_collection = FeatureCollection(catch24_feats)

res_df = feature_collection.calculate(dummy_data.first("15min"), return_df=True)
assert (res_df.shape[0] > 0) and (res_df.shape[1] == 24 * 2)


## ANTROPY
Expand Down
12 changes: 8 additions & 4 deletions tsflex/features/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ def tsfresh_settings_wrapper(settings: Dict) -> List[Union[Callable, FuncWrapper
return functions


# ----------------------------------- --CATCH22 -------------------------------------
def catch22_wrapper(catch22_all: Callable) -> FuncWrapper:
# -------------------------------------CATCH22 -------------------------------------
def catch22_wrapper(catch22_all: Callable, **kwargs) -> FuncWrapper:
"""Wrapper enabling compatibility with catch22.
[catch22](https://github.com/chlubba/catch22) is a collection of 22 time series
Expand Down Expand Up @@ -320,6 +320,10 @@ def catch22_wrapper(catch22_all: Callable) -> FuncWrapper:
----------
catch22_all: Callable
The `catch22_all` function from the `pycatch22` package.
**kwargs:
Additional keyword arguments that will be passed to the `catch22_all` function.
Passing the `catch24=True` argument will return the 24 catch24 features instead
of the default 22 catch22 features.
Returns
-------
Expand All @@ -328,10 +332,10 @@ def catch22_wrapper(catch22_all: Callable) -> FuncWrapper:
This FuncWrapper will output the 22 catch22 features.
"""
catch22_names = catch22_all([0])["names"]
catch22_names = catch22_all([0], **kwargs)["names"]

def wrap_catch22_all(x: np.ndarray) -> List[float]:
return catch22_all(x)["values"]
return catch22_all(x, **kwargs)["values"]

wrap_catch22_all.__name__ = "[wrapped]__" + _get_name(catch22_all)
return FuncWrapper(wrap_catch22_all, output_names=catch22_names)

0 comments on commit 69b43cb

Please sign in to comment.