Skip to content

Commit

Permalink
Merge a21efac into 122e406
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHsieh committed Dec 12, 2015
2 parents 122e406 + a21efac commit 9adb32c
Show file tree
Hide file tree
Showing 51 changed files with 60 additions and 453 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.PHONY: all clean coverage test
.PHONY: all clean coverage test verbose

all: clean

clean:
find . -name "*.so" -o -name "*.pyc" -o -name "*.pyx.md5" | xargs rm -f

coverage:
nosetests code/utils data --with-coverage --cover-package=data --cover-package=utils
nosetests code/utils/tests data/tests --with-coverage --cover-package=data/data.py --cover-package=code/utils/functions

test:
nosetests code/utils data
nosetests code/utils/tests data/tests

verbose:
nosetests -v code/utils data
nosetests -v code/utils/tests data/tests
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# project-template
# UC Berkeley Stat 159/259 Fall 2015
## Project-Theta

[![Build Status](https://travis-ci.org/berkeley-stat159/project-theta.svg?branch=master)](https://travis-ci.org/berkeley-stat159/project-theta?branch=master)
[![Coverage Status](https://coveralls.io/repos/berkeley-stat159/project-theta/badge.svg?branch=master)](https://coveralls.io/r/berkeley-stat159/project-theta?branch=master)

Fall 2015 group project
_**Group members:**_ Siyao Chang ([`changsiyao`](https://github.com/changsiyao)) , Boying Gong ([`boyinggong`](https://github.com/boyinggong)), Benjamin Hsieh ([`BenjaminHsieh`](https://github.com/BenjaminHsieh)), Brian Qiu ([`brianqiu`](https://github.com/brianqiu)), Jiang Zhu ([`pigriver123`](https://github.com/pigriver123))

_**Topic:**_ [The Neural Basis of Loss Aversion in Decision Making Under Risk] (https://openfmri.org/dataset/ds000005/)
[SOME SUMMARY OF PAPER]

## Instructions
[NEED TO ADD]
6 changes: 4 additions & 2 deletions code/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: test coverage

test:
nosetests code/utils -w ..
nosetests code/utils/tests -w ..

coverage:
nosetests code/utils -w .. --with-coverage --cover-package=utils
nosetests code/utils/tests -w .. --with-coverage --cover-package=utils/functions
2 changes: 1 addition & 1 deletion code/scripts/find_mask_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../utils')
sys.path.append('../utils/functions')
import smooth_gaussian
import os

Expand Down
2 changes: 1 addition & 1 deletion code/scripts/findoutlier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import json
import sys
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append the sys path
sys.path.append(pathtofunction)
from outlierfunction import outlier
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/graph_lindiag_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

# Path to function
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append path to sys
sys.path.append(pathtofunction)

Expand Down
2 changes: 1 addition & 1 deletion code/scripts/graphoutlier.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Paths
pathtodata = '../../data/'
pathtofig = '../../paper/figures/'
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append fuction path
sys.path.append(pathtofunction)
# Import function
Expand Down
4 changes: 2 additions & 2 deletions code/scripts/lme_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import sys

# Path to function
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append path to sys
sys.path.append(pathtofunction)

from behavtask_tr import events2neural_extend, merge_cond
from regression_functions import hrf, getRegressor, calcBeta, calcMRSS, deleteOutliers
from regression_functions import hrf, getRegressor, deleteOutliers
from lme_functions import calcBetaLme, calcSigProp, calcAnov, anovStat

n_vols=240
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

# Path to function
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append path to sys
sys.path.append(pathtofunction)

Expand Down
2 changes: 1 addition & 1 deletion code/scripts/make_smooth_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import matplotlib.pyplot as plt
import nibabel as nib
import sys
sys.path.append('../utils')
sys.path.append('../utils/functions')
import smooth_gaussian

#possibly put in os function to specify path later
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/regression_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

# Path to function
pathtofunction = '../utils'
pathtofunction = '../utils/functions'
# Append path to sys
sys.path.append(pathtofunction)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from scipy import stats
import pandas as pd
import numpy as np
from behavtask_tr import events2neural_extend, merge_cond
from regression_functions import hrf, getRegressor, calcBeta, calcMRSS, deleteOutliers

def calcBetaLme(data_full, gain_full, loss_full, linear_full, quad_full, run_group, thrshd=None):
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 0 additions & 37 deletions code/utils/stimuli.py

This file was deleted.

15 changes: 6 additions & 9 deletions code/utils/tests/test_graphoutlier_functions.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
"""
Test graph_function module the following functions:
loadtxt_dict
loadnib_dict
vol_mean
Run with::
nosetests test_graph_functions.py
make test from code or project directory
"""
# Loading modules.
from __future__ import absolute_import, division, print_function
import numpy as np
import os
import sys
import sys, os
from numpy.testing import assert_array_equal

# Set path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
sys.path.append(os.path.join(os.path.dirname(__file__), "../graphing/"))

# Load graph_functions:
from graphoutlier_functions import loadtxt_dict, vol_mean
import graphoutlier_functions as gf

# Test txt:
np.savetxt('temp.txt', range(30))
Expand All @@ -28,13 +25,13 @@
x2 = np.arange(64).reshape((2, 4, 2, 4))
def test_loadtxt_dict():
# Using loadtxt_dict
mydict = loadtxt_dict('temp.txt', 'mytxt')
mydict = gf.loadtxt_dict('temp.txt', 'mytxt')
# True dictionary
truedict = {'mytxt': np.arange(30.)}
assert_array_equal(list(mydict.values()), list(truedict.values()))
assert_array_equal(mydict.keys(), truedict.keys())

def test_vol_mean():
mymean = vol_mean(x2)
mymean = gf.vol_mean(x2)
truemean = np.array([30., 31 ,32 ,33])
assert_array_equal(mymean, truemean)
4 changes: 2 additions & 2 deletions code/utils/tests/test_lme_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# Loading modules.
from __future__ import absolute_import, division, print_function
import numpy as np
import sys
import sys, os
from scipy import stats
from sklearn import linear_model
from numpy.testing import assert_almost_equal, assert_allclose


# Append function path
sys.path.append('..')
sys.path.append(os.path.join(os.path.dirname(__file__), "../functions/"))

# Path to the first subject, first run, this is used as the test data for
# getGainLoss:
Expand Down
2 changes: 1 addition & 1 deletion code/utils/tests/test_outlierfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sys

# Set path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../functions')))

# Load function

Expand Down
7 changes: 6 additions & 1 deletion code/utils/tests/test_pearson_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@

import numpy as np

from .. import pearson
import os, sys

# Add path
sys.path.append(os.path.join(os.path.dirname(__file__), "../functions/"))

import pearson

from numpy.testing import assert_almost_equal

Expand Down
6 changes: 5 additions & 1 deletion code/utils/tests/test_pearson_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

import numpy as np

from .. import pearson
import os, sys

sys.path.append(os.path.join(os.path.dirname(__file__), "../functions/"))

import pearson

from numpy.testing import assert_almost_equal

Expand Down
2 changes: 1 addition & 1 deletion code/utils/tests/test_regression_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


# Set path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../functions')))

# Path to the first subject, first run, this is used as the test data for
# getGainLoss:
Expand Down
2 changes: 1 addition & 1 deletion code/utils/tests/test_smoothing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from numpy.testing import assert_allclose

# Append function path
sys.path.append('..')
sys.path.append('../functions')

# Path to the first subject, first run, this is used as the test data for
# getGainLoss:
Expand Down
7 changes: 6 additions & 1 deletion data/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.PHONY: data validate unzip test

data:
wget http://openfmri.s3.amazonaws.com/tarballs/ds005_raw.tgz
wget http://nipy.bic.berkeley.edu/rcsds/ds005_mnifunc.tar
wget http://nipy.bic.berkeley.edu/rcsds/mni_icbm152_nlin_asym_09c_2mm.tar.gz

validate:
python data.py

Expand All @@ -15,3 +17,6 @@ unzip:
rm mni_icbm152_nlin_asym_09c_2mm.tar.gz
mv mni_icbm152_nlin_asym_09c_2mm templates
mv templates/mni_icbm152_t1_tal_nlin_asym_09c_2mm.nii templates/mni_standard.nii

test:
nosetests data/tests -w ..
7 changes: 4 additions & 3 deletions data/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
The ds005 dataset, filtered ds005 dataset, and mni templates are stored here. Th
e makefile is written such that:

- 'make data' will pull in the appropriate data
- 'make unzip' will unzip, remove, and rename certain files
- 'make validate' will run data.py to check the hashes of each downloaded file w
- `make data` will pull in the appropriate data
- `make unzip` will unzip, remove, and rename certain files
- `make validate` will run data.py to check the hashes of each downloaded file w
ith a master hashlist included, ensuring all downloaded data is correct
- `make test` will run nosetest on the checking hashes function in data.py

THE COMMANDS SHOULD BE DONE IN THIS ORDER to be successfully validated. The ds00
5 folder contains subfolders for each subject, the most relevant of which are:
Expand Down
Empty file removed old_paper/.gitignore
Empty file.
11 changes: 0 additions & 11 deletions old_paper/Makefile

This file was deleted.

Binary file removed old_paper/figures/dvars_sub1run1.png
Binary file not shown.
Binary file removed old_paper/figures/dvars_sub9run1.png
Binary file not shown.
Binary file removed old_paper/figures/fd_sub1run1.png
Binary file not shown.
Binary file removed old_paper/figures/fd_sub9run1.png
Binary file not shown.
Binary file removed old_paper/figures/mean_sub1run1.png
Binary file not shown.
Binary file removed old_paper/figures/mean_sub9run1.png
Binary file not shown.
Binary file removed old_paper/figures/qqplot.png
Binary file not shown.
Binary file removed old_paper/figures/res_fitted_log.png
Binary file not shown.
Binary file removed old_paper/figures/res_fittedval.png
Binary file not shown.
9 changes: 0 additions & 9 deletions old_paper/project.bib

This file was deleted.

Binary file removed old_paper/report.pdf
Binary file not shown.
47 changes: 0 additions & 47 deletions old_paper/report.tex

This file was deleted.

Loading

0 comments on commit 9adb32c

Please sign in to comment.