Commit 30c26ca
committed
REF: Allow bvals and bvecs to be separate fixtures
Allow bvals and bvecs to be separate fixtures. The DWI shell selection
test was failing in
https://github.com/nipreps/nifreeze/actions/runs/18065201218/job/51406989162#step:11:2848
with
```
if not shellmask.sum():
> raise RuntimeError(f"Shell corresponding to index {index} (b={bcenter}) is empty.")
E RuntimeError: Shell corresponding to index 3 (b=2000.0) is empty.
```
When changing `conftest.py` for other purposes, the above test, which
was affected since the `bvals` generated by the
`setupt_random_gtab_data` fixture did not match the previous version,
and the test's hard-coded expected values no longer matched the existing
ones.
Solve the issue by adding two separate fixtures for bvals an bvecs. For
the above test bvals will have some fixed values (i.e. will not used the
fixture), and the bvecs fixture will provide some random values
depending on the bvals (i.e. the number of created directions depending
on the number of b0s and number of non-zero b-values).
Do not use make the bvec fixture be invoked automatically for all tests
(i.e. do not use `autouse=True`) to avoid the
```
fixture 'bvals' not found
```
error. This way, only tests that explicitly request the bvec fixture
(`setup_random_bvec_data`) and are properly parametrized with `bvals`
will use it.
Refactor the gtab fixture to call the private functions that create
random bval and bvec values.
The issue is related to commit e353bbd.1 parent 6c00959 commit 30c26ca
3 files changed
+58
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 212 | + | |
215 | 213 | | |
216 | 214 | | |
217 | 215 | | |
| |||
235 | 233 | | |
236 | 234 | | |
237 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
238 | 276 | | |
239 | 277 | | |
240 | 278 | | |
| |||
248 | 286 | | |
249 | 287 | | |
250 | 288 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 289 | + | |
| 290 | + | |
258 | 291 | | |
259 | 292 | | |
260 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | 96 | | |
98 | | - | |
| 97 | + | |
99 | 98 | | |
100 | | - | |
101 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
102 | 107 | | |
103 | 108 | | |
104 | | - | |
105 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
0 commit comments