Skip to content

Commit

Permalink
Merge branch 'master' into delimiter_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 authored Mar 10, 2024
2 parents a5754ff + 0e54a7d commit 46f4e27
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.18](https://github.com/matsim-vsp/matsim-python-tools/compare/v0.0.16...v0.0.18) (2024-02-26)

### [0.0.17](https://github.com/matsim-vsp/matsim-python-tools/compare/v0.0.16...v0.0.17) (2024-02-26)

### [0.0.16](https://github.com/matsim-vsp/matsim-python-tools/compare/v0.0.13...v0.0.16) (2023-12-19)

### [0.0.15](https://github.com/matsim-vsp/matsim-python-tools/compare/v0.0.14...v0.0.15) (2023-09-20)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.16
0.0.18
12 changes: 7 additions & 5 deletions matsim/scenariogen/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
""" This module contains dataclasses and methods for reading and processing survey data.
"""

__all__ = ["read_all", "ParkingPosition", "HouseholdType", "EconomicStatus", "Gender", "Employment", "Availability", "Purpose",
__all__ = ["read_all", "ParkingPosition", "HouseholdType", "EconomicStatus", "Gender", "Employment", "Availability",
"Purpose",
"TripMode", "DistanceGroup", "DurationGroup", "SourceDestinationGroup",
"Household", "Person", "Trip", "Activity"]

import os
from typing import List, Union, Tuple

from dataclasses import dataclass
from enum import Enum, auto
from typing import List, Union, Tuple

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -330,8 +330,10 @@ class Trip:
purpose: Purpose
sd_group: SourceDestinationGroup
valid: bool
from_zone: str = None
to_zone: str = None
from_location: str = pd.NA
from_zone: str = pd.NA
to_location: str = pd.NA
to_zone: str = pd.NA


@dataclass
Expand Down
15 changes: 14 additions & 1 deletion matsim/scenariogen/data/formats/srv.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ def convert(data: tuple, regio=None):
SrV2018.sd_group(int(t.E_QZG_17)),
# Trip is valid if length and duration are present
0 <= t.GIS_LAENGE and t.E_DAUER > 0,
from_location=SrV2018.parse_location(t, "V_START_"),
from_zone=SrV2018.parse_zone(t, "V_START_"),
to_zone=SrV2018.parse_zone(t, "V_ZIEL_")
to_location=SrV2018.parse_location(t, "V_ZIEL_"),
to_zone=SrV2018.parse_zone(t, "V_ZIEL_"),
)
)

Expand Down Expand Up @@ -454,3 +456,14 @@ def parse_zone(h, prefix=""):
zone += "-" + tb

return zone

@staticmethod
def parse_location(h, prefix=""):
ort = parse_int_str(getattr(h, prefix + "ORT"))
if not ort:
return pd.NA

if "Berlin" in ort:
return "Berlin"

return ort
28 changes: 28 additions & 0 deletions matsim/viz/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from argparse import ArgumentParser


def start_piri(args):
from matsim.viz import piri
piri.app.run(debug=False)

def main():
""" Main entry point. """

parser = ArgumentParser(prog='matsim-viz', description="MATSim viz util")
subparsers = parser.add_subparsers(title="Subcommands")

# Because the dash app can not easily be separated, the command lne parser is duplicated here
s1 = subparsers.add_parser("piri", help="Analyze the evolution of plans of a single agent or compare different agents side by side.")
s1.add_argument("inputfile", help="Full path to the file containing the plan inheritance records, e.g. path/to/matsim/output/planInheritanceRecords.csv.gz")

s1.set_defaults(func=start_piri)

args = parser.parse_args()
args.func(args)


if __name__ == "__main__":
main()
Loading

0 comments on commit 46f4e27

Please sign in to comment.