{"action":"created","comment":{"url":"https://api.github.com/repos/UT-CHG/BET/pulls/comments/32489775","id":32489775,"diff_hunk":"@@ -312,16 +340,23 @@ def calculate_gradients_cfd(samples, data, xeval, r):\n     num_qois = data.shape[1]\n     gradient_tensor = np.zeros([num_xeval, num_qois, Lambda_dim])\n \n+    # Compute the gradient vectors using the standard CFD stencil\n     gradient_vec = (\n         data[:Lambda_dim * num_xeval] - data[Lambda_dim * num_xeval:]) / (2 * r)\n \n+    # Reshape and organize\n     gradient_tensor = np.ravel(gradient_vec.transpose()).reshape(\n         num_qois, Lambda_dim, num_xeval).transpose(2, 0, 1)\n \n     # Normalize each gradient vector\n     norm_gradient_tensor = np.linalg.norm(gradient_tensor, axis=2)\n+\n+    # If it is a zero vector (has 0 norm), set norm=1, avoid divide by zero\n+    indz = np.array(np.where(norm_gradient_tensor==0))","path":"bet/sensitivity/gradients.py","position":210,"original_position":210,"commit_id":"1c2d7085cdd3ca5d11a12ca68cc945105f2d02b8","original_commit_id":"1c2d7085cdd3ca5d11a12ca68cc945105f2d02b8","user":{"login":"lcgraham","id":3008749,"avatar_url":"https://avatars.githubusercontent.com/u/3008749?v=3","gravatar_id":"","url":"https://api.github.com/users/lcgraham","html_url":"https://github.com/lcgraham","followers_url":"https://api.github.com/users/lcgraham/followers","following_url":"https://api.github.com/users/lcgraham/following{/other_user}","gists_url":"https://api.github.com/users/lcgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/lcgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcgraham/subscriptions","organizations_url":"https://api.github.com/users/lcgraham/orgs","repos_url":"https://api.github.com/users/lcgraham/repos","events_url":"https://api.github.com/users/lcgraham/events{/privacy}","received_events_url":"https://api.github.com/users/lcgraham/received_events","type":"User","site_admin":false},"body":"Same comment about using where. You can just use logical indexing instead.","created_at":"2015-06-16T04:06:45Z","updated_at":"2015-06-16T04:06:45Z","html_url":"https://github.com/UT-CHG/BET/pull/99#discussion_r32489775","pull_request_url":"https://api.github.com/repos/UT-CHG/BET/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/comments/32489775"},"html":{"href":"https://github.com/UT-CHG/BET/pull/99#discussion_r32489775"},"pull_request":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/UT-CHG/BET/pulls/99","id":37748592,"html_url":"https://github.com/UT-CHG/BET/pull/99","diff_url":"https://github.com/UT-CHG/BET/pull/99.diff","patch_url":"https://github.com/UT-CHG/BET/pull/99.patch","issue_url":"https://api.github.com/repos/UT-CHG/BET/issues/99","number":99,"state":"open","locked":false,"title":"tests_sensitivity complete?","user":{"login":"scottw13","id":5449434,"avatar_url":"https://avatars.githubusercontent.com/u/5449434?v=3","gravatar_id":"","url":"https://api.github.com/users/scottw13","html_url":"https://github.com/scottw13","followers_url":"https://api.github.com/users/scottw13/followers","following_url":"https://api.github.com/users/scottw13/following{/other_user}","gists_url":"https://api.github.com/users/scottw13/gists{/gist_id}","starred_url":"https://api.github.com/users/scottw13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottw13/subscriptions","organizations_url":"https://api.github.com/users/scottw13/orgs","repos_url":"https://api.github.com/users/scottw13/repos","events_url":"https://api.github.com/users/scottw13/events{/privacy}","received_events_url":"https://api.github.com/users/scottw13/received_events","type":"User","site_admin":false},"body":"Fixed issues with divide by zero in calculate_gradients_* so that zero vectors are returned when appropriate.  Fixed divide by zero issue in singular values of chooseOptQoIs.  Added tests that have the zero function to test for this new functionality.  Added data files for heatplate_4d examples.","created_at":"2015-06-16T00:12:14Z","updated_at":"2015-06-16T04:06:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a915d6cc06d00af0fb50c3540e0e877172aecd8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UT-CHG/BET/pulls/99/commits","review_comments_url":"https://api.github.com/repos/UT-CHG/BET/pulls/99/comments","review_comment_url":"https://api.github.com/repos/UT-CHG/BET/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UT-CHG/BET/issues/99/comments","statuses_url":"https://api.github.com/repos/UT-CHG/BET/statuses/1c2d7085cdd3ca5d11a12ca68cc945105f2d02b8","head":{"label":"scottw13:dev-sensitivity","ref":"dev-sensitivity","sha":"1c2d7085cdd3ca5d11a12ca68cc945105f2d02b8","user":{"login":"scottw13","id":5449434,"avatar_url":"https://avatars.githubusercontent.com/u/5449434?v=3","gravatar_id":"","url":"https://api.github.com/users/scottw13","html_url":"https://github.com/scottw13","followers_url":"https://api.github.com/users/scottw13/followers","following_url":"https://api.github.com/users/scottw13/following{/other_user}","gists_url":"https://api.github.com/users/scottw13/gists{/gist_id}","starred_url":"https://api.github.com/users/scottw13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottw13/subscriptions","organizations_url":"https://api.github.com/users/scottw13/orgs","repos_url":"https://api.github.com/users/scottw13/repos","events_url":"https://api.github.com/users/scottw13/events{/privacy}","received_events_url":"https://api.github.com/users/scottw13/received_events","type":"User","site_admin":false},"repo":{"id":34358532,"name":"BET-1","full_name":"scottw13/BET-1","owner":{"login":"scottw13","id":5449434,"avatar_url":"https://avatars.githubusercontent.com/u/5449434?v=3","gravatar_id":"","url":"https://api.github.com/users/scottw13","html_url":"https://github.com/scottw13","followers_url":"https://api.github.com/users/scottw13/followers","following_url":"https://api.github.com/users/scottw13/following{/other_user}","gists_url":"https://api.github.com/users/scottw13/gists{/gist_id}","starred_url":"https://api.github.com/users/scottw13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottw13/subscriptions","organizations_url":"https://api.github.com/users/scottw13/orgs","repos_url":"https://api.github.com/users/scottw13/repos","events_url":"https://api.github.com/users/scottw13/events{/privacy}","received_events_url":"https://api.github.com/users/scottw13/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scottw13/BET-1","description":"Butler, Estep, Tavener Method - A python based package for measure-theoretic stochastic inverse and forward problems.","fork":true,"url":"https://api.github.com/repos/scottw13/BET-1","forks_url":"https://api.github.com/repos/scottw13/BET-1/forks","keys_url":"https://api.github.com/repos/scottw13/BET-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scottw13/BET-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scottw13/BET-1/teams","hooks_url":"https://api.github.com/repos/scottw13/BET-1/hooks","issue_events_url":"https://api.github.com/repos/scottw13/BET-1/issues/events{/number}","events_url":"https://api.github.com/repos/scottw13/BET-1/events","assignees_url":"https://api.github.com/repos/scottw13/BET-1/assignees{/user}","branches_url":"https://api.github.com/repos/scottw13/BET-1/branches{/branch}","tags_url":"https://api.github.com/repos/scottw13/BET-1/tags","blobs_url":"https://api.github.com/repos/scottw13/BET-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scottw13/BET-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scottw13/BET-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/scottw13/BET-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scottw13/BET-1/statuses/{sha}","languages_url":"https://api.github.com/repos/scottw13/BET-1/languages","stargazers_url":"https://api.github.com/repos/scottw13/BET-1/stargazers","contributors_url":"https://api.github.com/repos/scottw13/BET-1/contributors","subscribers_url":"https://api.github.com/repos/scottw13/BET-1/subscribers","subscription_url":"https://api.github.com/repos/scottw13/BET-1/subscription","commits_url":"https://api.github.com/repos/scottw13/BET-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/scottw13/BET-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/scottw13/BET-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/scottw13/BET-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/scottw13/BET-1/contents/{+path}","compare_url":"https://api.github.com/repos/scottw13/BET-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scottw13/BET-1/merges","archive_url":"https://api.github.com/repos/scottw13/BET-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scottw13/BET-1/downloads","issues_url":"https://api.github.com/repos/scottw13/BET-1/issues{/number}","pulls_url":"https://api.github.com/repos/scottw13/BET-1/pulls{/number}","milestones_url":"https://api.github.com/repos/scottw13/BET-1/milestones{/number}","notifications_url":"https://api.github.com/repos/scottw13/BET-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scottw13/BET-1/labels{/name}","releases_url":"https://api.github.com/repos/scottw13/BET-1/releases{/id}","created_at":"2015-04-21T23:59:41Z","updated_at":"2015-06-03T19:26:36Z","pushed_at":"2015-06-16T00:06:25Z","git_url":"git://github.com/scottw13/BET-1.git","ssh_url":"git@github.com:scottw13/BET-1.git","clone_url":"https://github.com/scottw13/BET-1.git","svn_url":"https://github.com/scottw13/BET-1","homepage":"http://ut-chg.github.io/BET","size":7086,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"UT-CHG:dev-sensitivity","ref":"dev-sensitivity","sha":"7f1e563dabfddfeffd8fbadae22a04266d9fe1bc","user":{"login":"UT-CHG","id":8753973,"avatar_url":"https://avatars.githubusercontent.com/u/8753973?v=3","gravatar_id":"","url":"https://api.github.com/users/UT-CHG","html_url":"https://github.com/UT-CHG","followers_url":"https://api.github.com/users/UT-CHG/followers","following_url":"https://api.github.com/users/UT-CHG/following{/other_user}","gists_url":"https://api.github.com/users/UT-CHG/gists{/gist_id}","starred_url":"https://api.github.com/users/UT-CHG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UT-CHG/subscriptions","organizations_url":"https://api.github.com/users/UT-CHG/orgs","repos_url":"https://api.github.com/users/UT-CHG/repos","events_url":"https://api.github.com/users/UT-CHG/events{/privacy}","received_events_url":"https://api.github.com/users/UT-CHG/received_events","type":"Organization","site_admin":false},"repo":{"id":18813599,"name":"BET","full_name":"UT-CHG/BET","owner":{"login":"UT-CHG","id":8753973,"avatar_url":"https://avatars.githubusercontent.com/u/8753973?v=3","gravatar_id":"","url":"https://api.github.com/users/UT-CHG","html_url":"https://github.com/UT-CHG","followers_url":"https://api.github.com/users/UT-CHG/followers","following_url":"https://api.github.com/users/UT-CHG/following{/other_user}","gists_url":"https://api.github.com/users/UT-CHG/gists{/gist_id}","starred_url":"https://api.github.com/users/UT-CHG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UT-CHG/subscriptions","organizations_url":"https://api.github.com/users/UT-CHG/orgs","repos_url":"https://api.github.com/users/UT-CHG/repos","events_url":"https://api.github.com/users/UT-CHG/events{/privacy}","received_events_url":"https://api.github.com/users/UT-CHG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UT-CHG/BET","description":"Butler, Estep, Tavener Method - A python based package for measure-theoretic stochastic inverse and forward problems.","fork":false,"url":"https://api.github.com/repos/UT-CHG/BET","forks_url":"https://api.github.com/repos/UT-CHG/BET/forks","keys_url":"https://api.github.com/repos/UT-CHG/BET/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UT-CHG/BET/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UT-CHG/BET/teams","hooks_url":"https://api.github.com/repos/UT-CHG/BET/hooks","issue_events_url":"https://api.github.com/repos/UT-CHG/BET/issues/events{/number}","events_url":"https://api.github.com/repos/UT-CHG/BET/events","assignees_url":"https://api.github.com/repos/UT-CHG/BET/assignees{/user}","branches_url":"https://api.github.com/repos/UT-CHG/BET/branches{/branch}","tags_url":"https://api.github.com/repos/UT-CHG/BET/tags","blobs_url":"https://api.github.com/repos/UT-CHG/BET/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UT-CHG/BET/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UT-CHG/BET/git/refs{/sha}","trees_url":"https://api.github.com/repos/UT-CHG/BET/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UT-CHG/BET/statuses/{sha}","languages_url":"https://api.github.com/repos/UT-CHG/BET/languages","stargazers_url":"https://api.github.com/repos/UT-CHG/BET/stargazers","contributors_url":"https://api.github.com/repos/UT-CHG/BET/contributors","subscribers_url":"https://api.github.com/repos/UT-CHG/BET/subscribers","subscription_url":"https://api.github.com/repos/UT-CHG/BET/subscription","commits_url":"https://api.github.com/repos/UT-CHG/BET/commits{/sha}","git_commits_url":"https://api.github.com/repos/UT-CHG/BET/git/commits{/sha}","comments_url":"https://api.github.com/repos/UT-CHG/BET/comments{/number}","issue_comment_url":"https://api.github.com/repos/UT-CHG/BET/issues/comments{/number}","contents_url":"https://api.github.com/repos/UT-CHG/BET/contents/{+path}","compare_url":"https://api.github.com/repos/UT-CHG/BET/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UT-CHG/BET/merges","archive_url":"https://api.github.com/repos/UT-CHG/BET/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UT-CHG/BET/downloads","issues_url":"https://api.github.com/repos/UT-CHG/BET/issues{/number}","pulls_url":"https://api.github.com/repos/UT-CHG/BET/pulls{/number}","milestones_url":"https://api.github.com/repos/UT-CHG/BET/milestones{/number}","notifications_url":"https://api.github.com/repos/UT-CHG/BET/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UT-CHG/BET/labels{/name}","releases_url":"https://api.github.com/repos/UT-CHG/BET/releases{/id}","created_at":"2014-04-15T19:51:31Z","updated_at":"2015-05-15T17:46:41Z","pushed_at":"2015-06-16T00:12:14Z","git_url":"git://github.com/UT-CHG/BET.git","ssh_url":"git@github.com:UT-CHG/BET.git","clone_url":"https://github.com/UT-CHG/BET.git","svn_url":"https://github.com/UT-CHG/BET","homepage":"http://ut-chg.github.io/BET","size":8300,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/99"},"html":{"href":"https://github.com/UT-CHG/BET/pull/99"},"issue":{"href":"https://api.github.com/repos/UT-CHG/BET/issues/99"},"comments":{"href":"https://api.github.com/repos/UT-CHG/BET/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UT-CHG/BET/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/UT-CHG/BET/statuses/1c2d7085cdd3ca5d11a12ca68cc945105f2d02b8"}}}}