next up previous index
Next: Unit Tests Up: Programming in Opus and Previous: Programming in Opus and   Index


Creating Your Own Opus Package

This section provides information on constructing a new Opus project.

An Opus package is a Python package that conforms to the Opus conventions. In general, we recommend creating your own Opus package to contain your configuration information, define new variables for existing datasets, define new datasets, define models, etc. The new package should be placed in your workspace, alongside of the Opus and UrbanSim packages such as opus_core and urbansim.

For instance, to create an Opus package for the fictitious ``atlantis'' MPO:

  1. Use the following Python commands to create a new atlantis Opus package pre-populated with the structure and files expected in an Opus package (replace ``atlantis'' with the name for your Opus package):
    >>> from opus_core.opus_package import create_package
    >>> create_package('c:/opusworkspace', 'atlantis')
    

This will create a new directory, e.g. C:/opusworkspace/atlantis, containing a set of commonly useful files and directories, though some may not suitable to your application. For instance, you might want to delete the following four files that are useful in the CUSPA infrastructure, but probably not in yours:

.project
Eclipse's container for project-specific information (see http://www.eclipse.org/).

build.xml
Directives for CUSPA's automated build system.

Each Opus package may have a different set of files and directories, depending upon what is needed. To illustrate what an Opus package may contain, consider the psrc package we created for the Puget Sound Regional Council's (PSRC) application of UrbanSim. Here are some of the directories and files it contains:

county/                         <-- Variables for the county dataset
    __init__.py                 <-- Makes this into a Python package
    de_population_DDD.py        <-- An Opus variable
    ...
docs/                           <-- PSRC-specific documents EMME\/2/
<-- Miscellaneous stuff for PSRC's EMME/2 use estimation/ <--
Scripts for estimating PSRC's models
    __init__.py                 <-- Makes this into a Python package
    estimate_dm_psrc.py         <-- Script to estimate the developer model
    estimate_elcm_psrc.py       <-- Script to estimate the employment location
                                    choice model
    ...
faz/                            <-- Additional variables for the FAZ
dataset gridcell/                       <-- Additional variables for
the gridcell dataset household_x_gridcell/             <-- Additional
variables for the
                                    household_x_gridcell dataset
indicators/                     <-- Scripts to generate indicators
large_area/                     <-- Variables for the large_area dataset
run_config/                     <-- Configurations for different simulation runs
    baseline.py                 <-- Configuration for baseline run
    no_ugb.py                   <-- Configuration for baseline without UGB
    ...
tests/                          <-- Automated tests
    __init__.py                 <-- Makes this into a Python package
    all_tests.py                <-- Runs all of this Opus package's tests
    test_estimation_dm_psrc.py  <-- Automated tests for estimate_dm_psrc.py
    ...
utils/                          <-- Miscellaneous utilities
zone/                           <-- Additional variables for the zone dataset
__init__.py                     <-- Makes this into a Python package
opus_package_info.py            <-- Information about this Opus package


next up previous index
Next: Unit Tests Up: Programming in Opus and Previous: Programming in Opus and   Index
info (at) urbansim.org