Skip to content

Commit

Permalink
Merge pull request #66 from lynnzhao92/lynn
Browse files Browse the repository at this point in the history
Lynn
  • Loading branch information
LiamFengLin committed Dec 11, 2015
2 parents 7d6ff94 + efb170a commit 294f257
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
10 changes: 6 additions & 4 deletions code/extended_rms_outliers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""
Script to apply extended rms outlier detection on a run.
Results of the analysis are to understand the noise in
fMRI data and justify the need for additional preprocessing
steps.
EDA:
This module detects the exteded RMS outliers and generates the plot for those outliers.
Results of the analysis are to understand the noise in fMRI data and justify the need
for additional preprocessing steps.
We detect the outliers on "sub011, task001_run_001"
"""

import project_config
Expand Down
25 changes: 15 additions & 10 deletions code/utils/correlation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
Different methods for calculating correlations between
the fMRI time courses and the neural prediction values.
Both methods are needed so that we can compare the
results from different baseline functions (square wave
and gamma function) in the analysis.
EDA:
Different methods for calculating correlations between the fMRI time courses
and the neural prediction values.Both methods are needed so that we can compare
the results from different baseline functions (square wave and gamma function) in the analysis.
"""

import sys, os
Expand All @@ -18,9 +18,13 @@

def correlation_map_linear(data, cond_filename):
"""
This is different from correlation_map in that it accepts a 2d data
(n_samples, n_time_slices) so that it is suitable for working with
brain masks.
This function computes the correlation matrix based on the baseline method.
Input:
data: brain image data
cond_filename: condition file which contains the info about time time_course
Output:
correlation matrix
"""
convolved = conv_main(data.shape[-1] + 5, cond_filename, TR)[5:]
corrs = np.zeros((data.shape[:-1]))
Expand All @@ -36,8 +40,9 @@ def correlation_map_linear(data, cond_filename):
def correlation_map_without_convoluation_linear(data, cond_filename):
"""
This is different from correlation_map_without_convoluation in that it accepts a 2d data
(n_samples, n_time_slices) so that it is suitable for working with
brain masks.
(n_samples, n_time_slices) and compute the correlations based on the square-wave time course
using the given condition file.
"""
n_trs = data.shape[-1] + 5
time_course = events2neural_rounded(cond_filename, TR, n_trs)
Expand Down
17 changes: 17 additions & 0 deletions code/utils/tests/test_multiple_comparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Test multiple_comparison module
Run with::
nosetests test_multiple_comparison.py
"""

import numpy as np
from .. import multiple_comparison
from numpy.testing import assert_array_equal, assert_almost_equal

def test_multiple_comp():
res = np.linspace(0,1,100)
res.shape = (10,10)
actual = multiple_comparison.multiple_comp(res)
expected = [0, 0, 0, 0]
assert_array_equal(actual, expected)

0 comments on commit 294f257

Please sign in to comment.