Skip to content

Commit

Permalink
Merge 66b1259 into 16b0999
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer committed Feb 12, 2021
2 parents 16b0999 + 66b1259 commit e82eef3
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 40 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Coverage

# This workflow generates a coverage report (how much of the codebase is covered by the
# unit tests) and uploads the information to Coveralls.io for reporting and analysis.

on:
push: # REMOVE
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install UrbanSim Templates
run: |
pip install .
pip install -r requirements-extras.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
cd tests
coverage run --source urbansim_templates --module pytest --verbose
coverage report --show-missing
- name: Upload to Coveralls
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/cross-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Cross-compatibility

# This workflow runs the UrbanSim Templates unit tests across a comprehensive range of
# Python versions and operating systems.

on:
# push:
pull_request:
workflow_dispatch:

jobs:
build-pip:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8] # no pip pytables for py39-mac or py39-win
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install UrbanSim Templates
run: |
pip install .
pip install -r requirements-extras.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
cd tests
pytest -s
49 changes: 49 additions & 0 deletions .github/workflows/installation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Installation

# This workflow installs UrbanSim Templates from Pip and Conda across a range of Python
# versions and operating systems. You can run this manually after a new release is posted
# to confirm that it installs smoothly. This workflow also runs periodically in the
# background to catch dependency updates that break UrbanSim Templates.

on:
# push:
# pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1' # every Monday at 3am UTC (Sunday evening Calif time)

jobs:
build-pip:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8] # no pip pytables for py39-mac or py39-win
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install UrbanSim Templates
run: |
pip install urbansim_templates
build-conda:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0} # needed for conda persistence
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install UrbanSim Templates
run: |
conda install urbansim_templates --channel conda-forge
29 changes: 29 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Unit tests

# This workflow runs the UrbanSim Templates tests in a single generic environment (recent
# but stable Python version on recent but stable Ubuntu). The cross-compatibility.yml
# workflow runs the same tests across multiple platforms.

on:
push:
# pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install UrbanSim Templates
run: |
pip install .
pip install -r requirements-extras.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
cd tests
pytest -s
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# UrbanSim Templates change log

### 0.1.4 (2020-02-12)

- adds a `residuals` attribute to fitted `OLSRegressionStep` models, for diagnostics

### 0.1.3 (2019-07-15)

- fixes a bug with `out_transform` parameter for OLS simulation
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Build Status](https://travis-ci.org/UDST/urbansim_templates.svg?branch=master)](https://travis-ci.org/UDST/urbansim_templates)
[![Coverage Status](https://coveralls.io/repos/github/UDST/urbansim_templates/badge.svg?branch=master)](https://coveralls.io/github/UDST/urbansim_templates?branch=master)
[![Docs Status](https://readthedocs.org/projects/urbansim_templates/badge/?version=latest)](https://docs.udst.org/projects/urbansim-templates/en/latest)


# UrbanSim Templates

Expand All @@ -9,6 +8,7 @@ UrbanSim Templates is a Python library that provides building blocks for Orca-ba
The library contains templates for common types of model steps, plus a tool called ModelManager that runs as an extension to the [Orca](https://udst.github.io/orca) task orchestrator. ModelManager can register template-based model steps with the orchestrator, save them to disk, and automatically reload them for future sessions. The package was developed to make it easier to set up new simulation models — model step templates reduce the need for custom code and make settings more portable between models.

### Installation

UrbanSim Templates can be installed using the Pip or Conda package managers:

```
Expand All @@ -21,8 +21,8 @@ conda install urbansim_templates --channel conda-forge

### Documentation

See the online documentation for much more: [http://docs.udst.org/projects/urbansim-templates](https://docs.udst.org/projects/urbansim-templates/en/latest)
See the online documentation for much more: https://udst.github.io/urbansim_templates

Some additional documentation is available within the repo in `CHANGELOG.md`, `CONTRIBUTING.md`, `/docs/README.md`, and `/tests/README.md`.

There's discussion of current and planned features in the [Pull requests](https://github.com/udst/urbansim_templates/pulls?utf8=✓&q=is%3Apr) and [Issues](https://github.com/udst/urbansim_templates/issues?utf8=✓&q=is%3Aissue), both open and closed.
There's discussion of current and planned features in the [pull requests](https://github.com/udst/urbansim_templates/pulls?utf8=✓&q=is%3Apr) and [issues](https://github.com/udst/urbansim_templates/issues?utf8=✓&q=is%3Aissue), both open and closed.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# minimal requirements for model management and core templates

choicemodels >= 0.2.dev4
choicemodels >= 0.2
numpy >= 1.14
orca >= 1.4
pandas >= 0.22
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='urbansim_templates',
version='0.1.3',
version='0.1.4',
description='UrbanSim extension for managing model steps',
author='UrbanSim Inc.',
author_email='info@urbansim.com',
Expand All @@ -17,6 +17,8 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: BSD License'
],
packages=find_packages(exclude=['*.tests']),
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Run tests from this folder using `pytest *.py -s`.
Run tests from this folder using `pytest -s`.
4 changes: 3 additions & 1 deletion tests/test_large_multinomial_logit.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ def test_simulation_unconstrained(m):

obs = orca.get_table('obs').to_frame()
assert sum(obs.choice == -1) == 0
assert obs.loc[:24, 'choice'].equals(m.choices)
pd.testing.assert_series_equal(obs.loc[:24, 'choice'], m.choices,
check_dtype=False, check_names=False)
# assert obs.loc[:24, 'choice'].equals(m.choices)


def test_simulation_single_occupancy(m):
Expand Down
2 changes: 1 addition & 1 deletion urbansim_templates/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = __version__ = '0.1.3'
version = __version__ = '0.1.4'
2 changes: 2 additions & 0 deletions urbansim_templates/models/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(self, tables=None, model_expression=None, filters=None, out_tables=
# Placeholders for model fit data, filled in by fit() or from_dict()
self.summary_table = None
self.fitted_parameters = None
self.residuals = None
self.model = None


Expand Down Expand Up @@ -185,6 +186,7 @@ def fit(self):
# code later on to not rely on RegressionModel any more.

self.fitted_parameters = results.params.tolist()
self.residuals = results.resid


def run(self):
Expand Down

0 comments on commit e82eef3

Please sign in to comment.