def test_run_roi_stats_via_API():
"Tests whether roi stats can be computed (not their accuracy) and the return values match in size."
summary_methods = ['median', 'mean', 'std', 'variation', 'entropy', 'skew', 'kurtosis']
# 'mode' returns more than one value; 'gmean' requires only positive values,
# 'hmean' can not always be computed
from scipy.stats import trim_mean, kstat
from functools import partial
trimmed_mean = partial(trim_mean, proportiontocut=0.05)
third_kstat = partial(kstat, n=3)
summary_methods.extend([trimmed_mean, third_kstat])
# checking support for nan-handling callables
summary_methods.extend([np.nanmedian, np.nanmean])
for summary_method in summary_methods:
roi_medians = graynet.roiwise_stats_indiv(subject_id_list, fs_dir, base_feature=base_feature,
chosen_roi_stats=summary_method, atlas=atlas,
smoothing_param=fwhm, out_dir=out_dir, return_results=True)
for sub in subject_id_list:
if roi_medians[sub].size != num_roi_wholebrain:
raise ValueError('invalid summary stats - #nodes do not match.')
评论列表
文章目录