Skip to content
Merged
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
4 changes: 2 additions & 2 deletions brainiak/fcma/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
logger = logging.getLogger(__name__)

__all__ = [
"RandomType",
"prepare_fcma_data",
"generate_epochs_info",
"prepare_fcma_data",
"prepare_mvpa_data",
"prepare_searchlight_mvpa_data",
"RandomType",
]


Expand Down
4 changes: 4 additions & 0 deletions brainiak/fcma/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
from scipy.stats.mstats import zscore
import math

__all__ = [
"compute_correlation",
]


def _normalize_for_correlation(data, axis):
"""normalize the data before computing correlation
Expand Down
3 changes: 2 additions & 1 deletion brainiak/funcalign/srm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
import sys

__all__ = [
"SRM", "DetSRM"
"DetSRM",
"SRM",
]

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion brainiak/funcalign/sssrm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from brainiak.funcalign import srm

__all__ = [
"SSSRM"
"SSSRM",
]

logger = logging.getLogger(__name__)
Expand Down
4 changes: 4 additions & 0 deletions brainiak/hyperparamopt/hpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

logger = logging.getLogger(__name__)

__all__ = [
"fmin",
]


def get_sigma(x, min_limit=-np.inf, max_limit=np.inf):
"""Compute the standard deviations around the points for a 1D GMM.
Expand Down
5 changes: 3 additions & 2 deletions brainiak/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

__all__ = [
"ConditionSpec",
"SingleConditionSpec",
"mask_image",
"MaskedMultiSubjectData",
"mask_image",
"mask_images",
"multimask_images",
"SingleConditionSpec",
]

import itertools
Expand Down
1 change: 1 addition & 0 deletions brainiak/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

