Skip to content

Commit ae30375

Browse files
committed
Fix misori_tetragonal identity bug and add c2ImageD11 cross-test CI
misori_tetragonal: the trace comparison was checking m2 > m3 (off-diagonal vs c-axis) instead of m1 > m2 (diagonal vs off-diagonal), causing the identity case to return 1 instead of 3. This matches the fix already applied in c2ImageD11 0.3.0. Also noted: refine_assigned infinite-loop bug (i++ instead of j++) was already fixed in commit acb51d5. CI: add a workflow that builds c2ImageD11 from git head (using their checked-in pre-generated wrappers, no c2py23 dependency) and runs the full ImageD11 test suite with IMAGED11_USE_C2=1, so we break when upstream changes break our compatibility.
1 parent 8179212 commit ae30375

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Cross-test against c2ImageD11 git head.
2+
#
3+
# Builds c2ImageD11 from source (meson+ninja) using the pre-generated
4+
# wrappers checked into c2ImageD11's repo — no c2py23 dependency.
5+
# Then runs the full ImageD11 test suite with IMAGED11_USE_C2=1 so we
6+
# break if an upstream change in c2ImageD11 makes our tests fail.
7+
#
8+
# This is the mirror of c2ImageD11's own CI which installs ImageD11 from
9+
# PyPI. Here we install c2ImageD11 from git head and test our own checkout.
10+
11+
name: c2ImageD11 cross-test
12+
13+
on:
14+
push:
15+
branches: [ master ]
16+
pull_request:
17+
branches: [ master ]
18+
19+
jobs:
20+
build-c2-and-test:
21+
runs-on: ubuntu-22.04
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
path: imaged11
30+
31+
- name: Checkout c2ImageD11 git head
32+
uses: actions/checkout@v4
33+
with:
34+
repository: jonwright/c2ImageD11
35+
path: c2ImageD11
36+
37+
- name: Set up Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Install build deps for c2ImageD11
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install meson ninja numpy
46+
47+
- name: Build c2ImageD11 .so with meson (checked-in wrappers, no c2py23)
48+
run: |
49+
mkdir -p c2ImageD11/build/libc2ImageD11
50+
cd c2ImageD11/build/libc2ImageD11
51+
meson setup ../../lib
52+
ninja
53+
arch=$(python -c "import platform; print(platform.machine())")
54+
cp _cImageD11.so ../../c2ImageD11/_cImageD11_${arch}.so
55+
56+
- name: Install c2ImageD11
57+
run: |
58+
cd c2ImageD11 && python -m pip install .
59+
60+
- name: Install ImageD11 and test deps
61+
run: |
62+
python -m pip install numpy pytest numba fabio pyFAI xfab diffpy.Structure scipy orix
63+
cd imaged11 && python -m pip install -e .
64+
65+
- name: Test with IMAGED11_USE_C2=1
66+
run: |
67+
cd imaged11/test
68+
IMAGED11_USE_C2=1 python -m pytest -v --ignore=test_columnfile_pandas.py

src/closest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ double misori_tetragonal(vec u1[3], vec u2[3]) {
828828
}
829829
m1 = fabs(r[0][0]) + fabs(r[1][1]);
830830
m2 = fabs(r[1][0]) + fabs(r[0][1]);
831-
if (m2 > m3) {
831+
if (m1 > m2) {
832832
return m1 + m3;
833833
} else {
834834
return m2 + m3;

0 commit comments

Comments
 (0)