The name is a little misleading. The package basically allows you to predict mobility tool ownership and home office access/frequency. The models implemented here can be used to enrich a synthetic population in an enviornment characterised by telework...
Before you begin, ensure that you have R installed. To install MATSimAPI, use the following command:
pip install git+ssh://git@github.com/dheimgartner/MATSimAPIMATSimAPI also provides a utility cli. Install the R package:
MATSimAPI install # this might take a while...After installation, you can use the MATSimAPI cli for various tasks.
# view available commands
MATSimAPI -h
# start the API on port 8000 (default port)
MATSimAPI start --port 8000Once the API is running, you can access the Swagger UI at http://localhost:8000/__docs__/.
Don't forget to stop the API when you are done:
MATSimAPI stop --port 8000MATSimAPI also offers a Python object handler, the :py:class:`MATSimAPI.consume.RApiConsumer`. This handler allows you to interact with the API directly from Python. It starts the API in the background and performs clean-up when no longer in use. You can use it with the with keyword, as shown in the :ref:`examples` section.
For detailed information and usage examples, refer to the following resources:
:ref:`examples` section (also available in the
MATSimAPI/examplesdirectory).To understand the required variables, you can use the
/docendpoint.Example data is included in the package to illustrate the expected format and test the endpoints. You can access this data with Python using the following code:
from MATSimAPI.utils import data, from_df # Load data as a pandas DataFrame data_ga = data("ga", pandas=True) data_ga_ = data("ga", pandas=False) # Cast a pandas DataFrame to the format expected by the API data_api = from_df(data_ga)
The core functionality of MATSimAPI is implemented in R and is available under MATSimAPI/Rapi. This is an R package that is installed along with the utility mentioned above. You can start an R session and inspect the source code as well as its documentation using the following R command:
help(package = "MATSimAPI")