__all__ = [
"load_boolean_mask",
"load_images",
"load_images_from_dir",
"load_labels",
"save_as_nifti_file",
Expand Down
55 changes: 33 additions & 22 deletions brainiak/isc.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@

logger = logging.getLogger(__name__)

__all__ = [
"bootstrap_isc",
"compute_summary_statistic",
"isfc",
"isc",
"permutation_isc",
"phaseshift_isc",
"timeshift_isc",
]


MAX_RANDOM_SEED = 2**32 - 1


Expand Down Expand Up @@ -105,7 +116,7 @@ def isc(data, pairwise=False, summary_statistic=None):
"""

# Check response time series input format
data, n_TRs, n_voxels, n_subjects = check_timeseries_input(data)
data, n_TRs, n_voxels, n_subjects = _check_timeseries_input(data)

# No summary statistic if only two subjects
if n_subjects == 2:
Expand Down Expand Up @@ -184,7 +195,7 @@ def isfc(data, pairwise=False, summary_statistic=None):
"""

# Check response time series input format
data, n_TRs, n_voxels, n_subjects = check_timeseries_input(data)
data, n_TRs, n_voxels, n_subjects = _check_timeseries_input(data)

# Handle just two subjects properly
if n_subjects == 2:
Expand Down Expand Up @@ -236,7 +247,7 @@ def isfc(data, pairwise=False, summary_statistic=None):
return isfcs


def check_timeseries_input(data):
def _check_timeseries_input(data):

"""Checks response time series input data for ISC analysis

Expand Down Expand Up @@ -299,7 +310,7 @@ def check_timeseries_input(data):
return data, n_TRs, n_voxels, n_subjects


def check_isc_input(iscs, pairwise=False):
def _check_isc_input(iscs, pairwise=False):

"""Checks ISC inputs for statistical tests

Expand Down Expand Up @@ -466,7 +477,7 @@ def bootstrap_isc(iscs, pairwise=False, summary_statistic='median',
"""

# Standardize structure of input data
iscs, n_subjects, n_voxels = check_isc_input(iscs, pairwise=pairwise)
iscs, n_subjects, n_voxels = _check_isc_input(iscs, pairwise=pairwise)

# Check for valid summary statistic
if summary_statistic not in ('mean', 'median'):
Expand Down Expand Up @@ -558,7 +569,7 @@ def bootstrap_isc(iscs, pairwise=False, summary_statistic='median',
return observed, ci, p, distribution


def check_group_assignment(group_assignment, n_subjects):
def _check_group_assignment(group_assignment, n_subjects):
if type(group_assignment) == list:
pass
elif type(group_assignment) == np.ndarray:
Expand All @@ -574,7 +585,7 @@ def check_group_assignment(group_assignment, n_subjects):
return group_assignment


def get_group_parameters(group_assignment, n_subjects, pairwise=False):
def _get_group_parameters(group_assignment, n_subjects, pairwise=False):

# Set up dictionary to contain group info
group_parameters = {'group_assignment': group_assignment,
Expand Down Expand Up @@ -652,9 +663,9 @@ def get_group_parameters(group_assignment, n_subjects, pairwise=False):
return group_parameters


def permute_one_sample_iscs(iscs, group_parameters, i, pairwise=False,
summary_statistic='median', group_matrix=None,
exact_permutations=None, prng=None):
def _permute_one_sample_iscs(iscs, group_parameters, i, pairwise=False,
summary_statistic='median', group_matrix=None,
exact_permutations=None, prng=None):

"""Applies one-sample permutations to ISC data

Expand Down Expand Up @@ -720,9 +731,9 @@ def permute_one_sample_iscs(iscs, group_parameters, i, pairwise=False,
return isc_sample


def permute_two_sample_iscs(iscs, group_parameters, i, pairwise=False,
summary_statistic='median',
exact_permutations=None, prng=None):
def _permute_two_sample_iscs(iscs, group_parameters, i, pairwise=False,
summary_statistic='median',
exact_permutations=None, prng=None):

"""Applies two-sample permutations to ISC data

Expand Down Expand Up @@ -875,19 +886,19 @@ def permutation_isc(iscs, group_assignment=None, pairwise=False, # noqa: C901
"""

# Standardize structure of input data
iscs, n_subjects, n_voxels = check_isc_input(iscs, pairwise=pairwise)
iscs, n_subjects, n_voxels = _check_isc_input(iscs, pairwise=pairwise)

# Check for valid summary statistic
if summary_statistic not in ('mean', 'median'):
raise ValueError("Summary statistic must be 'mean' or 'median'")

# Check match between group labels and ISCs
group_assignment = check_group_assignment(group_assignment,
n_subjects)
group_assignment = _check_group_assignment(group_assignment,
n_subjects)

# Get group parameters
group_parameters = get_group_parameters(group_assignment, n_subjects,
pairwise=pairwise)
group_parameters = _get_group_parameters(group_assignment, n_subjects,
pairwise=pairwise)

# Set up permutation type (exact or Monte Carlo)
if group_parameters['n_groups'] == 1:
Expand Down Expand Up @@ -956,7 +967,7 @@ def permutation_isc(iscs, group_assignment=None, pairwise=False, # noqa: C901

# If one group, apply sign-flipping procedure
if group_parameters['n_groups'] == 1:
isc_sample = permute_one_sample_iscs(
isc_sample = _permute_one_sample_iscs(
iscs, group_parameters, i,
pairwise=pairwise,
summary_statistic=summary_statistic,
Expand All @@ -965,7 +976,7 @@ def permutation_isc(iscs, group_assignment=None, pairwise=False, # noqa: C901

# If two groups, set up group matrix get the observed difference
else:
isc_sample = permute_two_sample_iscs(
isc_sample = _permute_two_sample_iscs(
iscs, group_parameters, i,
pairwise=pairwise,
summary_statistic=summary_statistic,
Expand Down Expand Up @@ -1057,7 +1068,7 @@ def timeshift_isc(data, pairwise=False, summary_statistic='median',
"""

# Check response time series input format
data, n_TRs, n_voxels, n_subjects = check_timeseries_input(data)
data, n_TRs, n_voxels, n_subjects = _check_timeseries_input(data)

# Get actual observed ISC
observed = isc(data, pairwise=pairwise,
Expand Down Expand Up @@ -1191,7 +1202,7 @@ def phaseshift_isc(data, pairwise=False, summary_statistic='median',
"""

# Check response time series input format
data, n_TRs, n_voxels, n_subjects = check_timeseries_input(data)
data, n_TRs, n_voxels, n_subjects = _check_timeseries_input(data)

# Get actual observed ISC
observed = isc(data, pairwise=pairwise,
Expand Down
7 changes: 5 additions & 2 deletions brainiak/reprsimil/brsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
logger = logging.getLogger(__name__)

__all__ = [
"BRSA", "GBRSA", "prior_GP_var_inv_gamma", "prior_GP_var_half_cauchy",
"Ncomp_SVHT_MG_DLD_approx"
"BRSA",
"GBRSA",
"Ncomp_SVHT_MG_DLD_approx",
"prior_GP_var_inv_gamma",
"prior_GP_var_half_cauchy",
]


Expand Down
6 changes: 5 additions & 1 deletion brainiak/searchlight/searchlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
"""

__all__ = [
"Searchlight", "Shape", "Cube", "Diamond", "Ball"
"Ball",
"Cube",
"Diamond",
"Searchlight",
"Shape",
]


Expand Down
12 changes: 6 additions & 6 deletions brainiak/utils/fmrisim.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@
import copy

__all__ = [
"generate_signal",
"generate_stimfunction",
"export_3_column",
"export_epoch_file",
"convolve_hrf",
"apply_signal",
"calc_noise",
"compute_signal_change",
"convolve_hrf",
"export_3_column",
"export_epoch_file",
"generate_signal",
"generate_stimfunction",
"generate_noise",
"mask_brain",
"compute_signal_change",
]

logger = logging.getLogger(__name__)
Expand Down
17 changes: 9 additions & 8 deletions brainiak/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@
"""

__all__ = [
"from_tri_2_sym",
"from_sym_2_tri",
"sumexp_stable",
"center_mass_exp",
"compute_p_from_null_distribution",
"concatenate_not_none",
"cov2corr",
"ReadDesign",
"ecdf",
"from_tri_2_sym",
"from_sym_2_tri",
"gen_design",
"usable_cpu_count",
"center_mass_exp",
"phase_randomize",
"ecdf",
"p_from_null"
"p_from_null",
"ReadDesign",
"sumexp_stable",
"usable_cpu_count",
]


Expand Down