Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gc modern see #232

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Gc modern see #232

wants to merge 27 commits into from

Conversation

divyasharma-arup
Copy link
Contributor

@divyasharma-arup divyasharma-arup commented May 25, 2023

Fixing the unselected plans analysis within Elara. Now, the code generates a complete list of the five top plans tried and a dataset of agents that could have travelled by non-car modes but instead chose car.

# We find the home locations, based on the origin activity (home)
# we use home locations for visulisation purposes
# # todo. Add a warning if many home locations are not found
homes = trips[trips.o_act=="home"][['ox','oy','agent', 'o_act']]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I added a warning, but it would repeat for each set of agents parsed. Must be a way to only have that warning appear once.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# in the case of the selected plan, the relative disutility is 0
plans = plans.groupby(['agent']).apply(get_relativeUtilityToSelected)
plans['relativeDisUtilityToSelectedPerc'] = plans['relativeDisUtilityToSelected'] / plans['utility'] * -100.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to renaming these columns to something simpler, chose to keep it consistent with previous versions of the analysis for now.

| | ,' | | ,' `--'' '---' | , .-./---`-' : \ \ `--'---' | , / `--'---'
`----' `----' `--`---' \ ' ; ---`-'
`--` """)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to the cli (ie in main.py) or remove please


for i, plan in enumerate(elem.xpath(".//plan")):

# attribute = self.attributes.get(ident, {}).get(self.groupby_person_attribute, None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out lines

for stage in plan:

# we give each plan an id (to permit comparisons)
innovation_hash = i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this hash is broken? Try:

for i, plan in enumerate(...):
    for j, stage in enumerate(plan):
        hash = f"{i}-{j}"

But probably don't need the hash anyway. Just use i and seq?

'ox': float(activities[-1]['x']),
'oy': float(activities[-1]['y']),
# 'dx': float(x),
# 'dy': float(y),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...remove comments


mode = {"egress_walk": "walk", "access_walk": "walk"}.get(mode, mode) # ignore access and egress walk
modes[mode] = modes.get(mode, 0) + distance
trip_distance = distance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be trip_distance += distance.

trip_distance = distance

self.see_trips_log.add(trips)
summary.extend(trips)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.see_trips_log.add(trips) is writing the data to disk and then we are also adding them all to a (massive) list called "summary" - is this really intended?

Reading on I see that there is some analysis done to summary and this is then added to results. But it is going the get constantly run and overwritten.

Move elsewhere as discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants