Skip to content

Commit

Permalink
Merge pull request #508 from Jake-Moss/route_choice_saving
Browse files Browse the repository at this point in the history
Route choice additions
  • Loading branch information
Jake-Moss committed Feb 28, 2024
2 parents dce26be + 28bfe7d commit 0230ae7
Show file tree
Hide file tree
Showing 36 changed files with 1,287 additions and 700 deletions.
76 changes: 0 additions & 76 deletions .github/workflows/build_linux.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/build_mac.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build

on: [pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_all:
needs: [build_wheels, make_sdist]
environment: pypi
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
46 changes: 0 additions & 46 deletions .github/workflows/build_windows.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/debug_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
pip install -e .
- name: Runs test
run: python -m pytest
run: python -m pytest
10 changes: 5 additions & 5 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Documentation

on:
push:
branches:
- develop
pull_request:
release:
push:
branches:
- develop
pull_request:
release:

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_linux_with_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: Generate coverage report
run: |
python3 -m pytest --cov=aequilibrae tests/
python3 -m pytest --cov=aequilibrae tests/
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ jobs:
python setup.py build_ext --inplace
- name: Runs test
run: python -m pytest
run: python -m pytest
3 changes: 2 additions & 1 deletion __version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# When updating the version, one must also update the docs/source/_static/switcher.json file
version = 1.0
minor_version = "0"
minor_version = "1"
release_name = "Rio de Janeiro"

release_version = f"{version}.{minor_version}"
4 changes: 0 additions & 4 deletions aequilibrae/distribution/gravity_application.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import glob
import importlib.util as iutil
import logging
import os
import tempfile
Expand All @@ -15,9 +14,6 @@
from aequilibrae.distribution.synthetic_gravity_model import SyntheticGravityModel
from aequilibrae.matrix import AequilibraeMatrix, AequilibraeData

spec = iutil.find_spec("openmatrix")
has_omx = spec is not None


class GravityApplication:
"""Applies a synthetic gravity model.
Expand Down
4 changes: 0 additions & 4 deletions aequilibrae/distribution/ipf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import importlib.util as iutil
import os
from datetime import datetime
from time import perf_counter
Expand All @@ -12,9 +11,6 @@
from aequilibrae.matrix import AequilibraeMatrix, AequilibraeData
from aequilibrae.project.data.matrix_record import MatrixRecord

spec = iutil.find_spec("openmatrix")
has_omx = spec is not None


class Ipf:
"""Iterative proportional fitting procedure
Expand Down
18 changes: 2 additions & 16 deletions aequilibrae/matrix/aequilibrae_matrix.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import functools
import importlib.util as iutil
import os
import tempfile
import uuid
Expand All @@ -11,13 +10,10 @@

import numpy as np
import pandas as pd
import openmatrix as omx
from scipy.sparse import coo_matrix

# Checks if we can display OMX
spec = iutil.find_spec("openmatrix")
has_omx = spec is not None
if has_omx:
import openmatrix as omx

# CONSTANTS
VERSION = 1 # VERSION OF THE MATRIX FORMAT
Expand Down Expand Up @@ -54,9 +50,7 @@
# Offset: 18 + 50*cores + Y*20 | 18 + 50*cores + Y*20 + Y*zones*8 |


matrix_export_types = ["Aequilibrae matrix (*.aem)", "Comma-separated file (*.csv)"]
if has_omx:
matrix_export_types.append("Open matrix (*.omx)")
matrix_export_types = ["Open matrix (*.omx), Aequilibrae matrix (*.aem)", "Comma-separated file (*.csv)"]


class AequilibraeMatrix(object):
Expand Down Expand Up @@ -336,10 +330,6 @@ def robust_name(input_name: str, max_length: int, forbiden_names: List[str]) ->
if trial_name not in forbiden_names:
return trial_name

if not has_omx:
print("Open Matrix is not installed. Cannot continue")
return

if compressed:
raise Warning("Matrix compression not yet supported")

Expand Down Expand Up @@ -788,10 +778,6 @@ def export(self, output_name: str, cores: List[str] = None):
"""
fname, file_extension = os.path.splitext(output_name.upper())

if file_extension == ".OMX":
if not has_omx:
raise ValueError("Open Matrix is not installed. Cannot continue")

if file_extension not in [".AEM", ".CSV", ".OMX"]:
raise NotImplementedError(f"File extension {file_extension} not implemented yet")

Expand Down
Loading

0 comments on commit 0230ae7

Please sign in to comment.