Skip to content

Commit b17040a

Browse files
committed
STY: Capitalize the mask warning message variable name
Capitalize the mask warning message variable name for the sake of consistency with the rest of the global variables across the code base. Document its meaning.
1 parent a8069e5 commit b17040a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/nifreeze/model/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727

2828
import numpy as np
2929

30-
mask_absence_warn_msg = (
30+
MASK_ABSENCE_WARN_MSG = (
3131
"No mask provided; consider using a mask to avoid issues in model optimization."
3232
)
33+
"""Mask warning message."""
3334
PREDICTED_MAP_ERROR_MSG = "This model requires the predicted map at initialization"
3435
"""Oracle requirement error message."""
3536
UNSUPPORTED_MODEL_ERROR_MSG = "Unsupported model <{model}>."
@@ -104,7 +105,7 @@ def __init__(self, dataset, **kwargs):
104105
self._dataset = dataset
105106
# Warn if mask not present
106107
if dataset.brainmask is None:
107-
warn(mask_absence_warn_msg, stacklevel=2)
108+
warn(MASK_ABSENCE_WARN_MSG, stacklevel=2)
108109

109110
@abstractmethod
110111
def fit_predict(self, index: int | None = None, **kwargs) -> np.ndarray | None:

test/test_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
)
4141
from nifreeze.model._dipy import GaussianProcessModel
4242
from nifreeze.model.base import (
43+
MASK_ABSENCE_WARN_MSG,
4344
PREDICTED_MAP_ERROR_MSG,
4445
UNSUPPORTED_MODEL_ERROR_MSG,
45-
mask_absence_warn_msg,
4646
)
4747
from nifreeze.testing import simulations as _sim
4848

@@ -98,7 +98,7 @@ def test_trivial_model(request, use_mask):
9898
mask = np.ones(size, dtype=bool)
9999
context = contextlib.nullcontext()
100100
else:
101-
context = pytest.warns(UserWarning, match=mask_absence_warn_msg)
101+
context = pytest.warns(UserWarning, match=MASK_ABSENCE_WARN_MSG)
102102

103103
_S0 = rng.normal(size=size)
104104

0 commit comments

Comments
 (0)