From 1587d6e44f2c03669c17372250cad30a37036767 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 ab4f9acef7..d5cff9e406 100644 --- a/activitysim/abm/models/disaggregate_accessibility.py +++ b/activitysim/abm/models/disaggregate_accessibility.py @@ -415,6 +415,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 = (