Skip to content

Commit

Permalink
fixing unselectedplanscarsel
Browse files Browse the repository at this point in the history
  • Loading branch information
divyasharma-arup committed May 24, 2023
1 parent 58d3369 commit 0025e1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions elara/plan_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,28 +1161,31 @@ def get_relativeUtilityToSelected(group):

# # zip them back together again
gdf = pd.concat([selectedPlans,unSelectedPlans])
self.results['SeeAllPlansGdf'] = self.results['SeeAllPlansGdf'].append(gdf)
#self.results['SeeAllPlansGdf'] = self.results['SeeAllPlansGdf'].append(gdf)

# creation of a df where car is selected
# but PT exists in their unchosen plans
# "mode shift opportunity" gdf
PlanAgentsSel = gdf[gdf.selected==True]
carPlanAgentsSel = PlanAgentsSel[PlanAgentsSel.dominantTripMode=='car']
#PlanAgentsSel = gdf[gdf.selected==True]
carSelectedPlans = selectedPlans[selectedPlans.dominantTripMode=='car']

unSelectedPlansCarSelected = unSelectedPlans[unSelectedPlans.agent.isin(carPlanAgentsSel.agent.unique())]
unSelectedPlansCarSelected = unSelectedPlans[unSelectedPlans.agent.isin(carSelectedPlans.agent.unique())]

# This finds all modes that aren't car, generally bike, walk, pt etc
unSelectedPlansCarSelected = unSelectedPlansCarSelected[~unSelectedPlansCarSelected.dominantTripMode.isin(['car'])]
# self.results['SeeAllPlansGdf'] = self.results['SeeAllPlansGdf'].append(gdf[gdf['agent']=='fatema'])
self.results['SeeUnSelectedPlansCarSelectedGdf'] = self.results['SeeUnSelectedPlansCarSelectedGdf'].append(unSelectedPlansCarSelected)

self.see_unselectedplans_car.add(self.results['SeeUnSelectedPlansCarSelectedGdf'])#.append(unSelectedPlansCarSelected)
#self.see_unselectedplans_car.add(self.results['SeeUnSelectedPlansCarSelectedGdf'])#.append(unSelectedPlansCarSelected)

def finalise(self):
"""
Finalise aggregates and joins these results as required and creates a dataframe.
"""
self.see_trips_log.finish()
#self.results.finish()
# self.results['SeeAllPlansGdf'].finish()
self.see_unselectedplans_car.finish()
#self.see_unselectedplans_car.finish()

@staticmethod
def get_seconds(dt: datetime) -> int:
Expand Down
1 change: 1 addition & 0 deletions example_configs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ plan_activity_modes = {destination_activity_filters=["work"], attributes=["age"]
trip_logs = ["all"]
agent_highway_distance_logs = ["car"]
trip_highway_distance_logs = ["car"]
see_trips_log = ["all"]

[post_processors]
plan_summary = ["all"]
Expand Down

0 comments on commit 0025e1c

Please sign in to comment.