Skip to main content

PAM

Population Activity Modeller

DailyCIbadge image

PAM is a python library for population activity sequence modelling. Example use cases:

  • Read an existing population then write to a new format.
  • Modify an existing population, for example to model activity locations.
  • Create your own activity-based model.

PAM supports common travel and activity formats, including MATSim.

Activity Sequences?

Population activity sequences (sometimes called activity plans) are used to model the activities (where and when people are at home, work, education and so on) and associated travel of a population:

PAM

Activity sequences are used by transport planners to model travel demand, but can also be used in other domains, such as for virus transmission or energy use modelling.

Brief History

PAM was originally built and shared to rapidly modify existing activity models to respond to pandemic lock-down scenarios.

PAM

This functionality used a read-modify-write pattern. Where modifications are made by applying policies. Example policies might be (a) infected persons quarantine at home, (b) only critical workers travel to work, and (c) everyone shops locally.

PAM

Features

Activity Modelling

In addition to the original read-modify-write pattern and functionality, PAM has modules for:

  • location modelling
  • discretionary activity modelling
  • mode choice modelling
  • facility sampling
  • vehicle ownership

More generally the core PAM data structure and modules can be used as a library to support your own use cases, including building your own activity-based model.

MATSim

PAM fully supports the MATSim population/plans format. This includes vehicles, unselected plans, leg routes and leg attributes. A core use case of PAM is to read-modify-write experienced plans from MATSim. This can allow new MATSim scenarios to be "warm started" from existing scenarios, significantly reducing MATSim compute time.

Documentation

For more detailed instructions, see our documentation.

Installation

To install PAM, we recommend using the mamba package manager:

As a user

mamba create -n pam -c conda-forge -c city-modelling-lab cml-pam
mamba activate pam

As a developer

git clone git@github.com:arup-group/pam.git
cd pam
mamba create -n pam -c conda-forge -c city-modelling-lab --file requirements/base.txt --file requirements/dev.txt
mamba activate pam
pip install --no-deps -e .

Installing with pip

Installing directly with pip as a user (pip install cml-pam) or as a developer (pip install -e '.[dev]') is also possible, but you will need the libgdal & libspatialindex geospatial non-python libraries pre-installed.

For more detailed instructions, see our documentation.

Contributing

There are many ways to make both technical and non-technical contributions to PAM. Before making contributions to the PAM source code, see our contribution guidelines and follow the development install instructions.

If you are using pip to install PAM instead of the recommended mamba, you can install the optional test and documentation libraries using the dev option, i.e., pip install -e '.[dev]'

If you plan to make changes to the code then please make regular use of the following tools to verify the codebase while you work:

  • pre-commit: run pre-commit install in your command line to load inbuilt checks that will run every time you commit your changes. The checks are: 1. check no large files have been staged, 2. lint python files for major errors, 3. format python files to conform with the pep8 standard. You can also run these checks yourself at any time to ensure staged changes are clean by simple calling pre-commit.
  • pytest - run the unit test suite, check test coverage, and test that the example notebooks successfully run.
  • pytest -p memray -m "high_mem" --no-cov (not available on Windows) - after installing memray (mamba install memray pytest-memray), test that memory and time performance does not exceed benchmarks.

For more information, see our documentation.

Building the documentation

If you are unable to access the online documentation, you can build the documentation locally. First, install a development environment of PAM, then deploy the documentation using mike:

mike deploy 0.2
mike serve

Then you can view the documentation in a browser at http://localhost:8000/.

Credits

This package was created with Cookiecutter and the arup-group/cookiecutter-pypackage project template.

Metadata

Release files for cml-pam 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cml-pam 0.3.2
File Size Uploaded Provenance Actions
cml-pam-0.3.2.tar.gz 165.9 kB Without provenance Details for cml-pam-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cml-pam 0.3.2
File Interpreter ABI Platform Actions
cml_pam-0.3.2-py3-none-any.whl Python 3 none any Details for cml_pam-0.3.2-py3-none-any.whl

Total release size: 294.5 kB

Release files / cml-pam-0.3.2.tar.gz

Download URL cml-pam-0.3.2.tar.gz
Size 165.9 kB
Tags Source
SHA-256 checksum
How to use checksums
55120c7f2b2fb5c38f6017f148b769d34af75998df82e0cb1780eaf1c6054d78
BLAKE2b-256 checksum
How to use checksums
b8ce9ab083436a9c0576768b6ed3dc1ade49c4a9e4de25e17088a3c37fffc02b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / cml_pam-0.3.2-py3-none-any.whl

Download URL cml_pam-0.3.2-py3-none-any.whl
Size 128.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63c6002afc6427f1327026594308f49e2cab942276a0aca044bb617c5325a217
BLAKE2b-256 checksum
How to use checksums
70fff9aee4b5210dc636555bf37efde3cfe9b63a92eb5162bc1a4bea49dac371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Security for cml-pam 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page