{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/92158685","pull_request_review_id":12667390,"id":92158685,"diff_hunk":"@@ -761,22 +773,51 @@ def median_absolute_deviation(a, axis=None):\n     # See https://github.com/numpy/numpy/issues/7330 why using np.ma.median\n     # for normal arrays should not be done (summary: np.ma.median always\n     # returns an masked array even if the result should be scalar). (#4658)\n-    if isinstance(a, np.ma.MaskedArray):\n+    if isinstance(data, np.ma.MaskedArray):\n         func = np.ma.median\n+        if ignore_nan:\n+            data = np.ma.masked_where(np.isnan(data), data)\n+        elif (NUMPY_LT_1_10 or not NUMPY_LT_1_12) and np.any(np.isnan(data)):\n+            # masked arrays containing NaNs should return NaN, but they only\n+            # do in 1.11 because of a bug:\n+            # https://github.com/astropy/astropy/pull/5232#issuecomment-264751887\n+            # TODO for devs: numpy 1.13 may fix this, in which case the\n+            # special-casing can be removed\n+            return np.nan\n+    elif ignore_nan:\n+        if NUMPY_LT_1_10 or axis is not None:\n+            # older versions don't have nanmedian, but nanmedian\n+            # may be faster than np.ma.median *if* axis is None\n+            # https://gist.github.com/MSeifert04/1551e80e1aa85b48c9191e727c38f9a9","path":"astropy/stats/funcs.py","position":57,"original_position":57,"commit_id":"1f758276774599e311a93d25cc7932b031c85177","original_commit_id":"1f758276774599e311a93d25cc7932b031c85177","user":{"login":"juliantaylor","id":542663,"avatar_url":"https://avatars.githubusercontent.com/u/542663?v=3","gravatar_id":"","url":"https://api.github.com/users/juliantaylor","html_url":"https://github.com/juliantaylor","followers_url":"https://api.github.com/users/juliantaylor/followers","following_url":"https://api.github.com/users/juliantaylor/following{/other_user}","gists_url":"https://api.github.com/users/juliantaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/juliantaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliantaylor/subscriptions","organizations_url":"https://api.github.com/users/juliantaylor/orgs","repos_url":"https://api.github.com/users/juliantaylor/repos","events_url":"https://api.github.com/users/juliantaylor/events{/privacy}","received_events_url":"https://api.github.com/users/juliantaylor/received_events","type":"User","site_admin":false},"body":"This decision should be left to nanmedian as it has more information on the implementation.\r\nAlso the benchmark is biased it computes the median of a already sorted array which is the ideal case for the sorting code in numpy (median of 3 introsort) so it becomes faster than the higher overhead introselect based nanmedian use for small axes.","created_at":"2016-12-13T12:29:39Z","updated_at":"2016-12-13T12:29:39Z","html_url":"https://github.com/astropy/astropy/pull/5232#discussion_r92158685","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/5232","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/92158685"},"html":{"href":"https://github.com/astropy/astropy/pull/5232#discussion_r92158685"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/5232"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/5232","id":80920417,"html_url":"https://github.com/astropy/astropy/pull/5232","diff_url":"https://github.com/astropy/astropy/pull/5232.diff","patch_url":"https://github.com/astropy/astropy/pull/5232.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/5232","number":5232,"state":"open","locked":false,"title":"add ignore_nan option to median_absolute_deviation","user":{"login":"keflavich","id":143715,"avatar_url":"https://avatars.githubusercontent.com/u/143715?v=3","gravatar_id":"","url":"https://api.github.com/users/keflavich","html_url":"https://github.com/keflavich","followers_url":"https://api.github.com/users/keflavich/followers","following_url":"https://api.github.com/users/keflavich/following{/other_user}","gists_url":"https://api.github.com/users/keflavich/gists{/gist_id}","starred_url":"https://api.github.com/users/keflavich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keflavich/subscriptions","organizations_url":"https://api.github.com/users/keflavich/orgs","repos_url":"https://api.github.com/users/keflavich/repos","events_url":"https://api.github.com/users/keflavich/events{/privacy}","received_events_url":"https://api.github.com/users/keflavich/received_events","type":"User","site_admin":false},"body":"Simple PR: use `np.nanmedian` instead of `np.median` if `ignore_nan` is set.  I would favor it defaulting to `True`, but to avoid breaking backward compatibility I set it to `False`.  Feedback on that option would be helpful.\n","created_at":"2016-08-11T08:33:02Z","updated_at":"2016-12-13T12:29:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00b65b3c623bb38488d56e788e257c4b9199750d","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/38","html_url":"https://github.com/astropy/astropy/milestone/38","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/38/labels","id":1761583,"number":38,"title":"v1.3.0","description":"","creator":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":172,"state":"open","created_at":"2016-05-12T04:39:02Z","updated_at":"2016-12-13T07:02:34Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/5232/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/5232/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/5232/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/1f758276774599e311a93d25cc7932b031c85177","head":{"label":"keflavich:madstdnan","ref":"madstdnan","sha":"1f758276774599e311a93d25cc7932b031c85177","user":{"login":"keflavich","id":143715,"avatar_url":"https://avatars.githubusercontent.com/u/143715?v=3","gravatar_id":"","url":"https://api.github.com/users/keflavich","html_url":"https://github.com/keflavich","followers_url":"https://api.github.com/users/keflavich/followers","following_url":"https://api.github.com/users/keflavich/following{/other_user}","gists_url":"https://api.github.com/users/keflavich/gists{/gist_id}","starred_url":"https://api.github.com/users/keflavich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keflavich/subscriptions","organizations_url":"https://api.github.com/users/keflavich/orgs","repos_url":"https://api.github.com/users/keflavich/repos","events_url":"https://api.github.com/users/keflavich/events{/privacy}","received_events_url":"https://api.github.com/users/keflavich/received_events","type":"User","site_admin":false},"repo":{"id":2578720,"name":"astropy","full_name":"keflavich/astropy","owner":{"login":"keflavich","id":143715,"avatar_url":"https://avatars.githubusercontent.com/u/143715?v=3","gravatar_id":"","url":"https://api.github.com/users/keflavich","html_url":"https://github.com/keflavich","followers_url":"https://api.github.com/users/keflavich/followers","following_url":"https://api.github.com/users/keflavich/following{/other_user}","gists_url":"https://api.github.com/users/keflavich/gists{/gist_id}","starred_url":"https://api.github.com/users/keflavich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keflavich/subscriptions","organizations_url":"https://api.github.com/users/keflavich/orgs","repos_url":"https://api.github.com/users/keflavich/repos","events_url":"https://api.github.com/users/keflavich/events{/privacy}","received_events_url":"https://api.github.com/users/keflavich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keflavich/astropy","description":"Main AstroPy repository","fork":true,"url":"https://api.github.com/repos/keflavich/astropy","forks_url":"https://api.github.com/repos/keflavich/astropy/forks","keys_url":"https://api.github.com/repos/keflavich/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keflavich/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keflavich/astropy/teams","hooks_url":"https://api.github.com/repos/keflavich/astropy/hooks","issue_events_url":"https://api.github.com/repos/keflavich/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/keflavich/astropy/events","assignees_url":"https://api.github.com/repos/keflavich/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/keflavich/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/keflavich/astropy/tags","blobs_url":"https://api.github.com/repos/keflavich/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keflavich/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keflavich/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/keflavich/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keflavich/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/keflavich/astropy/languages","stargazers_url":"https://api.github.com/repos/keflavich/astropy/stargazers","contributors_url":"https://api.github.com/repos/keflavich/astropy/contributors","subscribers_url":"https://api.github.com/repos/keflavich/astropy/subscribers","subscription_url":"https://api.github.com/repos/keflavich/astropy/subscription","commits_url":"https://api.github.com/repos/keflavich/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/keflavich/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/keflavich/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/keflavich/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/keflavich/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/keflavich/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keflavich/astropy/merges","archive_url":"https://api.github.com/repos/keflavich/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keflavich/astropy/downloads","issues_url":"https://api.github.com/repos/keflavich/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/keflavich/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/keflavich/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/keflavich/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keflavich/astropy/labels{/name}","releases_url":"https://api.github.com/repos/keflavich/astropy/releases{/id}","deployments_url":"https://api.github.com/repos/keflavich/astropy/deployments","created_at":"2011-10-14T20:42:04Z","updated_at":"2016-03-14T10:51:47Z","pushed_at":"2016-12-05T03:53:46Z","git_url":"git://github.com/keflavich/astropy.git","ssh_url":"git@github.com:keflavich/astropy.git","clone_url":"https://github.com/keflavich/astropy.git","svn_url":"https://github.com/keflavich/astropy","homepage":"astropy.org","size":45950,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"astropy:master","ref":"master","sha":"59d32b63e680e82d65ba54475dc4d63594dce9e5","user":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"repo":{"id":2081289,"name":"astropy","full_name":"astropy/astropy","owner":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astropy/astropy","description":"Repository for the Astropy core package","fork":false,"url":"https://api.github.com/repos/astropy/astropy","forks_url":"https://api.github.com/repos/astropy/astropy/forks","keys_url":"https://api.github.com/repos/astropy/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astropy/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astropy/astropy/teams","hooks_url":"https://api.github.com/repos/astropy/astropy/hooks","issue_events_url":"https://api.github.com/repos/astropy/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/astropy/astropy/events","assignees_url":"https://api.github.com/repos/astropy/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/astropy/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/astropy/astropy/tags","blobs_url":"https://api.github.com/repos/astropy/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astropy/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astropy/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/astropy/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/astropy/astropy/languages","stargazers_url":"https://api.github.com/repos/astropy/astropy/stargazers","contributors_url":"https://api.github.com/repos/astropy/astropy/contributors","subscribers_url":"https://api.github.com/repos/astropy/astropy/subscribers","subscription_url":"https://api.github.com/repos/astropy/astropy/subscription","commits_url":"https://api.github.com/repos/astropy/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/astropy/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/astropy/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/astropy/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/astropy/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/astropy/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astropy/astropy/merges","archive_url":"https://api.github.com/repos/astropy/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astropy/astropy/downloads","issues_url":"https://api.github.com/repos/astropy/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/astropy/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/astropy/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/astropy/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astropy/astropy/labels{/name}","releases_url":"https://api.github.com/repos/astropy/astropy/releases{/id}","deployments_url":"https://api.github.com/repos/astropy/astropy/deployments","created_at":"2011-07-21T01:33:49Z","updated_at":"2016-12-13T09:36:28Z","pushed_at":"2016-12-13T07:52:56Z","git_url":"git://github.com/astropy/astropy.git","ssh_url":"git@github.com:astropy/astropy.git","clone_url":"https://github.com/astropy/astropy.git","svn_url":"https://github.com/astropy/astropy","homepage":"www.astropy.org","size":70901,"stargazers_count":1077,"watchers_count":1077,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":620,"mirror_url":null,"open_issues_count":765,"forks":620,"open_issues":765,"watchers":1077,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/5232"},"html":{"href":"https://github.com/astropy/astropy/pull/5232"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/5232"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/5232/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/5232/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/5232/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/1f758276774599e311a93d25cc7932b031c85177"}}}}
{"actor":{"display_login":"juliantaylor"}}