2121from nimare import _version
2222from nimare .estimator import Estimator
2323from nimare .meta import models
24+ from nimare .meta .utils import fit_spatial_cbmr_approximate
2425from nimare .results import MetaResult
2526from nimare .utils import (
2627 DEFAULT_FLOAT_DTYPE ,
3435 seed_torch ,
3536 validate_coordinate_spaces ,
3637)
37- from nimare .meta .utils import fit_spatial_cbmr_approximate
3838
3939LGR = logging .getLogger (__name__ )
4040__version__ = _version .get_versions ()["version" ]
@@ -1095,8 +1095,13 @@ def __init__(
10951095 self .moderators = None
10961096
10971097 if self .moderator_effect == "global" :
1098- self ._validate_global_pipeline_options (method , sandwich_meat , sandwich_correction , ridge )
1099- else : # voxelwise
1098+ self ._validate_global_pipeline_options (
1099+ method ,
1100+ sandwich_meat ,
1101+ sandwich_correction ,
1102+ ridge ,
1103+ )
1104+ else : # voxelwise
11001105 if method is None :
11011106 method = "sandwich"
11021107 self .method = self ._validate_method (method )
@@ -1186,7 +1191,7 @@ def _reset_inference_caches(self):
11861191 self ._moderator_covariance = None
11871192 self ._moderator_variance = None
11881193 self ._moderator_coef_table = None
1189- else : # voxelwise
1194+ else : # voxelwise
11901195 self ._group_covariance_cache = {}
11911196 self ._group_coefficient_cache = {}
11921197
@@ -1196,7 +1201,7 @@ def _get_group_log_intensity(self, group):
11961201 if group_log_intensity is None :
11971202 if self .moderator_effect == "global" :
11981203 group_log_intensity = np .log (self .result .maps [f"spatialIntensity_group-{ group } " ])
1199- else : # voxelwise
1204+ else : # voxelwise
12001205 bases = self .estimator .inputs_ ["coef_spline_bases" ]
12011206 coefficient = self ._get_group_coefficient_matrix (group )
12021207 group_log_intensity = bases @ coefficient [- 1 ]
@@ -1217,7 +1222,7 @@ def _get_group_null_log_intensity(self, group):
12171222 group_null_log_intensity = np .log (
12181223 np .sum (group_foci_per_voxel ) / (n_voxels * n_experiments )
12191224 )
1220- else : # voxelwise
1225+ else : # voxelwise
12211226 foci = self .estimator .inputs_ ["foci_by_experiment_voxel" ][group ]
12221227 total_foci = foci .sum ()
12231228 n_experiments , n_voxels = foci .shape
@@ -1959,12 +1964,12 @@ def _store_moderator_inference_result(
19591964 self .result .maps [f"chiSquare_svModerator_{ contrast_name } _group-{ group } " ] = (
19601965 moderator_stats ["chi_square" ]
19611966 )
1962- self .result .maps [f"p_svModerator_{ contrast_name } _group-{ group } " ] = (
1963- moderator_stats [ "p" ]
1964- )
1965- self .result .maps [f"z_svModerator_{ contrast_name } _group-{ group } " ] = (
1966- moderator_stats [ "z" ]
1967- )
1967+ self .result .maps [f"p_svModerator_{ contrast_name } _group-{ group } " ] = moderator_stats [
1968+ "p"
1969+ ]
1970+ self .result .maps [f"z_svModerator_{ contrast_name } _group-{ group } " ] = moderator_stats [
1971+ "z"
1972+ ]
19681973 else :
19691974 if moderator_stats ["contrast_count" ] > 1 :
19701975 self .result .maps [
@@ -2327,4 +2332,3 @@ def _compute_spatial_coefficient_statistics(cls, coefficient, covariance, contra
23272332 "p" : p_vals ,
23282333 "z" : z_stats ,
23292334 }
2330-
0 commit comments