diff --git a/mosstool/trip/generator/_util/const.py b/mosstool/trip/generator/_util/const.py index 400e37a..dbbca6c 100644 --- a/mosstool/trip/generator/_util/const.py +++ b/mosstool/trip/generator/_util/const.py @@ -6,6 +6,7 @@ import pycityproto.city.map.v2.map_pb2 as mapv2 import pycityproto.city.person.v2.person_pb2 as personv2 import pycityproto.city.trip.v2.trip_pb2 as tripv2 +import numpy as np DIS_CAR = 1000 DIS_BIKE = 500 @@ -23,7 +24,7 @@ "HWHWH+": 1.43, "HSOSH": 0.00, } -BUS_SUBWAY = tripv2.TRIP_MODE_BUS_WALK +BUS_SUBWAY = tripv2.TRIP_MODE_BUS_SUBWAY_WALK BUS = tripv2.TRIP_MODE_BUS_WALK SUBWAY = tripv2.TRIP_MODE_SUBWAY_WALK CAR = tripv2.TRIP_MODE_DRIVE_ONLY @@ -87,7 +88,11 @@ GENDER_STATS = [1 / len(GENDERS) for _ in range(len(GENDERS))] AGES = [i for i in range(8, 75)] # probabilities -AGE_STATS = [1 / len(AGES) for _ in range(len(AGES))] +# mean_age: 40 +# std_dev: 15 +_age_pdf = [np.exp(-((age - 40) ** 2) / (2 * 15 ** 2)) for age in AGES] +# normalization +AGE_STATS = [p / sum(_age_pdf) for p in _age_pdf] # work catg WORK_CATGS = {"business", "industrial", "administrative"} # education catg diff --git a/mosstool/trip/route/preroute.py b/mosstool/trip/route/preroute.py index 954e4a2..c89a060 100644 --- a/mosstool/trip/route/preroute.py +++ b/mosstool/trip/route/preroute.py @@ -12,7 +12,7 @@ _TYPE_MAP = { TripMode.TRIP_MODE_DRIVE_ONLY: RouteType.ROUTE_TYPE_DRIVING, - TripMode.TRIP_MODE_TAXI: RouteType.ROUTE_TYPE_DRIVING, + TripMode.TRIP_MODE_TAXI: RouteType.ROUTE_TYPE_TAXI, TripMode.TRIP_MODE_BIKE_WALK: RouteType.ROUTE_TYPE_WALKING, TripMode.TRIP_MODE_BUS_WALK: RouteType.ROUTE_TYPE_BUS, TripMode.TRIP_MODE_SUBWAY_WALK: RouteType.ROUTE_TYPE_SUBWAY, diff --git a/poetry.lock b/poetry.lock index 5bfa494..94cf73e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. [[package]] name = "affine" @@ -2478,13 +2478,13 @@ tests = ["pytest"] [[package]] name = "pycityproto" -version = "2.0.1" +version = "2.0.7" description = "City Proto Generated Python SDK" optional = false python-versions = ">=3.8" files = [ - {file = "pycityproto-2.0.1-py3-none-any.whl", hash = "sha256:2914ea651a645e588176d8e0176b463976b73b35c6dc34d3aff8f0cf76066435"}, - {file = "pycityproto-2.0.1.tar.gz", hash = "sha256:d0237d28104c00e6bb9c964db3340b3b840d1f3bb34a3e93871494d61ece0acf"}, + {file = "pycityproto-2.0.7-py3-none-any.whl", hash = "sha256:356532f68551c56d8d92cf05b63e043ca1116accef4a7c5da5787eb9b5656bc9"}, + {file = "pycityproto-2.0.7.tar.gz", hash = "sha256:825a307686b6fda74f71ab562a7eb49930570bdc175904dc670152b450dcd032"}, ] [package.dependencies] @@ -3960,4 +3960,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "e47d352ebfb8311de493b1fb5b28c72038d9a87b82f338090bc65e23f19f334e" +content-hash = "78608b0deb2188f530509f130563a8a772e3717570cb4890fa663f8eb0ce76d8" diff --git a/pyproject.toml b/pyproject.toml index 11791dc..2aa25da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mosstool" -version = "1.0.24" +version = "1.0.25" description = "MObility Simulation System toolbox " authors = ["Jun Zhang ","Junbo Yan "] license = "MIT" @@ -29,7 +29,7 @@ bs4 = "^0.0.2" matplotlib = "^3.8.3" generate-od = "^0.1" path4gmns = "^0.9.8" -pycityproto = "^2.0.1" +pycityproto = "^2.0.7" [tool.poetry.group.dev.dependencies] pytest = "^8.1.1"