From 627e2867b904633c47007e912f69b65c84c7f549 Mon Sep 17 00:00:00 2001 From: Ali Etezady <58451076+aletzdy@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:50:58 -0700 Subject: [PATCH] fixing disaggregate accessibility bug in zone sampler --- activitysim/abm/models/disaggregate_accessibility.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activitysim/abm/models/disaggregate_accessibility.py b/activitysim/abm/models/disaggregate_accessibility.py index 2bb78bf60..94bf963c5 100644 --- a/activitysim/abm/models/disaggregate_accessibility.py +++ b/activitysim/abm/models/disaggregate_accessibility.py @@ -275,6 +275,10 @@ def zone_sampler(self): maz_candidates = maz_candidates[ ~maz_candidates.MAZ.isin(maz_sample_idx) ] + + # Need to make sure we sample from TAZs that still exist in the maz_candidates + taz_candidates = taz_candidates[taz_candidates.index.isin(maz_candidates.TAZ)] + # Calculate the remaining samples to collect n_samples_remaining = n_samples - len(maz_sample_idx) n_samples_remaining = (