Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing no_lag bug #14

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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