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

WIP: Revamped ISC analyses with additional statistical tests #384

Merged
merged 46 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a278d5e
Reworked core ISC function for more flexible input, no internal stats
snastase Sep 24, 2018
be185d2
ISC function intelligently handles only two subjects
snastase Sep 24, 2018
0472690
Added bootstrap resampling subjects for one-sample test
snastase Sep 24, 2018
d949b0b
Moved non-pairwise operations out of voxel loop for speed
snastase Sep 28, 2018
be76561
Added permutation test for one- and two-sample tests
snastase Oct 2, 2018
25b2e73
Added function for circular time-shift randomization test
snastase Oct 2, 2018
decfbf9
Fixed time-shift to only shift test subject in leave-one-out
snastase Oct 2, 2018
511afd2
New phase randomization test, both pairwise and leave-one-out
snastase Oct 2, 2018
169c9db
Revamped ISFC with no internal stats (no pairwise yet)
snastase Oct 2, 2018
be46bf5
Added pairwise option to ISFC, fixed inputs to compute_correlation
snastase Oct 3, 2018
0a634a5
Fixed bug in leave-one-out procedure for ISC and ISFC
snastase Oct 4, 2018
4f9f2c3
Added tests for new ISC/ISFC functionality and statistical tests
snastase Oct 4, 2018
94d10cc
Fixed location of test_isfc.py and added module imports
snastase Oct 4, 2018
d0fc472
Small fixes in ISC/ISFC tests
snastase Oct 6, 2018
e9e37fa
Check simulated data isn't inadvertently correlated in test, more ver…
snastase Oct 6, 2018
5567398
Revert "Check simulated data isn't inadvertently correlated in test, …
snastase Oct 6, 2018
d2f91e5
Check simulated data isn't inadvertently correlated in test, more ver…
snastase Oct 6, 2018
8901841
Added function in utils to get p-value from null distribution
snastase Nov 8, 2018
348c587
New summary statistic function, minor changes to p-value computation
snastase Nov 9, 2018
b1bf090
Removed 'verbose' functionality and replaced 'print' with 'logging'
snastase Nov 9, 2018
a4b5070
Added 'axis' argument to p-value computation
snastase Nov 9, 2018
34356c5
Fixed explosive 'Only two subjects' logging warning for time-/phase-s…
snastase Nov 9, 2018
7a2994c
Always returns distribution; switched all logger warnings to 'info' l…
snastase Nov 9, 2018
56e0e2e
Simplified template matrix for two-sample pairwise permutation test
snastase Nov 9, 2018
35c3e72
Added MAX_RANDOM_SEED constant
snastase Nov 9, 2018
d05338d
MaskedMultiSubjectData shape now n_TRs, n_voxels, n_subjects
snastase Nov 11, 2018
180edca
Separate mini-functions for checking ISC input assumptions
snastase Nov 11, 2018
5c86ec0
Added Q as co-author on ISC package
snastase Nov 11, 2018
39ba709
Merge branch 'master' into isc-stats
snastase Nov 11, 2018
3d6d7f8
Fixed whitespace errors and too-long lines for Travis
snastase Nov 19, 2018
40bd067
Merge branch 'isc-stats' of https://github.com/snastase/brainiak into…
snastase Nov 19, 2018
304ad50
Changed module name from isfc to isc, which is more general family of…
snastase Nov 19, 2018
dc297fc
Minor fixes for Travis, and ISC input check now accepts MaskedMultiSu…
snastase Nov 19, 2018
36b194d
Fixed installation error, removed crud
snastase Dec 5, 2018
1f0546c
Removed f-strings to please travis .·´¯·.
snastase Dec 5, 2018
8c06952
Merge branch 'isc-stats' of https://github.com/snastase/brainiak into…
snastase Dec 5, 2018
342d14f
Re-added 'isfc' module with deprecation warning
snastase Dec 5, 2018
7a58b31
New smaller permutation_isc functions to reduce complex
snastase Dec 6, 2018
5bbafe9
Fixed test_images.py for new MMSD shape
snastase Dec 6, 2018
196b94d
Set tolerance for allclose in ISC/ISFC test comparison
snastase Dec 6, 2018
d2e00a2
Fixed dedent in docstring refs for html rendering
snastase Dec 6, 2018
38530a3
Removed deprecated isfc.py entirely, fixed [Chen2016]
snastase Dec 6, 2018
04c7734
Removed duplicate Simony reference in phaseshift_isc
snastase Dec 6, 2018
3a5a0d8
Fixed references and added doi URLs
snastase Dec 6, 2018
a39f0b8
Updated example with current ISC code
snastase Dec 7, 2018
bae11b6
Changed test_isc_output to allclose with some tolerance
snastase Dec 7, 2018
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
33 changes: 18 additions & 15 deletions brainiak/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,46 +34,49 @@


class MaskedMultiSubjectData(np.ndarray):
"""Array in shape n_voxels, n_trs, n_subjects."""
"""Array with shape n_TRs, n_voxels, n_subjects."""
@classmethod
def from_masked_images(cls: Type[T], masked_images: Iterable[np.ndarray],
n_sub: int) -> T:
"""Create a new instance from masked images.
n_subjects: int) -> T:
"""Create a new instance of MaskedMultiSubjecData from masked images.

Parameters
----------
masked_images
Images to concatenate.
n_sub
Number of subjects. Must match the number of images.
masked_images : iterator
Images from multiple subjects to stack along 3rd dimension
n_subjects : int
Number of subjects; must match the number of images

Returns
-------
T
A new instance.
A new instance of MaskedMultiSubjectData

Raises
------
ValueError
Images have different shapes.

The number of images differs from n_sub.
The number of images differs from n_subjects.
"""
images_iterator = iter(masked_images)
first_image = next(images_iterator)
result = np.empty((first_image.shape[0], first_image.shape[1], n_sub))
first_image_shape = first_image.T.shape
result = np.empty((first_image_shape[0], first_image_shape[1],
n_subjects))
for n_images, image in enumerate(itertools.chain([first_image],
images_iterator)):
if image.shape != first_image.shape:
image = image.T
if image.shape != first_image_shape:
raise ValueError("Image {} has different shape from first "
"image: {} != {}".format(n_images,
image.shape,
first_image.shape))
first_image_shape))
result[:, :, n_images] = image
n_images += 1
if n_images != n_sub:
raise ValueError("n_sub != number of images: {} != {}"
.format(n_sub, n_images))
if n_images != n_subjects:
raise ValueError("n_subjects != number of images: {} != {}"
.format(n_subjects, n_images))
return result.view(cls)


Expand Down
Loading