Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Continuous Deployment"

on:
push:
tags:
- "*"

jobs:

#############################################################################
# Create and online deployment of the documentation #########################
docs: #######################################################################
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies (pip)
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install .[docs]

- name: Build Documentation
run: |
make html
working-directory: docs/

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
allow_empty_commit: true

#############################################################################
## Publish the distribution to PyPI #########################################
distribution_pypi: ##########################################################
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install build
run: >-
python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: >-
python -m build --sdist --wheel --outdir dist/ .

- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

#############################################################################
## Create a public "Release" on the Github page #############################
release_github: #############################################################
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
35 changes: 0 additions & 35 deletions .github/workflows/ci.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/create-release.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Create Git Tag

on:
workflow_dispatch:
inputs:
tag_name:
description: "Tag name (eg. v1.3.0)"
required: true
type: string

permissions:
contents: write

jobs:
create_tag:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Configure git with PAT
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${{ secrets.PAT_EZYRB_PUSH }}@github.com/${{ github.repository }}.git"

- name: Check if the tag is already existing
run: |
TAG="${{ inputs.tag_name }}"
git fetch --tags
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
echo "❌ Tag $TAG already exists"
exit 1
fi

- name: Create and push the tag
run: |
TAG="${{ inputs.tag_name }}"
git tag "$TAG"
git push origin "$TAG"
47 changes: 0 additions & 47 deletions .github/workflows/monthly-tag.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/pypi-publish.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/sphinx-build.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/testing_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: [3.8, 3.9, 3.10, 3.11]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4


- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion ezyrb/plugin/shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def fit_preprocessing(self, rom):
rom.database = db

def predict_postprocessing(self, rom):
for param, snap in rom.predict_full_database._pairs:
for param, snap in rom.predicted_full_database._pairs:
snap.space = (
rom.database._pairs[self.reference_index][1].space +
self.__shift_function(param.values)
Expand Down
17 changes: 12 additions & 5 deletions ezyrb/reducedordermodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,12 @@ def predict(self, parameters=None):

# convert parameters from Database to numpy array (if database)
if isinstance(parameters, Database):
self.predict_full_database = parameters
self.predict_reduced_database = parameters

elif isinstance(parameters, (list, np.ndarray, tuple)):
self.predict_full_database = Database(parameters, [None]*len(parameters))
print(parameters)
parameters = np.atleast_2d(parameters)
self.predict_reduced_database = Database(parameters, [None]*len(parameters))
elif parameters is None:
if self.predict_full_database is None:
raise RuntimeError
Expand All @@ -677,13 +680,17 @@ def predict(self, parameters=None):

self.multi_predict_database = {}
for k, rom_ in self.roms.items():
self.multi_predict_database[k] = rom_.predict(self.predict_full_database)
self.multi_predict_database[k] = rom_.predict(self.predict_reduced_database)
print(self.multi_predict_database)
self._execute_plugins('predict_postprocessing')

if isinstance(parameters, Database):
return self.predict_full_database
return self.multi_predict_database
else:
return self.predict_full_database.snapshots_matrix
return {
k:db.snapshots_matrix
for k, db in self.multi_predict_database.items()
}


def save(self, fname, save_db=True, save_reduction=True, save_approx=True):
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ezyrb"
version = "1.3.1"
version = "1.3.2"
description = "Easy Reduced Basis"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -36,14 +36,11 @@ dev = [
"black",
"pylint"
]
tutorial = [
"jupyter",
"notebook"
]

[project.urls]
Homepage = "https://github.com/mathLab/EZyRB"
Repository = "https://github.com/mathLab/EZyRB"
Documentation = "http://mathlab.github.io/EZyRB/"

[build-system]
requires = ["setuptools>=45", "wheel"]
Expand Down
16 changes: 6 additions & 10 deletions tests/test_k_neighbors_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ def test_with_db_predict(self):

def test_wrong1(self):
# wrong number of params
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
with self.assertRaises(Exception):
reg = KNeighborsRegressor()
reg.fit([[1, 2], [6,], [8, 9]], [[1, 0], [20, 5], [8, 6]])
with self.assertRaises(Exception):
reg = KNeighborsRegressor()
reg.fit([[1, 2], [6,], [8, 9]], [[1, 0], [20, 5], [8, 6]])

def test_wrong2(self):
# wrong number of values
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
with self.assertRaises(Exception):
reg = KNeighborsRegressor()
reg.fit([[1, 2], [6,], [8, 9]], [[20, 5], [8, 6]])
with self.assertRaises(Exception):
reg = KNeighborsRegressor()
reg.fit([[1, 2], [6,], [8, 9]], [[20, 5], [8, 6]])
Loading