-
Notifications
You must be signed in to change notification settings - Fork 15
Various winter improvements #242
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
Open
Mind-the-Cap
wants to merge
17
commits into
main
Choose a base branch
from
new-parameters
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ed9068d
ongoing tests
Mind-the-Cap 2467fa0
ongoing tests
Mind-the-Cap 76e88e5
Parameter class
Mind-the-Cap a3d515f
correct method name
Mind-the-Cap 3c2eea8
other improvements and experiments
Mind-the-Cap 36845b4
exclude parameters config from comparison
Mind-the-Cap 72dd752
test
Mind-the-Cap f9e961b
other test
Mind-the-Cap 1ae982f
access parameters via a dict
Mind-the-Cap b245677
move old classes to legacy folder
Mind-the-Cap 5619e90
WorkHomeFlows_fr class to compare with INSEE flows
Mind-the-Cap 2aa54ee
new default parameters
Mind-the-Cap ae60101
minor improvements on PopulationTrips
Mind-the-Cap 8197f95
MultiSeedPopulationTrips (in progress)
Mind-the-Cap c9c48f5
SSI in results and use of that for radius sensitivity analysis
Mind-the-Cap 4abff2e
last use of parameters.something ?
Mind-the-Cap cfd4891
Merge branch 'main' into new-parameters
Mind-the-Cap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import os | ||
| import dotenv | ||
| import logging | ||
|
|
||
| import mobility | ||
|
|
||
| import polars as pl | ||
|
|
||
| dotenv.load_dotenv() | ||
|
|
||
|
|
||
| mobility.set_params( | ||
| # package_data_folder_path=os.environ["MOBILITY_PACKAGE_DATA_FOLDER"], | ||
| # project_data_folder_path=os.environ["MOBILITY_PROJECT_DATA_FOLDER"] | ||
| package_data_folder_path="D:/mobility-data", | ||
| project_data_folder_path="D:/test-09", | ||
| debug=False | ||
| ) | ||
|
|
||
| # Using Foix (a small town) and a limited radius for quick results | ||
| transport_zones = mobility.TransportZones("fr-09122", radius = 10) | ||
|
|
||
| # Using EMP, the latest national mobility survey for France | ||
| emp = mobility.EMPMobilitySurvey() | ||
|
|
||
| # Creating a synthetic population of 1000 for the area | ||
| pop = mobility.Population(transport_zones, sample_size = 1000) | ||
|
|
||
| modes = [mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones)] | ||
| surveys = [emp] | ||
| motives = [mobility.HomeMotive(), mobility.WorkMotive(), mobility.OtherMotive(population=pop)] | ||
|
|
||
|
|
||
| # Simulating the trips for this population for three modes : car, walk and bicyle, and only home and work motives (OtherMotive is mandatory) | ||
| pop_trips = mobility.PopulationTrips( | ||
| pop, | ||
| modes, | ||
| motives, | ||
| surveys, | ||
| parameters=mobility.PopulationTripsParameters(n_iterations=4, k_mode_sequences=42) | ||
| ) | ||
|
|
||
| pop_trips_base = mobility.PopulationTrips( | ||
| pop, | ||
| modes, | ||
| motives, | ||
| surveys, | ||
| parameters=mobility.PopulationTripsParameters(n_iterations=4, seed=49283092, k_mode_sequences=42) | ||
| ) | ||
|
|
||
| tz = transport_zones.get() | ||
|
|
||
|
|
||
| # You can get the weekday trips to inspect them | ||
| weekday_flows = pop_trips.get()["weekday_flows"].collect() | ||
| weekday_flows_base = pop_trips_base.get()["weekday_flows"].collect() | ||
|
|
||
| # You can also plot the flows, with labels for the cities that are bigger than their neighbours | ||
| labels=pop_trips.get_prominent_cities() | ||
|
|
||
| # You can can also get global metrics that will be compared to the theoetical values for this population | ||
| cost_per_person = pop_trips.evaluate("cost_per_person", plot_delta=True, compare_with=pop_trips_base, labels=labels, plot=True) | ||
| dist_per_person = pop_trips.evaluate("distance_per_person", plot_delta=True, compare_with=pop_trips_base, plot=True) | ||
| time_per_person = pop_trips.evaluate("time_per_person", plot_delta=True, compare_with=pop_trips_base, plot=True) | ||
| ghg_per_person = pop_trips.evaluate("ghg_per_person", plot_delta=True, compare_with=pop_trips_base, plot=True) | ||
| global_metrics = pop_trips.evaluate("global_metrics") | ||
|
|
||
|
|
||
| pop_trips.plot_modal_share(mode="public_transport", labels=labels) | ||
| pop_trips.plot_modal_share(mode="bicycle") | ||
| pop_trips.plot_modal_share(mode="walk") | ||
| cms = pop_trips.plot_modal_share(mode="car") | ||
|
|
||
| # OD flows between transport zones | ||
| pop_trips.plot_od_flows(mode="car", level_of_detail=1, labels=labels) | ||
| pop_trips.plot_od_flows(mode="walk", level_of_detail=1) | ||
| pop_trips.plot_od_flows(mode="bicycle", level_of_detail=1) | ||
| pop_trips.plot_od_flows(mode="public_transport") |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k_mode_sequences=42 ? What's the idea here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a test, we can switch back to a lower value (but we'll need to test the sensibility to that soon)