Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

[coverage:run]
source = mobility
2 changes: 1 addition & 1 deletion .github/workflows/install-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
shell: bash -el {0}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ classifiers = [

[project.optional-dependencies]
dev = [
"coverage",
"flake8",
"pytest",
"pytest-cov",
Expand Down Expand Up @@ -78,4 +79,4 @@ mobility = [
[tool.setuptools.packages.find]
where = ["."]
include = ["mobility*"]
exclude = ["certs", "certs.*"]
exclude = ["certs", "certs.*"]
34 changes: 34 additions & 0 deletions tests/back/integration/test_901_ensure_quickstart_works.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
import dotenv

import mobility

dotenv.load_dotenv()

# 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)

# 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,
[mobility.CarMode(transport_zones), mobility.WalkMode(transport_zones), mobility.BicycleMode(transport_zones)],
[mobility.HomeMotive(), mobility.WorkMotive(), mobility.OtherMotive(population=pop)],
[emp],
n_iterations=1
)

# You can get the weekday trips to inspect them
weekday_flows = pop_trips.get()["weekday_flows"].collect()

# You can can also get global metrics that will be compared to the theoetical values for this population
global_metrics = pop_trips.evaluate("global_metrics")

# You can also plot the flows, with labels for the cities that are bigger than their neighbours
labels = pop_trips.get_prominent_cities()
pop_trips.plot_od_flows(labels=labels)
Loading