{"action":"created","comment":{"url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/comments/47462644","id":47462644,"diff_hunk":"@@ -0,0 +1,176 @@\n+\"\"\"\r\n+This scipt mainly does two things.One thing is to plot significant p values of behavial loss aversion\r\n+against neural loss aversion of all the voxels.The second thing is to plot the actual linear regression\r\n+of begavial loss aversion against neural loss aversion of a single voxel\r\n+\"\"\"\r\n+\r\n+\r\n+from scipy import stats\r\n+import sys\r\n+import numpy as np\r\n+import matplotlib.pyplot as plt\r\n+from sklearn import cluster\r\n+import nibabel as nib\r\n+sys.path.append('../utils/functions')\r\n+from sig_region import stat_region\r\n+sys.path.append('../utils/graphing')\r\n+from neural_behavior.py import plot_neur_beh\r\n+\r\n+\r\n+pgain = np.loadtxt(\"../../results/texts/pgain.txt\")\r\n+slopegain = np.loadtxt(\"../../results/texts/slopegain.txt\")\r\n+ploss = np.loadtxt(\"../../results/texts/ploss.txt\")\r\n+slopeloss = np.loadtxt(\"../../results/texts/slopeloss.txt\")\r\n+\r\n+\"\"\"\r\n+The following part of script will plot the significant gain p values of the linear regression\r\n+between behavial loss aversion and neural loss averision on standard brain.The slices is by z\r\n+axis.And we use 31-60 slices.\r\n+\"\"\"\r\n+p = pgain\r\n+slope = slopegain\r\n+siglevel = 0.001\r\n+sig_inx = p <= siglevel\r\n+mask = p != 1\r\n+base = nib.load('../../data/templates/mni_standard.nii')\r\n+base = base.get_data()\r\n+p_plot = np.zeros(slope.shape)\r\n+p_plot[p > siglevel] = np.nan\r\n+p_plot[p <= siglevel] = slope[p <= siglevel]\r\n+p_plot = p_plot.reshape(91, 109, 91)\r\n+plot_number=1\r\n+fig = plt.figure(figsize = (60, 80))\r\n+\r\n+for subject in range(31, 61):\r\n+    axis = fig.add_subplot(6, 5, plot_number)\r\n+    plt.imshow(base[:, :, subject], cmap = plt.get_cmap('gray'), alpha = 0.3)\r\n+    img = axis.imshow(p_plot[:, :, subject], cmap=plt.get_cmap('rainbow'), alpha = 1, \r\n+                      interpolation = 'nearest', vmin = -0.03, vmax = 0.03)\r\n+    plt.colorbar(img, ax=axis, fraction=0.023, pad=0.02)\r\n+    \r\n+    axis.get_xaxis().set_visible(False)\r\n+    axis.get_yaxis().set_visible(False)\r\n+    axis.set_title('Z axis Slice ' + str(subject), fontsize = 26)\r\n+    plot_number += 1\r\n+\r\n+fig.savefig(\"sig_cor_z_gain.png\")\r","path":"code/scripts/neural_behavial_plot.py","position":56,"original_position":56,"commit_id":"461e36d7a9f08ca9983a2ecfc7cf5f083ed879ba","original_commit_id":"461e36d7a9f08ca9983a2ecfc7cf5f083ed879ba","user":{"login":"BenjaminHsieh","id":10675933,"avatar_url":"https://avatars.githubusercontent.com/u/10675933?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjaminHsieh","html_url":"https://github.com/BenjaminHsieh","followers_url":"https://api.github.com/users/BenjaminHsieh/followers","following_url":"https://api.github.com/users/BenjaminHsieh/following{/other_user}","gists_url":"https://api.github.com/users/BenjaminHsieh/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjaminHsieh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjaminHsieh/subscriptions","organizations_url":"https://api.github.com/users/BenjaminHsieh/orgs","repos_url":"https://api.github.com/users/BenjaminHsieh/repos","events_url":"https://api.github.com/users/BenjaminHsieh/events{/privacy}","received_events_url":"https://api.github.com/users/BenjaminHsieh/received_events","type":"User","site_admin":false},"body":"Need to update the save fig location to results/figures","created_at":"2015-12-14T05:31:41Z","updated_at":"2015-12-14T05:31:41Z","html_url":"https://github.com/berkeley-stat159/project-theta/pull/134#discussion_r47462644","pull_request_url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/comments/47462644"},"html":{"href":"https://github.com/berkeley-stat159/project-theta/pull/134#discussion_r47462644"},"pull_request":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134","id":53525302,"html_url":"https://github.com/berkeley-stat159/project-theta/pull/134","diff_url":"https://github.com/berkeley-stat159/project-theta/pull/134.diff","patch_url":"https://github.com/berkeley-stat159/project-theta/pull/134.patch","issue_url":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/134","number":134,"state":"open","locked":false,"title":"add the funtion plot_neural_behacior which is used to plot the linear…","user":{"login":"pigriver123","id":13890447,"avatar_url":"https://avatars.githubusercontent.com/u/13890447?v=3","gravatar_id":"","url":"https://api.github.com/users/pigriver123","html_url":"https://github.com/pigriver123","followers_url":"https://api.github.com/users/pigriver123/followers","following_url":"https://api.github.com/users/pigriver123/following{/other_user}","gists_url":"https://api.github.com/users/pigriver123/gists{/gist_id}","starred_url":"https://api.github.com/users/pigriver123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pigriver123/subscriptions","organizations_url":"https://api.github.com/users/pigriver123/orgs","repos_url":"https://api.github.com/users/pigriver123/repos","events_url":"https://api.github.com/users/pigriver123/events{/privacy}","received_events_url":"https://api.github.com/users/pigriver123/received_events","type":"User","site_admin":false},"body":"… regression plot of behavior loss aversion against neural loss aversion of a single voxel","created_at":"2015-12-14T05:11:07Z","updated_at":"2015-12-14T05:31:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a218fd4ff6d0f0186adace4d9030c7b37fbcc97","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134/commits","review_comments_url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134/comments","review_comment_url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/134/comments","statuses_url":"https://api.github.com/repos/berkeley-stat159/project-theta/statuses/461e36d7a9f08ca9983a2ecfc7cf5f083ed879ba","head":{"label":"pigriver123:dev","ref":"dev","sha":"461e36d7a9f08ca9983a2ecfc7cf5f083ed879ba","user":{"login":"pigriver123","id":13890447,"avatar_url":"https://avatars.githubusercontent.com/u/13890447?v=3","gravatar_id":"","url":"https://api.github.com/users/pigriver123","html_url":"https://github.com/pigriver123","followers_url":"https://api.github.com/users/pigriver123/followers","following_url":"https://api.github.com/users/pigriver123/following{/other_user}","gists_url":"https://api.github.com/users/pigriver123/gists{/gist_id}","starred_url":"https://api.github.com/users/pigriver123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pigriver123/subscriptions","organizations_url":"https://api.github.com/users/pigriver123/orgs","repos_url":"https://api.github.com/users/pigriver123/repos","events_url":"https://api.github.com/users/pigriver123/events{/privacy}","received_events_url":"https://api.github.com/users/pigriver123/received_events","type":"User","site_admin":false},"repo":{"id":47159910,"name":"project-theta","full_name":"pigriver123/project-theta","owner":{"login":"pigriver123","id":13890447,"avatar_url":"https://avatars.githubusercontent.com/u/13890447?v=3","gravatar_id":"","url":"https://api.github.com/users/pigriver123","html_url":"https://github.com/pigriver123","followers_url":"https://api.github.com/users/pigriver123/followers","following_url":"https://api.github.com/users/pigriver123/following{/other_user}","gists_url":"https://api.github.com/users/pigriver123/gists{/gist_id}","starred_url":"https://api.github.com/users/pigriver123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pigriver123/subscriptions","organizations_url":"https://api.github.com/users/pigriver123/orgs","repos_url":"https://api.github.com/users/pigriver123/repos","events_url":"https://api.github.com/users/pigriver123/events{/privacy}","received_events_url":"https://api.github.com/users/pigriver123/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pigriver123/project-theta","description":"","fork":true,"url":"https://api.github.com/repos/pigriver123/project-theta","forks_url":"https://api.github.com/repos/pigriver123/project-theta/forks","keys_url":"https://api.github.com/repos/pigriver123/project-theta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pigriver123/project-theta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pigriver123/project-theta/teams","hooks_url":"https://api.github.com/repos/pigriver123/project-theta/hooks","issue_events_url":"https://api.github.com/repos/pigriver123/project-theta/issues/events{/number}","events_url":"https://api.github.com/repos/pigriver123/project-theta/events","assignees_url":"https://api.github.com/repos/pigriver123/project-theta/assignees{/user}","branches_url":"https://api.github.com/repos/pigriver123/project-theta/branches{/branch}","tags_url":"https://api.github.com/repos/pigriver123/project-theta/tags","blobs_url":"https://api.github.com/repos/pigriver123/project-theta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pigriver123/project-theta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pigriver123/project-theta/git/refs{/sha}","trees_url":"https://api.github.com/repos/pigriver123/project-theta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pigriver123/project-theta/statuses/{sha}","languages_url":"https://api.github.com/repos/pigriver123/project-theta/languages","stargazers_url":"https://api.github.com/repos/pigriver123/project-theta/stargazers","contributors_url":"https://api.github.com/repos/pigriver123/project-theta/contributors","subscribers_url":"https://api.github.com/repos/pigriver123/project-theta/subscribers","subscription_url":"https://api.github.com/repos/pigriver123/project-theta/subscription","commits_url":"https://api.github.com/repos/pigriver123/project-theta/commits{/sha}","git_commits_url":"https://api.github.com/repos/pigriver123/project-theta/git/commits{/sha}","comments_url":"https://api.github.com/repos/pigriver123/project-theta/comments{/number}","issue_comment_url":"https://api.github.com/repos/pigriver123/project-theta/issues/comments{/number}","contents_url":"https://api.github.com/repos/pigriver123/project-theta/contents/{+path}","compare_url":"https://api.github.com/repos/pigriver123/project-theta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pigriver123/project-theta/merges","archive_url":"https://api.github.com/repos/pigriver123/project-theta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pigriver123/project-theta/downloads","issues_url":"https://api.github.com/repos/pigriver123/project-theta/issues{/number}","pulls_url":"https://api.github.com/repos/pigriver123/project-theta/pulls{/number}","milestones_url":"https://api.github.com/repos/pigriver123/project-theta/milestones{/number}","notifications_url":"https://api.github.com/repos/pigriver123/project-theta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pigriver123/project-theta/labels{/name}","releases_url":"https://api.github.com/repos/pigriver123/project-theta/releases{/id}","created_at":"2015-12-01T02:21:57Z","updated_at":"2015-12-01T18:59:58Z","pushed_at":"2015-12-14T05:27:50Z","git_url":"git://github.com/pigriver123/project-theta.git","ssh_url":"git@github.com:pigriver123/project-theta.git","clone_url":"https://github.com/pigriver123/project-theta.git","svn_url":"https://github.com/pigriver123/project-theta","homepage":null,"size":11480,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"berkeley-stat159:dev","ref":"dev","sha":"fe9520782619eea1cffd1c19fa81c9822a05bcf9","user":{"login":"berkeley-stat159","id":11684434,"avatar_url":"https://avatars.githubusercontent.com/u/11684434?v=3","gravatar_id":"","url":"https://api.github.com/users/berkeley-stat159","html_url":"https://github.com/berkeley-stat159","followers_url":"https://api.github.com/users/berkeley-stat159/followers","following_url":"https://api.github.com/users/berkeley-stat159/following{/other_user}","gists_url":"https://api.github.com/users/berkeley-stat159/gists{/gist_id}","starred_url":"https://api.github.com/users/berkeley-stat159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berkeley-stat159/subscriptions","organizations_url":"https://api.github.com/users/berkeley-stat159/orgs","repos_url":"https://api.github.com/users/berkeley-stat159/repos","events_url":"https://api.github.com/users/berkeley-stat159/events{/privacy}","received_events_url":"https://api.github.com/users/berkeley-stat159/received_events","type":"Organization","site_admin":false},"repo":{"id":43347785,"name":"project-theta","full_name":"berkeley-stat159/project-theta","owner":{"login":"berkeley-stat159","id":11684434,"avatar_url":"https://avatars.githubusercontent.com/u/11684434?v=3","gravatar_id":"","url":"https://api.github.com/users/berkeley-stat159","html_url":"https://github.com/berkeley-stat159","followers_url":"https://api.github.com/users/berkeley-stat159/followers","following_url":"https://api.github.com/users/berkeley-stat159/following{/other_user}","gists_url":"https://api.github.com/users/berkeley-stat159/gists{/gist_id}","starred_url":"https://api.github.com/users/berkeley-stat159/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/berkeley-stat159/subscriptions","organizations_url":"https://api.github.com/users/berkeley-stat159/orgs","repos_url":"https://api.github.com/users/berkeley-stat159/repos","events_url":"https://api.github.com/users/berkeley-stat159/events{/privacy}","received_events_url":"https://api.github.com/users/berkeley-stat159/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/berkeley-stat159/project-theta","description":"","fork":false,"url":"https://api.github.com/repos/berkeley-stat159/project-theta","forks_url":"https://api.github.com/repos/berkeley-stat159/project-theta/forks","keys_url":"https://api.github.com/repos/berkeley-stat159/project-theta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/berkeley-stat159/project-theta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/berkeley-stat159/project-theta/teams","hooks_url":"https://api.github.com/repos/berkeley-stat159/project-theta/hooks","issue_events_url":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/events{/number}","events_url":"https://api.github.com/repos/berkeley-stat159/project-theta/events","assignees_url":"https://api.github.com/repos/berkeley-stat159/project-theta/assignees{/user}","branches_url":"https://api.github.com/repos/berkeley-stat159/project-theta/branches{/branch}","tags_url":"https://api.github.com/repos/berkeley-stat159/project-theta/tags","blobs_url":"https://api.github.com/repos/berkeley-stat159/project-theta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/berkeley-stat159/project-theta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/berkeley-stat159/project-theta/git/refs{/sha}","trees_url":"https://api.github.com/repos/berkeley-stat159/project-theta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/berkeley-stat159/project-theta/statuses/{sha}","languages_url":"https://api.github.com/repos/berkeley-stat159/project-theta/languages","stargazers_url":"https://api.github.com/repos/berkeley-stat159/project-theta/stargazers","contributors_url":"https://api.github.com/repos/berkeley-stat159/project-theta/contributors","subscribers_url":"https://api.github.com/repos/berkeley-stat159/project-theta/subscribers","subscription_url":"https://api.github.com/repos/berkeley-stat159/project-theta/subscription","commits_url":"https://api.github.com/repos/berkeley-stat159/project-theta/commits{/sha}","git_commits_url":"https://api.github.com/repos/berkeley-stat159/project-theta/git/commits{/sha}","comments_url":"https://api.github.com/repos/berkeley-stat159/project-theta/comments{/number}","issue_comment_url":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/comments{/number}","contents_url":"https://api.github.com/repos/berkeley-stat159/project-theta/contents/{+path}","compare_url":"https://api.github.com/repos/berkeley-stat159/project-theta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/berkeley-stat159/project-theta/merges","archive_url":"https://api.github.com/repos/berkeley-stat159/project-theta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/berkeley-stat159/project-theta/downloads","issues_url":"https://api.github.com/repos/berkeley-stat159/project-theta/issues{/number}","pulls_url":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls{/number}","milestones_url":"https://api.github.com/repos/berkeley-stat159/project-theta/milestones{/number}","notifications_url":"https://api.github.com/repos/berkeley-stat159/project-theta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/berkeley-stat159/project-theta/labels{/name}","releases_url":"https://api.github.com/repos/berkeley-stat159/project-theta/releases{/id}","created_at":"2015-09-29T05:51:57Z","updated_at":"2015-12-01T05:25:37Z","pushed_at":"2015-12-14T05:27:50Z","git_url":"git://github.com/berkeley-stat159/project-theta.git","ssh_url":"git@github.com:berkeley-stat159/project-theta.git","clone_url":"https://github.com/berkeley-stat159/project-theta.git","svn_url":"https://github.com/berkeley-stat159/project-theta","homepage":null,"size":22038,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":7,"forks":5,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134"},"html":{"href":"https://github.com/berkeley-stat159/project-theta/pull/134"},"issue":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/134"},"comments":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/berkeley-stat159/project-theta/statuses/461e36d7a9f08ca9983a2ecfc7cf5f083ed879ba"}}}}