Skip to content

Commit bd95623

Browse files
authored
Merge branch 'main' into sklearn-1.8
2 parents 27d9632 + 5134875 commit bd95623

8 files changed

Lines changed: 167 additions & 148 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414

1515
- name: Set up Python
16-
uses: actions/setup-python@v5
16+
uses: actions/setup-python@v6
1717
with:
1818
python-version: "3.14"
1919

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515

1616
- name: setup Python
17-
uses: actions/setup-python@v5
17+
uses: actions/setup-python@v6
1818
with:
1919
python-version: "3.14"
2020

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v5
12+
- uses: actions/checkout@v6
1313

1414
- name: Set up Python
15-
uses: actions/setup-python@v5
15+
uses: actions/setup-python@v6
1616
with:
1717
python-version: "3.14"
1818

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
contents: write
1717

1818
steps:
19-
- uses: actions/checkout@v5
19+
- uses: actions/checkout@v6
2020
with:
2121
fetch-depth: 0
2222
- name: setup Python
23-
uses: actions/setup-python@v5
23+
uses: actions/setup-python@v6
2424
with:
2525
python-version: "3.14"
2626
- run: python -m pip install tox

.github/workflows/tests-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- "3.14"
1616

1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@v6
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
- "3.14"
2121

2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2424

2525
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929

@@ -38,6 +38,5 @@ jobs:
3838
- name: upload to codecov.io
3939
uses: codecov/codecov-action@v5
4040
with:
41-
fail_ci_if_error: true
4241
files: ./tests/coverage.xml
4342
token: ${{ secrets.CODECOV_TOKEN }}

src/skmatter/metrics/_reconstruction_measures.py

Lines changed: 113 additions & 135 deletions
Large diffs are not rendered by default.

tests/test_metrics.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from skmatter.datasets import load_degenerate_CH4_manifold
88
from skmatter.metrics import (
9+
check_global_reconstruction_measures_input,
10+
check_local_reconstruction_measures_input,
911
componentwise_prediction_rigidity,
1012
global_reconstruction_distortion,
1113
global_reconstruction_error,
@@ -214,6 +216,46 @@ def test_local_reconstruction_error_test_idx(self):
214216
f"size {test_size}",
215217
)
216218

219+
def test_source_target_len(self):
220+
# tests that the source and target features have the same lenght
221+
X = np.array([[1, 2, 3], [4, 5, 6]])
222+
Y = np.array([[1, 2, 3]])
223+
224+
train_idx = [0]
225+
test_idx = [1]
226+
scaler = None
227+
estimator = None
228+
229+
with self.assertRaises(ValueError) as context:
230+
check_global_reconstruction_measures_input(
231+
X, Y, train_idx, test_idx, scaler, estimator
232+
)
233+
234+
expected_message = "First dimension of X (2) and Y (1) must match"
235+
self.assertEqual(str(context.exception), expected_message)
236+
237+
def test_len_n_local_points(self):
238+
# tests that source len is greater or equal than n_local_points in LFRE
239+
X = np.array([[1, 2, 3], [4, 5, 6]])
240+
Y = np.array([[1, 1, 1], [2, 2, 2]])
241+
242+
n_local_points = 10
243+
train_idx = [0]
244+
test_idx = [1]
245+
scaler = None
246+
estimator = None
247+
248+
with self.assertRaises(ValueError) as context:
249+
check_local_reconstruction_measures_input(
250+
X, Y, n_local_points, train_idx, test_idx, scaler, estimator
251+
)
252+
253+
expected_message = (
254+
f"X has {len(X)} samples but n_local_points={n_local_points}. "
255+
"Must have at least n_local_points samples"
256+
)
257+
self.assertEqual(str(context.exception), expected_message)
258+
217259

218260
class DistanceTests(unittest.TestCase):
219261
@classmethod

0 commit comments

Comments
 (0)