Package: cml-pam
Population Activity ModellerPAM is a python library for populationactivity sequencemodelling. Example use cases:Readan existing population thenwriteto a new format.Modifyan existing population, for example to model activity locations.Createyour own activity-based model.PAM supports common travel and activity formats, including MATSim.Activity Sequences?Populationactivity sequences(sometimes calledactivity 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: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 HistoryPAM was originally built and shared to rapidly modify existing activity models to respond to pandemic lock-down scenarios.This functionality used aread-modify-writepattern. Where modifications are made by applyingpolicies. Example policies might be (a) infected persons quarantine at home, (b) only critical workers travel to work, and (c) everyone shops locally.FeaturesActivity ModellingIn addition to the originalread-modify-writepattern and functionality, PAM has modules for:location modellingdiscretionary activity modellingmode choice modellingfacility samplingvehicle ownershipMore 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.MATSimPAM fully supports theMATSimpopulation/plans format. This includes vehicles, unselected plans, leg routes and leg attributes. A core use case of PAM is toread-modify-writeexperienced plansfrom MATSim. This can allow new MATSim scenarios to be"warm started"from existing scenarios, significantly reducing MATSim compute time.DocumentationFor more detailed instructions, see ourdocumentation.InstallationTo install PAM, we recommend using themambapackage manager:As a usermambacreate-npam-cconda-forge-ccity-modelling-labcml-pam
mambaactivatepamAs a developergitclonegit@github.com:arup-group/pam.gitcdpam
mambacreate-npam-cconda-forge-ccity-modelling-lab--filerequirements/base.txt--filerequirements/dev.txt
mambaactivatepam
pipinstall--no-deps-e.Installing with pipInstalling 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 thelibgdal&libspatialindexgeospatial non-python libraries pre-installed.For more detailed instructions, see ourdocumentation.ContributingThere 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 thedevelopment install instructions.If you are usingpipto install PAM instead of the recommendedmamba, you can install the optional test and documentation libraries using thedevoption, 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: runpre-commit installin 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 thepep8 standard.
You can also run these checks yourself at any time to ensure staged changes are clean by simple callingpre-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 ourdocumentation.Building the documentationIf 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 usingmike:mike deploy 0.2
mike serveThen you can view the documentation in a browser athttp://localhost:8000/.