Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency updates #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions example_script.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion neuropower/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def PeakTable(spm, exc, mask):
res = pd.DataFrame(
data=[[m - r, n - r, o - r, spm_ext[m, n, o]]], columns=labels
)
peak_df = peak_df.append(res)
peak_df = pd.concat([peak_df, res], ignore_index=True)

# Peak-level p-values (not the same as simple z-to-p conversion)
p_values = np.exp(-float(exc) * (np.array(peak_df["zval"]) - float(exc)))
Expand Down
9 changes: 5 additions & 4 deletions neuropower/neuropowermodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from scipy.optimize import minimize
from scipy.stats import beta, norm, t as tdist

from nilearn.image import math_img
from neuropower import BUM, cluster, peakdistribution


Expand Down Expand Up @@ -418,10 +419,10 @@ def run_power_analysis(
DataFrame of power estimates using different multiple comparisons
correction methods for different sample sizes.
"""
spm = input_img.get_data()
spm = input_img.get_fdata()
affine = input_img.affine
voxel_size = input_img.header.get_zooms()
mask = mask_img.get_data() if mask_img is not None else (spm != 0).astype(int)
mask = mask_img.get_fdata() if mask_img is not None else math_img('(img != 0)', img=input_img).get_fdata()
n_voxels = np.sum(mask)

if design == "one-sample":
Expand Down Expand Up @@ -531,7 +532,7 @@ def generate_figure(peak_df, params, method="RFT"):
axes[0].hist(
p_values,
bins=np.arange(0, 1.1, 0.1),
normed=True,
density=True,
alpha=0.6,
label="observed distribution",
)
Expand All @@ -557,7 +558,7 @@ def generate_figure(peak_df, params, method="RFT"):
y, _, _ = axes[1].hist(
z_values,
bins=np.arange(min(z_values), 30, 0.3),
normed=True,
density=True,
alpha=0.6,
label="observed distribution",
)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ dependencies = [
"nibabel>=2.0.2",
"pandas>=0.18.1",
"nose>=1.3.7",
"matplotlib"
"matplotlib",
"nilearn"
]
description = "A package to perform power analyses for neuroimaging data"
# Version from setuptools_scm
Expand Down
Loading