Skip to content

Commit aaf0325

Browse files
committed
enable extra tour mc logsum cols in tour od choice spec
1 parent 0394fc1 commit aaf0325

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

activitysim/abm/models/tour_od_choice.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,11 @@ def tour_od_choice(
107107
estimator.write_override_choices(choices_df.choice)
108108
estimator.end_estimation()
109109

110-
tours[origin_col_name] = choices_df[origin_col_name]
111-
tours[dest_col_name] = choices_df[dest_col_name]
110+
tours[origin_col_name] = choices_df[origin_col_name].reindex(tours.index)
111+
tours[dest_col_name] = choices_df[dest_col_name].reindex(tours.index)
112+
if want_logsums:
113+
tours[logsum_column_name] = \
114+
choices_df['logsum'].reindex(tours.index).astype('float')
112115
tours['poe_id'] = tours[origin_col_name].map(land_use.to_frame(columns='poe_id').poe_id)
113116

114117
households = households.to_frame()

activitysim/abm/models/util/tour_od.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,10 @@ def run_od_logsums(
752752
pipeline.get_rn_generator().drop_channel('trips')
753753
tracing.deregister_traceable_table('trips')
754754

755+
assert (od_sample.index == choosers.index).all()
756+
for col in new_cols:
757+
od_sample[col] = choosers[col]
758+
755759
logsums = logsum.compute_logsums(
756760
choosers,
757761
spec_segment_name,
@@ -762,6 +766,7 @@ def run_od_logsums(
762766
chunk_tag,
763767
trace_label, 'end', 'start', 'duration')
764768

769+
assert (od_sample.index == logsums.index).all()
765770
od_sample['tour_mode_choice_logsum'] = logsums
766771

767772
return od_sample

0 commit comments

Comments
 (0)