From c51046a9dba0161e4497500391796f452dfa08e0 Mon Sep 17 00:00:00 2001 From: David Hensle Date: Tue, 19 Mar 2024 15:54:39 -0700 Subject: [PATCH] remove tazs from sampling if no maz available --- activitysim/abm/models/disaggregate_accessibility.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activitysim/abm/models/disaggregate_accessibility.py b/activitysim/abm/models/disaggregate_accessibility.py index 8d1102743..8e1755dd0 100644 --- a/activitysim/abm/models/disaggregate_accessibility.py +++ b/activitysim/abm/models/disaggregate_accessibility.py @@ -429,6 +429,12 @@ 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 = (