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] Documenting code #84

Merged
merged 3 commits into from
Dec 15, 2015
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
12 changes: 12 additions & 0 deletions code/stat159lambda/reproduction/analyze_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ def save_correlation_percentiles(aggregation):


def correlation_brain_image(outside_brain_value):
"""
Uses a mask to plot only the areas that are the brain itself and saves
that image into the figures folder.

Parameters
----------
outside_brain_values : int

Returns
-------
None
"""
if outside_brain_value < 0:
title = 'light'
else:
Expand Down
35 changes: 35 additions & 0 deletions code/stat159lambda/reproduction/brain_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@


def plot_vol_mean_histogram(subj_num):
"""
Plots the mean volume for a particular subject and saves that histogram
into the figures folder

Parameters
----------
subj_num : int

Returns
-------
None
"""
data = np.load(dp.get_concatenated_path(subj_num))[...,
NUM_OFFSET_VOLUMES:]
mean_vol = np.mean(data, axis=-1)
Expand All @@ -18,6 +30,17 @@ def plot_vol_mean_histogram(subj_num):


def get_brain_mask():
"""
Retrieves the path to the brain mask and loads that data

Parameters
----------
None

Returns
-------
brain_mask : array
"""
brain_mask_path = dp.get_brain_mask_path()
if not exists(brain_mask_path):
data = np.load(dp.get_concatenated_path(1))
Expand All @@ -28,6 +51,18 @@ def get_brain_mask():


def plot_brain_mask(slice):
"""
Plots the brain mask at a particular slice and saves that into the figures
folder

Parameters
----------
slice : int

Returns
-------
None
"""
image = get_brain_mask()[:, :, slice]
plt.imshow(image, cmap='gray')
plot_path = '{0}/figures/brain_mask.png'.format(REPO_HOME_PATH)
Expand Down
22 changes: 22 additions & 0 deletions code/stat159lambda/utils/data_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ def get_2d_path(subj_num):


def get_brain_mask_path():
"""
Derives the absolute path to the brain_mask.npy file

Parameters
----------
None

Returns
-------
path : string
"""
return '{0}/data/brain_mask.npy'.format(REPO_HOME_PATH)


Expand All @@ -128,4 +139,15 @@ def get_correlation_hist_path(aggregation):


def get_scene_csv():
"""
Derives the absolute path to the scenes.csv file

Parameters
----------
None

Returns
-------
path : string
"""
return '{0}/data/scenes.csv'.format(REPO_HOME_PATH)