Skip to content

Commit

Permalink
Update qaequilibrae based on aequilibrae1.1.3 (#379)
Browse files Browse the repository at this point in the history
* remove worker_thread

* Revert "remove worker_thread"

This reverts commit 8ffbe80.

* updates worker thread import

* qgis version and messages

* fixes traffic assignment progress bars

* GTFS progress bars and linting

* .

* .

* Modifies signals

* modifies signals and tests

* .

* adds test for impedance matrix dialog

* Remove print statements

* updates signals

* update UI and GTFS signals

* standardize variable names & adds tests

* Removes AequilibraE Data

* .

* Dataset loading

* Update test_distribution_procedures.py

* Update test_load_dataset.py

* fixes tests and file format

* add allow map-match button

* updates version

* Update load_dataset_class.py

* file format and remove unused imports

* updates signals

* skip test and file format

* update centroid connectors

* update tests

* Update aequilibrae_version.txt

* adds uv to installation

* updates signal index

* Create test_creates_transponet.py

* Update test_creates_transponet.py

* add geodataframe from layer

and removes unused files

* rename test files and update test data

* updates create transponet and adds test

* Update test_create_transponet.py

* updates imports

* Update documentation.yml

* update UI and tests

* activate venv

* Update aequilibrae_version.txt

* activate venv (again)

* v1.1.3

* updates signals and imports

* update docs

* Apply suggestions from code review

---------

Co-authored-by: Pedro Camargo <[email protected]>
  • Loading branch information
r-akemii and pedrocamargo authored Nov 12, 2024
1 parent 45b0a0f commit 496bad9
Show file tree
Hide file tree
Showing 88 changed files with 1,225 additions and 2,406 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM qgis/qgis:3.34.7
FROM qgis/qgis:ltr

# [Optional] Uncomment this section to install additional OS packages.
RUN apt update -y && apt install -y pandoc zip
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/AequilibraeUpdates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
container: ['qgis/qgis:latest', 'qgis/qgis:3.34.7']
container: ['qgis/qgis:latest', 'qgis/qgis:ltr']
container:
image: ${{ matrix.container }}
steps:
Expand All @@ -19,19 +19,18 @@ jobs:

- name: Install dependencies
run: |
python3 -m venv /tmp/venv_dev --system-site-package
. /tmp/venv_dev/bin/activate
python3 -m pip install setuptools
python3 -m pip install git+https://github.com/AequilibraE/aequilibrae.git@develop
python3 -m venv /tmp/.venv --system-site-packages
. /tmp/.venv/bin/activate
python3 -m pip install -U pip setuptools uv
python3 -m uv pip install "git+https://github.com/AequilibraE/aequilibrae.git@develop"
touch ./qaequilibrae/packages/aequilibrae_version.txt
python3 -m pip install -r test/requirements-test.txt
python3 ./ci/dependency_installation.py
python3 -m uv pip install -r test/requirements-test.txt --constraint ./ci/constraints.txt
export PYTHONPATH=$(pwd)/qaequilibrae/packages:$PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
- name: Run tests
run: |
. /tmp/venv_dev/bin/activate
export QT_QPA_PLATFORM=offscreen
pwd
python3 -m pytest --cov-report term --cov-config=.coveragerc --cov=qaequilibrae test -v
python3 -m pytest --cov-report term --cov-config=.coveragerc --cov=qaequilibrae test
12 changes: 6 additions & 6 deletions .github/workflows/DevWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ jobs:
strategy:
max-parallel: 4
matrix:
container: [ 'qgis/qgis:latest', 'qgis/qgis:3.34.7']
container: [ 'qgis/qgis:latest', 'qgis/qgis:ltr']
container:
image: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
python3 -m venv /tmp/venv_test --system-site-package
. /tmp/venv_test/bin/activate
python3 -m pip install setuptools
python3 -m pip install -r test/requirements-test.txt
python3 -m venv /tmp/.venv --system-site-packages
. /tmp/.venv/bin/activate
python3 -m pip install -U pip setuptools uv
python3 ./ci/dependency_installation.py
python3 -m uv pip install -r test/requirements-test.txt --constraint ./ci/constraints.txt
export PYTHONPATH=$(pwd)/qaequilibrae/packages:$PYTHONPATH
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
- name: Run tests
run: |
. /tmp/venv_test/bin/activate
. /tmp/.venv/bin/activate
export QT_QPA_PLATFORM=offscreen
pwd
python3 -m pytest --cov-config=.coveragerc --cov-report term-missing --cov=qaequilibrae test
3 changes: 2 additions & 1 deletion .github/workflows/WindowsRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
version: [qgis-ltr --version=3.34.6, qgis-ltr, qgis]
# we test the minimum LTR version required, the newest LTR, and the latest.
version: [qgis-ltr --version=3.34.10, qgis-ltr, qgis]

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ jobs:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r qaequilibrae/requirements.txt
python -m pip install -U pip
pip install -r docs/requirements-docs.txt
- name: Build documentation
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
run: |
sudo apt-get update
sudo apt install qttools5-dev-tools
python -m pip install --upgrade pip
python -m pip install qgis-plugin-ci==2.7.2
python -m pip install -U pip qgis-plugin-ci
- name: Compile translations if they exist
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/translation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:
run: |
sudo apt-get update
sudo apt install qttools5-dev-tools
python -m pip install --upgrade pip
python -m pip install qgis-plugin-ci==2.7.2
python -m pip install -U pip qgis-plugin-ci
- name: Create translatable files
run: |
Expand Down
1 change: 1 addition & 0 deletions ci/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
numpy<2.0
Binary file modified docs/source/images/add_connectors_to_project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/gtfs_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/gtfs_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/gtfs_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/tripdistribution-ipf-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/tripdistribution-ipf-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/tripdistribution-ipf-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/source/menus_in_detail/build_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ The *GUI* for this procedure is fairly straightforward, as shown below.
:align: center
:alt: Adding connectors

When creating centroids from zone centers, one can choose to limit the connector
to the zone or not. Plase notice if one choose to limit the connector creation to a
zone that has fewer nodes connected to links of the required types than the number of connectors will result
in fewer connectors being created than desired.

One would notice that nowhere in the *GUI* one can indicate which modes they
want to see the network connected for or how to control how many connectors per
mode will be created. Although it could be implemented, such a solution would
Expand Down
7 changes: 5 additions & 2 deletions docs/source/menus_in_detail/public_transport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Import GTFS

To import a GTFS feed, click **Public transport > Import GTFS**. A new window with the importer
will open. If it is the first time you are creating a GTFS feed for your project, it may take a little while
to create the public transport database in the project folder. In the GTFS importer window, you can click on
to create the public transport database in the project folder, and your QGIS screen might not be responsive
until the database is created in the project folder. In the GTFS importer window, you can click on
*Add Feed* and point to the location in your machine where the GTFS data is.

.. image:: ../images/gtfs_1.png
Expand All @@ -41,7 +42,9 @@ and you will return to the GTFS importer screen.

Notice that the feed information is now available at the *Feeds to import* table view. The first time you create a
GTFS feed, the only option available is **Create new route system**, so you don't have to click on it.
Then, you can effectively import your GTFS feed to your project by clicking on **Execute Importer**.
If you want to map-match the existing transit routes, you can select **Allow map-match**.
Then, you can import your GTFS feed to your project by clicking on **Execute Importer**.

A window with a progress bar will open and once it is finished, you can check out the GTFS feed data you just
imported in your project folder.

Expand Down
14 changes: 8 additions & 6 deletions docs/source/menus_in_detail/tripdistribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ presented in one of the subsections below.

Iterative Proportional Fitting (IPF)
------------------------------------
It is possible to balance the production/attraction vectors using IPF. There are two different
ways to load a vector's data: loading an \*.AED file or importing from an open layer.
It is possible to balance the production/attraction vectors using IPF. There are three different
ways to load a vector's data: loading a \*.CSV or \*.parquet file or importing from an open layer.

We click on the Iterative Proportional Fitting option to open the menu.

Loading the vector from an \*.AED file is straightforward. Just select the *AequilibraE Data* option
in the menu, and click *Load*, pointing to the location of the vector in your machine.
Loading the vector from a \*.CSV or \*.parquet file is quite the same. Select your preferred option
in the menu, and click *Load*, pointing to the location of the vector file in your machine.

.. image:: ../images/tripdistribution-ipf-1.png
:width: 513
:align: center
:alt: ipf_1

Otherwise, case you are loading from an open layer, just click *Import from layer*,
Case you are loading from an open layer, just click *Import from layer*,
point the available data layer, and the name of its index column. You can choose between *Use data*
or *Save and use*. Case you choose to save, the vector will be saved in a temporary QGIS folder.

Expand All @@ -48,7 +48,9 @@ After the vector is properly loaded, it will appear in the *Load datasets* tab.
:align: center
:alt: ipf_3

You can now select the production/attraction (origin/destination) vectors.
You can now select the production/attraction (origin/destination) vectors. If your data comes
from a table/layer opened in QGIS, you'll notice that the *Index* collapsible list is deactivated because
the data index was selected when loading the data.

.. image:: ../images/tripdistribution-ipf-4.png
:width: 513
Expand Down
2 changes: 1 addition & 1 deletion qaequilibrae/aequilibrae_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aequilibrae==1.0.1
aequilibrae==1.1.3
20 changes: 15 additions & 5 deletions qaequilibrae/download_extra_packages_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import shutil
import subprocess
import sys
from importlib.util import find_spec
from os.path import join, isdir
from pathlib import Path

Expand Down Expand Up @@ -39,6 +40,10 @@ def __init__(self):

def install(self):
reps = []
command = f'"{self.find_python()}" -m pip install uv'
_ = self.execute(command)
print(command)

for file in self.dependency_files:
flag = self.target_folder / file.name
if flag.exists():
Expand All @@ -59,9 +64,10 @@ def install(self):
def install_package(self, package):
Path(self.target_folder).mkdir(parents=True, exist_ok=True)

install_command = f'-m pip install {package} -t "{self.target_folder}"'
if "ortools" in package.lower():
install_command += " --no-deps"
spec = find_spec("uv")
is_uv = "" if spec is None else "uv"

install_command = f'-m {is_uv} pip install {package} --target "{self.target_folder}"'

command = f'"{self.find_python()}" {install_command}'
print(command)
Expand Down Expand Up @@ -96,6 +102,10 @@ def execute(self, command):
return lines

def find_python(self):
# Check if we're inside a virtual environment
if sys.prefix != sys.base_prefix:
return "python3"

sys_exe = Path(sys.executable)
if sys.platform == "linux" or sys.platform == "linux2":
# Unlike other platforms, linux uses the system python, lets see if we can guess it
Expand Down Expand Up @@ -147,8 +157,8 @@ def clean_packages(self):

if __name__ == "__main__":
result = DownloadAll().install()
output = ("".join([str(x).upper() for x in result]))
output = "".join([str(x).upper() for x in result])

print(output)

assert "ERROR" not in output
2 changes: 1 addition & 1 deletion qaequilibrae/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def fourth_message(self):
@property
def messsage_five(self):
a = self.tr("QAequilibraE requires Python 3.12.")
b = self.tr("Please install QGIS version 3.34.6+, 3.36.2+ or 3.38.0+ to make it work.")
b = self.tr("Please install QGIS version 3.34.10+ or 3.38.2+ to make it work.")
return f"{a}\r\n{b}"

def tr(self, text):
Expand Down
4 changes: 2 additions & 2 deletions qaequilibrae/metadata.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[general]
name=qaequilibrae
qgisMinimumVersion=3.34.6
qgisMinimumVersion=3.34.10
qgisMaximumVersion=3.99
description=Transportation modeling toolbox for QGIS
about=QAequilibraE is the GUI for AequilibraE, a transportation modeling package designed to be an open-source alternative to traditional commercial packages. It is a comprehensive set of tools for modeling and visualization, including incredibly fast equilibrium traffic assignment, synthetic gravity models, network editing, and GTFS importer. http://www.aequilibrae.com/.
version=1.0.3
version=1.1.3
author=Pedro Camargo
[email protected]
repository= https://github.com/AequilibraE/QAequilibraE
Expand Down
3 changes: 1 addition & 2 deletions qaequilibrae/modules/common_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from .auxiliary_functions import *
from .get_output_file_name import GetOutputFileName
from .get_output_file_name import GetOutputFolderName
from .link_query_model import LinkQueryModel
from .load_graph_layer_setting_dialog import LoadGraphLayerSettingDialog
from .numpy_model import NumpyModel
from .pandas_model import PandasModel
from .database_model import DatabaseModel
from .parameters_dialog import ParameterDialog
from .report_dialog import ReportDialog
from .about_dialog import AboutDialog
from .all_layers_from_toc import all_layers_from_toc
from .log_dialog import LogDialog
from .data_layer_from_dataframe import layer_from_dataframe
from .table_field_lister import find_table_fields
from .geodataframe_from_data_layer import geodataframe_from_layer
90 changes: 0 additions & 90 deletions qaequilibrae/modules/common_tools/about_dialog.py

This file was deleted.

Loading

0 comments on commit 496bad9

Please sign in to comment.