From bbc8dd4bfa4beeb793d9efeb627eb38aac2d709a Mon Sep 17 00:00:00 2001 From: JoeJimFlood Date: Wed, 16 Oct 2024 10:44:15 -0700 Subject: [PATCH 1/2] Added local and premium transit modes to transit time reporter --- .../python/AMTravelTimeReporterConfigs.yaml | 8 +++++++ .../python/MDTravelTimeReporterConfigs.yaml | 8 +++++++ src/main/python/TravelTimeReporter.py | 23 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/python/AMTravelTimeReporterConfigs.yaml b/src/main/python/AMTravelTimeReporterConfigs.yaml index 1b166c5c3..c7802cd77 100644 --- a/src/main/python/AMTravelTimeReporterConfigs.yaml +++ b/src/main/python/AMTravelTimeReporterConfigs.yaml @@ -4,6 +4,14 @@ infinity: 999 outfile: report\walkMgrasWithin45Min_AM.csv transit_skim_matrices: # If set to True, replace values of zero with the number set as infinity + WALK_LOC_FIRSTWAIT__{}: False + WALK_LOC_XFERWALK__{}: False + WALK_LOC_XFERWAIT__{}: False + WALK_LOC_TOTALIVTT__{}: True + WALK_PRM_FIRSTWAIT__{}: False + WALK_PRM_XFERWALK__{}: False + WALK_PRM_XFERWAIT__{}: False + WALK_PRM_TOTALIVTT__{}: True WALK_MIX_FIRSTWAIT__{}: False WALK_MIX_XFERWALK__{}: False WALK_MIX_XFERWAIT__{}: False diff --git a/src/main/python/MDTravelTimeReporterConfigs.yaml b/src/main/python/MDTravelTimeReporterConfigs.yaml index fbad58015..a1708fbde 100644 --- a/src/main/python/MDTravelTimeReporterConfigs.yaml +++ b/src/main/python/MDTravelTimeReporterConfigs.yaml @@ -4,6 +4,14 @@ infinity: 999 outfile: report\walkMgrasWithin45Min_MD.csv transit_skim_matrices: # If set to True, replace values of zero with the number set as infinity + WALK_LOC_FIRSTWAIT__{}: False + WALK_LOC_XFERWALK__{}: False + WALK_LOC_XFERWAIT__{}: False + WALK_LOC_TOTALIVTT__{}: True + WALK_PRM_FIRSTWAIT__{}: False + WALK_PRM_XFERWALK__{}: False + WALK_PRM_XFERWAIT__{}: False + WALK_PRM_TOTALIVTT__{}: True WALK_MIX_FIRSTWAIT__{}: False WALK_MIX_XFERWALK__{}: False WALK_MIX_XFERWAIT__{}: False diff --git a/src/main/python/TravelTimeReporter.py b/src/main/python/TravelTimeReporter.py index bf159eba6..310e4e162 100644 --- a/src/main/python/TravelTimeReporter.py +++ b/src/main/python/TravelTimeReporter.py @@ -318,13 +318,34 @@ def get_transit_time(self): Obtains the total transit time, not including access or egress """ print("Calculating transit times") - self.skims["transit_time"] = self.expand_skim( + + _loc_time = self.expand_skim( + self.skims["WALK_LOC_FIRSTWAIT__" + self.settings["time_period"]] + + self.skims["WALK_LOC_XFERWALK__" + self.settings["time_period"]] + + self.skims["WALK_LOC_XFERWAIT__" + self.settings["time_period"]] + + self.skims["WALK_LOC_TOTALIVTT__" + self.settings["time_period"]] + ) + + _prm_time = self.expand_skim( + self.skims["WALK_PRM_FIRSTWAIT__" + self.settings["time_period"]] + + self.skims["WALK_PRM_XFERWALK__" + self.settings["time_period"]] + + self.skims["WALK_PRM_XFERWAIT__" + self.settings["time_period"]] + + self.skims["WALK_PRM_TOTALIVTT__" + self.settings["time_period"]] + ) + + _mix_time = self.expand_skim( self.skims["WALK_MIX_FIRSTWAIT__" + self.settings["time_period"]] + self.skims["WALK_MIX_XFERWALK__" + self.settings["time_period"]] + self.skims["WALK_MIX_XFERWAIT__" + self.settings["time_period"]] + self.skims["WALK_MIX_TOTALIVTT__" + self.settings["time_period"]] ) + self.skims["transit_time"] = np.minimum( + _loc_time, + _prm_time, + _mix_time + ) + def get_total_transit_time(self): """ Calculates the total time based on access, transit, and egress times From b193c46d044ae5d0fef1506df19ef4283a08b5e0 Mon Sep 17 00:00:00 2001 From: JoeJimFlood Date: Wed, 16 Oct 2024 13:17:01 -0700 Subject: [PATCH 2/2] Moved skim expansion to more efficient location in code --- src/main/python/TravelTimeReporter.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/python/TravelTimeReporter.py b/src/main/python/TravelTimeReporter.py index 310e4e162..aaf00f59f 100644 --- a/src/main/python/TravelTimeReporter.py +++ b/src/main/python/TravelTimeReporter.py @@ -319,31 +319,33 @@ def get_transit_time(self): """ print("Calculating transit times") - _loc_time = self.expand_skim( + _loc_time = ( self.skims["WALK_LOC_FIRSTWAIT__" + self.settings["time_period"]] + self.skims["WALK_LOC_XFERWALK__" + self.settings["time_period"]] + self.skims["WALK_LOC_XFERWAIT__" + self.settings["time_period"]] + self.skims["WALK_LOC_TOTALIVTT__" + self.settings["time_period"]] ) - _prm_time = self.expand_skim( + _prm_time = ( self.skims["WALK_PRM_FIRSTWAIT__" + self.settings["time_period"]] + self.skims["WALK_PRM_XFERWALK__" + self.settings["time_period"]] + self.skims["WALK_PRM_XFERWAIT__" + self.settings["time_period"]] + self.skims["WALK_PRM_TOTALIVTT__" + self.settings["time_period"]] ) - _mix_time = self.expand_skim( + _mix_time = ( self.skims["WALK_MIX_FIRSTWAIT__" + self.settings["time_period"]] + self.skims["WALK_MIX_XFERWALK__" + self.settings["time_period"]] + self.skims["WALK_MIX_XFERWAIT__" + self.settings["time_period"]] + self.skims["WALK_MIX_TOTALIVTT__" + self.settings["time_period"]] ) - self.skims["transit_time"] = np.minimum( - _loc_time, - _prm_time, - _mix_time + self.skims["transit_time"] = self.expand_skim( + np.minimum( + _loc_time, + _prm_time, + _mix_time + ) ) def get_total_transit_time(self):