Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cf531a5
Provide more flexibility for defining mandatory schedule specifications.
Dec 5, 2019
7233d1b
provide more flexibility for time periods.
Dec 5, 2019
b183297
Improve consistency in slicing and fix code syntax issues.
Dec 5, 2019
8332226
Consistency and code syntax.
Dec 5, 2019
b511456
code syntax.
Dec 5, 2019
bfc6191
code syntax fixes.
Dec 5, 2019
988a935
syntax fix.
Dec 5, 2019
c9f890e
Add necessary change to test script settings.
Dec 5, 2019
333f13b
Modify relevant section of the settings.yml for tests and examples.
Dec 5, 2019
4bb9541
restore 'hours' as deprecated for backwards compatibility.
Dec 10, 2019
ca17f3e
Add default value for period_minutes for backwards compatibilitiy.
Dec 10, 2019
174b5e6
create develop branch so we can merge features here before merging (r…
bstabler Dec 17, 2019
7db24a6
Merge pull request #275 from danielsclint/ft_schedule_flex
bstabler Dec 17, 2019
3de1879
provide more flexibility for time periods.
Dec 5, 2019
c546f7c
Improve consistency in slicing and fix code syntax issues.
Dec 5, 2019
2272b4c
Consistency and code syntax.
Dec 5, 2019
3ebfcbe
code syntax fixes.
Dec 5, 2019
0795ec0
Modify relevant section of the settings.yml for tests and examples.
Dec 5, 2019
a5654a5
restore 'hours' as deprecated for backwards compatibility.
Dec 10, 2019
59dddfe
Add default value for period_minutes for backwards compatibilitiy.
Dec 10, 2019
7751fe9
Merge branch 'ft_time_period_flex' of https://github.com/danielsclint…
Dec 20, 2019
82b6b72
Fix overflows
Dec 20, 2019
345e666
Complete testing of the flexible time periods.
Dec 20, 2019
d3597cd
pep8
Dec 21, 2019
889159b
test some floats too.
Dec 21, 2019
772cb34
pep8
Dec 21, 2019
e7664da
Merge pull request #276 from danielsclint/ft_time_period_flex
bstabler Dec 27, 2019
efc2bc6
Merge pull request #286 from danielsclint/ft_overflow
bstabler Dec 27, 2019
32dc999
start with csvs and write hdf5 outputs if desired (#290)
bstabler Feb 3, 2020
9d21d81
Update travis.yml
Feb 3, 2020
1f02ce7
Pandas 1.0 fixes
Feb 4, 2020
925d40e
Location and mode choice logsums (#298)
bstabler Feb 27, 2020
f3955ec
Deprecate Py2 and add CLI
Mar 7, 2020
4255f03
Tncs (#14)
bstabler Mar 24, 2020
4ff7510
write trip matrices (#311)
bstabler Apr 13, 2020
1041bf6
small fixes for semcog deployment (#319)
bstabler May 6, 2020
efe66b3
major work on phase 5 (#325)
bstabler Jul 29, 2020
05a25f6
additional updates for estimation integration (#328)
bstabler Aug 11, 2020
fba45b3
update license, fix univ coeff bug, update estimation example (#339)
bstabler Sep 3, 2020
e6b8de1
Merge branch 'master' into develop
bstabler Sep 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
sandbox/
example/data/*
.idea
.ipynb_checkpoints
.coverage*
Expand Down
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
language: python
sudo: false
python:
- '2.7'
- '3.6'
- '3.7'
- '3.8'
install:
- wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- source "$HOME/miniconda/etc/profile.d/conda.sh"
- 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 future
- source activate test-environment
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
- conda activate test-environment
- conda install pytest pytest-cov coveralls pycodestyle
- pip install .
- pip freeze
Expand All @@ -40,6 +40,8 @@ deploy:

notifications:
slack:
on_success: never # default: change
on_failure: always # default: always
secure: Dpp+zBrnPGBHXrYWjwHy/bnHvhINfepSIiViwKfBZizBvTDvzSJfu6gCH+/lQ3squF3D4qTWwxB+LQ9V6KTYhuma8vQVisyneI6ARjUI/qgX6aJjuvmDDGPk6DVeDow7+aCLZ8VEHRhSjwy+dv0Ij0rxI6I94xPVwXUkk7ZjcK0=
env:
global:
Expand Down
26 changes: 14 additions & 12 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
ActivitySim
Contributions prior to March 2016 Copyright (C) by UrbanSim Inc.
Contributions subsequent to March 2016 Copyright (C) by the contributing authors
BSD 3-Clause License

Copyright (c) After March 2016, Contributing Authors
Copyright (c) Before March 2016, UrbanSim Inc
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of [project] nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand All @@ -25,4 +27,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
include ez_setup.py
include README.rst
graft notebooks
graft activitysim/examples

# required for test system

include activitysim\abm\test\data\mtc_asim.h5
include activitysim\abm\test\data\skims.omx
include activitysim\abm\test\data\households.csv
Expand Down
3 changes: 3 additions & 0 deletions activitysim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# ActivitySim
# See full license in LICENSE.txt.

__version__ = '0.9.5'
__doc__ = 'Activity-Based Travel Modeling'
3 changes: 0 additions & 3 deletions activitysim/abm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# ActivitySim
# See full license in LICENSE.txt.

from __future__ import absolute_import

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

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

import logging

import pandas as pd
Expand Down
4 changes: 1 addition & 3 deletions activitysim/abm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# ActivitySim
# See full license in LICENSE.txt.

from __future__ import absolute_import

from . import accessibility
from . import atwork_subtour_destination
from . import atwork_subtour_frequency
Expand Down Expand Up @@ -30,3 +27,4 @@
from . import trip_purpose
from . import trip_purpose_and_destination
from . import trip_scheduling
from . import trip_matrices
58 changes: 27 additions & 31 deletions activitysim/abm/models/accessibility.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# ActivitySim
# See full license in LICENSE.txt.

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

import logging

import pandas as pd
Expand Down Expand Up @@ -51,25 +46,29 @@ def __init__(self, skim_dict, orig_zones, dest_zones, transpose=False):
self.skim_dict = skim_dict
self.transpose = transpose

if omx_shape[0] == len(orig_zones):
# no slicing required
self.slice_map = None
if omx_shape[0] == len(orig_zones) and skim_dict.offset_mapper.offset_series is None:
# no slicing required because whatever the offset_int, the skim data aligns with zone list
self.map_data = False
else:
# 2-d boolean slicing in numpy is a bit tricky
# data = data[orig_map, dest_map] # <- WRONG!
# data = data[orig_map, :][:, dest_map] # <- RIGHT
# data = data[np.ix_(orig_map, dest_map)] # <- ALSO RIGHT

if omx_shape[0] == len(orig_zones):
logger.debug("AccessibilitySkims - applying offset_mapper")

skim_index = list(range(omx_shape[0]))
orig_map = np.isin(skim_index, skim_dict.offset_mapper.map(orig_zones))
dest_map = np.isin(skim_index, skim_dict.offset_mapper.map(dest_zones))
orig_map = skim_dict.offset_mapper.map(orig_zones)
dest_map = skim_dict.offset_mapper.map(dest_zones)

# (we might be sliced multiprocessing)
# assert np.isin(skim_index, orig_map).all()

if not dest_map.all():
if np.isin(skim_index, dest_map).all():
# not using the whole skim matrix
logger.info("%s skim zones not in dest_map: %s" %
((~dest_map).sum(), np.ix_(~dest_map)))

self.slice_map = np.ix_(orig_map, dest_map)
self.map_data = True
self.orig_map = orig_map
self.dest_map = dest_map

def __getitem__(self, key):
"""
Expand All @@ -85,10 +84,15 @@ def __getitem__(self, key):
if self.transpose:
data = data.transpose()

if self.slice_map is not None:
if self.map_data:

# slice skim to include only orig rows and dest columns
# 2-d boolean slicing in numpy is a bit tricky - see explanation in __init__
data = data[self.slice_map]
# 2-d boolean slicing in numpy is a bit tricky
# data = data[orig_map, dest_map] # <- WRONG!
# data = data[orig_map, :][:, dest_map] # <- RIGHT
# data = data[np.ix_(orig_map, dest_map)] # <- ALSO RIGHT

data = data[self.orig_map, :][:, self.dest_map]

return data.flatten()

Expand Down Expand Up @@ -121,19 +125,12 @@ def compute_accessibility(accessibility, skim_dict, land_use, trace_od):
logger.info("Running %s with %d dest zones" % (trace_label, len(accessibility_df)))

constants = config.get_model_constants(model_settings)
land_use_columns = model_settings.get('land_use_columns', [])

land_use_columns = model_settings.get('land_use_columns', [])
land_use_df = land_use.to_frame()
land_use_df = land_use_df[land_use_columns]

# #bug
#
# land_use_df = land_use_df[land_use_df.index % 2 == 1]
# accessibility_df = accessibility_df[accessibility_df.index.isin(land_use_df.index)].head(5)
#
# print "land_use_df", land_use_df.index
# print "accessibility_df", accessibility_df.index
# #bug

# don't assume they are the same: accessibility may be sliced if we are multiprocessing
orig_zones = accessibility_df.index.values
dest_zones = land_use_df.index.values

Expand All @@ -158,7 +155,6 @@ def compute_accessibility(accessibility, skim_dict, land_use, trace_od):
trace_od_rows = None

# merge land_use_columns into od_df
land_use_df = land_use_df[land_use_columns]
od_df = pd.merge(od_df, land_use_df, left_on='dest', right_index=True).sort_index()

locals_d = {
Expand All @@ -175,7 +171,7 @@ def compute_accessibility(accessibility, skim_dict, land_use, trace_od):

for column in results.columns:
data = np.asanyarray(results[column])
data.shape = (orig_zone_count, dest_zone_count)
data.shape = (orig_zone_count, dest_zone_count) # (o,d)
accessibility_df[column] = np.log(np.sum(data, axis=1) + 1)

# - write table to pipeline
Expand Down
Loading