Skip to content

Commit

Permalink
Merge 103fdd5 into 5a25c3d
Browse files Browse the repository at this point in the history
  • Loading branch information
bstabler committed Apr 23, 2019
2 parents 5a25c3d + 103fdd5 commit 2a211d5
Show file tree
Hide file tree
Showing 298 changed files with 306,279 additions and 6,552 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
sandbox/
sandbox.py
example/data/*
.idea
.ipynb_checkpoints
.coverage*
.pytest_cache
.vagrant


# Byte-compiled / optimized / DLL files
Expand Down
16 changes: 16 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[MESSAGES CONTROL]
disable=locally-disabled,
# False positive for type annotations with typing module
# invalid-sequence-index,
# False positive for OK test methods names and few other places
invalid-name,
# False positive for test file classes and methods
missing-docstring

[REPORTS]
# Simplify pylint reports
reports=no

[SIMILARITIES]
min-similarity-lines=10
ignore-docstrings=yes
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
language: python
sudo: false
python:
- '2.7'
- '2.7'
- '3.6'
install:
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh
-O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh
-O miniconda.sh; fi
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]];
then wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh;
else wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O miniconda.sh; fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- |
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION cytoolz numpy pandas pip pytables pyyaml toolz psutil
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION cytoolz numpy pandas pip pytables pyyaml toolz psutil future
- source activate test-environment
- pip install orca openmatrix zbox
- pip install pytest pytest-cov coveralls pycodestyle
- pip install sphinx numpydoc sphinx_rtd_theme
- pip install openmatrix zbox
- conda install pytest pytest-cov coveralls pycodestyle
- conda install sphinx numpydoc sphinx_rtd_theme
- pip install .
- pip freeze
script:
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include ez_setup.py
include README.rst
include activitysim\abm\test\data\mtc_asim.h5
include activitysim\abm\test\data\skims.omx
12 changes: 0 additions & 12 deletions README.rst

This file was deleted.

8 changes: 5 additions & 3 deletions activitysim/abm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ActivitySim
# See full license in LICENSE.txt.

import misc
import tables
import models
from __future__ import absolute_import

from . import misc
from . import tables
from . import models
47 changes: 13 additions & 34 deletions activitysim/abm/misc.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
# ActivitySim
# See full license in LICENSE.txt.

import os
import warnings
from __future__ import (absolute_import, division, print_function, )
from future.standard_library import install_aliases
install_aliases() # noqa: E402

import logging

import numpy as np
import pandas as pd
import yaml

from activitysim.core import pipeline
from activitysim.core import config
from activitysim.core import inject

# FIXME
warnings.filterwarnings('ignore', category=pd.io.pytables.PerformanceWarning)
# warnings.filterwarnings('ignore', category=pd.io.pytables.PerformanceWarning)
pd.options.mode.chained_assignment = None

logger = logging.getLogger(__name__)


@inject.injectable(cache=True)
def store(data_dir, settings):
if 'store' not in settings:
logger.error("store file name not specified in settings")
raise RuntimeError("store file name not specified in settings")
fname = os.path.join(data_dir, settings["store"])
if not os.path.exists(fname):
logger.error("store file not found: %s" % fname)
raise RuntimeError("store file not found: %s" % fname)

file = pd.HDFStore(fname, mode='r')
pipeline.close_on_exit(file, fname)

return file


@inject.injectable(cache=True)
def cache_skim_key_values(settings):
return settings['skim_time_periods']['labels']


@inject.injectable(cache=True)
def households_sample_size(settings, override_hh_ids):

Expand All @@ -50,18 +29,18 @@ def households_sample_size(settings, override_hh_ids):


@inject.injectable(cache=True)
def override_hh_ids(settings, configs_dir):
def override_hh_ids(settings):

hh_ids_filename = settings.get('hh_ids', None)
if hh_ids_filename is None:
return None

f = os.path.join(configs_dir, hh_ids_filename)
if not os.path.exists(f):
logger.error('hh_ids file name specified in settings, but file not found: %s' % f)
file_path = config.data_file_path(hh_ids_filename, mandatory=False)
if not file_path:
logger.error("hh_ids file name '%s' specified in settings not found" % hh_ids_filename)
return None

df = pd.read_csv(f, comment='#')
df = pd.read_csv(file_path, comment='#')

if 'household_id' not in df.columns:
logger.error("No 'household_id' column in hh_ids file %s" % hh_ids_filename)
Expand All @@ -85,7 +64,7 @@ def trace_hh_id(settings):
id = settings.get('trace_hh_id', None)

if id and not isinstance(id, int):
logger.warn("setting trace_hh_id is wrong type, should be an int, but was %s" % type(id))
logger.warning("setting trace_hh_id is wrong type, should be an int, but was %s" % type(id))
id = None

return id
Expand All @@ -97,7 +76,7 @@ def trace_od(settings):
od = settings.get('trace_od', None)

if od and not (isinstance(od, list) and len(od) == 2 and all(isinstance(x, int) for x in od)):
logger.warn("setting trace_od is wrong type, should be a list of length 2, but was %s" % od)
logger.warning("setting trace_od should be a list of length 2, but was %s" % od)
od = None

return od
Expand Down
59 changes: 28 additions & 31 deletions activitysim/abm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
# ActivitySim
# See full license in LICENSE.txt.

import initialize
import accessibility
import auto_ownership
import mandatory_tour_frequency
import mandatory_scheduling
import joint_tour_frequency
import joint_tour_composition
import joint_tour_participation
import joint_tour_destination
import joint_tour_scheduling
import non_mandatory_tour_frequency
import non_mandatory_destination
import non_mandatory_scheduling
import school_location
import workplace_location
import tour_mode_choice
import cdap
from __future__ import absolute_import

import atwork_subtour_frequency
import atwork_subtour_destination
import atwork_subtour_scheduling
import atwork_subtour_mode_choice

import stop_frequency
import trip_purpose
import trip_destination
import trip_purpose_and_destination
import trip_scheduling
import trip_mode_choice

# parameterized models
import annotate_table
from . import accessibility
from . import atwork_subtour_destination
from . import atwork_subtour_frequency
from . import atwork_subtour_mode_choice
from . import atwork_subtour_scheduling
from . import auto_ownership
from . import cdap
from . import free_parking
from . import initialize
from . import joint_tour_composition
from . import joint_tour_destination
from . import joint_tour_frequency
from . import joint_tour_participation
from . import joint_tour_scheduling
from . import location_choice
from . import mandatory_scheduling
from . import mandatory_tour_frequency
from . import non_mandatory_destination
from . import non_mandatory_scheduling
from . import non_mandatory_tour_frequency
from . import stop_frequency
from . import tour_mode_choice
from . import trip_destination
from . import trip_mode_choice
from . import trip_purpose
from . import trip_purpose_and_destination
from . import trip_scheduling

0 comments on commit 2a211d5

Please sign in to comment.