Skip to content

Commit 3b48a07

Browse files
author
Jan Zill
committed
lint
1 parent 66cdac9 commit 3b48a07

5 files changed

Lines changed: 16 additions & 7 deletions

File tree

activitysim/abm/models/joint_tour_participation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,17 @@ def participants_chooser(
216216
# need "is valid choice" such that we certainly choose those with non-zero values,
217217
# and do not choose others. Let's use 3.0 as large value here.
218218
probs_or_utils[choice_col] = np.where(
219-
probs_or_utils[choice_col] > logit.UTIL_MIN, 3.0, logit.UTIL_UNAVAILABLE
219+
probs_or_utils[choice_col] > logit.UTIL_MIN,
220+
3.0,
221+
logit.UTIL_UNAVAILABLE,
220222
)
221223
non_choice_col = [
222224
col for col in probs_or_utils.columns if col != choice_col
223225
][0]
224226
probs_or_utils[non_choice_col] = np.where(
225-
probs_or_utils[choice_col] <= logit.UTIL_MIN, 3.0, logit.UTIL_UNAVAILABLE
227+
probs_or_utils[choice_col] <= logit.UTIL_MIN,
228+
3.0,
229+
logit.UTIL_UNAVAILABLE,
226230
)
227231
else:
228232
probs_or_utils[choice_col] = np.where(

activitysim/core/interaction_sample.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def make_sample_choices_utility_based(
4545

4646
if allow_zero_probs:
4747
zero_probs = (
48-
utilities.sum(axis=1)
49-
<= utilities.shape[1] * logit.UTIL_UNAVAILABLE
48+
utilities.sum(axis=1) <= utilities.shape[1] * logit.UTIL_UNAVAILABLE
5049
)
5150
if zero_probs.all():
5251
return pd.DataFrame(

activitysim/core/pathbuilder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,10 @@ def build_virtual_path(
10131013
else:
10141014
if self.network_los.state.settings.use_explicit_error_terms:
10151015
utilities_df = logit.validate_utils(
1016-
self.network_los.state, utilities_df, allow_zero_probs=True, trace_label=trace_label
1016+
self.network_los.state,
1017+
utilities_df,
1018+
allow_zero_probs=True,
1019+
trace_label=trace_label,
10171020
)
10181021
choices, rands = logit.make_choices_utility_based(
10191022
self.network_los.state,
@@ -1043,7 +1046,6 @@ def build_virtual_path(
10431046
del rands
10441047
chunk_sizer.log_df(trace_label, "rands", None)
10451048

1046-
10471049
# we need to get path_set, btap, atap from path_df row with same seq and path_num
10481050
# drop seq join column, but keep path_num of choice to override_choices when tracing
10491051
columns_to_cache = ["btap", "atap", "path_set", "path_num"]

activitysim/core/simulate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,9 @@ def eval_mnl(
12901290
)
12911291

12921292
if state.settings.use_explicit_error_terms:
1293-
utilities = logit.validate_utils(state, utilities, trace_label=trace_label, trace_choosers=choosers)
1293+
utilities = logit.validate_utils(
1294+
state, utilities, trace_label=trace_label, trace_choosers=choosers
1295+
)
12941296

12951297
if custom_chooser:
12961298
choices, rands = custom_chooser(

activitysim/core/test/test_logit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ def utilities(choosers, spec, test_data):
6969
columns=test_data["probabilities"].columns,
7070
)
7171

72+
7273
# TODO-EET: Add tests here!
7374

75+
7476
def test_utils_to_probs(utilities, test_data):
7577
state = workflow.State().default_settings()
7678
probs = logit.utils_to_probs(state, utilities, trace_label=None)

0 commit comments

Comments
 (0)