Skip to content

Commit

Permalink
Small adjustment to how FWER correction is calculated.
Browse files Browse the repository at this point in the history
  • Loading branch information
trislett committed Sep 12, 2018
1 parent fedd276 commit 3bccf6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions tfce_mediation/tmanalysis/calculate_fweP_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import numpy as np
import nibabel as nib
import argparse as ap
import math

DESCRIPTION = "Calculate 1-P[FWE] surface from max TFCE values from randomisation."

Expand All @@ -37,12 +36,10 @@ def getArgumentParser(ap = ap.ArgumentParser(description = DESCRIPTION)):
#find nearest permuted TFCE max value that corresponse to family-wise error rate
def find_nearest(array,value,p_array):
idx = np.searchsorted(array, value, side="left")
if idx == len(p_array):
return p_array[idx-1]
elif math.fabs(value - array[idx-1]) < math.fabs(value - array[idx]):
return p_array[idx-1]
else:
if idx == 0:
return p_array[idx]
else:
return p_array[idx-1]


def run(opts):
Expand Down
8 changes: 3 additions & 5 deletions tfce_mediation/tmanalysis/calculate_fweP_voxel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ def getArgumentParser(ap = ap.ArgumentParser(description = DESCRIPTION)):
#find nearest permuted TFCE max value that corresponse to family-wise error rate
def find_nearest(array,value,p_array):
idx = np.searchsorted(array, value, side="left")
if idx == len(p_array):
return p_array[idx-1]
elif math.fabs(value - array[idx-1]) < math.fabs(value - array[idx]):
return p_array[idx-1]
else:
if idx == 0:
return p_array[idx]
else:
return p_array[idx-1]

def run(opts):
arg_tfce_img = str(opts.input[0])
Expand Down

0 comments on commit 3bccf6e

Please sign in to comment.