Skip to content

Commit

Permalink
fixing no_lag bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PaoloBonettiPolimi authored Apr 12, 2024
1 parent 1a4a1c0 commit a68b144
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hawk/analysis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def __init__(
self.tefs_features_lags = []
if self.tefs_use_contemporary_features:
self.tefs_features_lags.append(0)
self.tefs_features_lags.extend(list(range(1, self.tefs_max_lag_features + 1)))
if self.tefs_max_lag_features > 0:
self.tefs_features_lags.extend(list(range(1, self.tefs_max_lag_features + 1)))

self.tefs_target_lags = list(range(1, self.tefs_max_lag_target + 1))

Expand Down
7 changes: 5 additions & 2 deletions hawk/processes/wps_causal.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,15 @@ def _handler(self, request, response):

tefs_direction = request.inputs["tefs_direction"][0].data
tefs_use_contemporary_features = request.inputs["tefs_use_contemporary_features"][0].data
tefs_max_lag_features = int(request.inputs["tefs_max_lag_features"][0].data)
if str(request.inputs["tefs_max_lag_features"][0].data) == "no_lag":
tefs_max_lag_features = 0
else:
tefs_max_lag_features = int(request.inputs["tefs_max_lag_features"][0].data)
tefs_max_lag_target = int(request.inputs["tefs_max_lag_target"][0].data)

workdir = Path(self.workdir)

if not tefs_use_contemporary_features and tefs_max_lag_features == "no_lag":
if not tefs_use_contemporary_features and tefs_max_lag_features == 0:
raise ValueError("You cannot use no lag features and not use contemporary features in TEFS.")

causal_analysis = CausalAnalysis(
Expand Down

0 comments on commit a68b144

Please sign in to comment.