{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/50463320","id":50463320,"diff_hunk":"@@ -8,14 +8,138 @@\n \n import numpy as np\n \n-from ... units import dimensionless_unscaled, UnitsError\n-from ... import log\n-from ...extern.six import string_types\n-from ..nduncertainty import IncompatibleUncertaintiesException\n+from ..nduncertainty import NDUncertainty\n+from ...units import dimensionless_unscaled\n+from ...extern import six\n \n __all__ = ['NDArithmeticMixin']\n \n \n+# TODO: General question of implementing an Operator class #3861? (embray)\n+# Maybe a bit too big for these changes.\n+\n+try:\n+    from .utils import format_doc\n+except ImportError:\n+    # TODO: Delete this and rebase if #4242 is merged.\n+    def format_doc(docstring, *args, **kwargs):\n+        def set_docstring(func):\n+            if not isinstance(docstring, six.string_types):\n+                doc = docstring.__doc__\n+            elif docstring != 'self':\n+                doc = docstring\n+            else:\n+                doc = func.__doc__\n+                func.__doc__ = None\n+            if not doc:\n+                raise ValueError\n+            kwargs['original_doc'] = func.__doc__ or ''\n+            func.__doc__ = doc.format(*args, **kwargs)\n+            return func\n+        return set_docstring\n+\n+# TODO: Maybe not nice to pollute globals but I felt the same way about\n+# polluting the class namespace and this way potential subclasses may or refuse\n+# to pull this docstring into their class as well.\n+\n+# Docstring templates for add, subtract, multiply, divide methods.\n+_arit_doc = \"\"\"\n+    Performs {name} by evaluating ``self`` {op} ``operand``.\n+\n+    For the inverse operation or operations between different subclasses take a\n+    look at\n+    :meth:`~astropy.nddata.NDArithmeticMixin.ic_{name}` .\n+\n+    Parameters\n+    ----------\n+    operand : `NDData`-like instance or convertable to one.\n+        The second operand in the operation.\n+\n+    propagate_uncertainties : `bool` or ``None``, optional\n+        If ``None`` the result will have no uncertainty. If ``False`` the\n+        result will have a copied version of the first operand (or the\n+        second if the first had no uncertainty). In case this is ``True``\n+        the result will have a correctly propagated uncertainty from the\n+        uncertainties of the operands but this assumes that the uncertainties\n+        are `StdDevUncertainty`. Default is ``True``.\n+\n+    handle_mask : callable, ``False`` or ``None``, optional\n+        If ``None`` the result will have no mask. If ``False`` the result\n+        will have a copied version of the mask of the first operand (or\n+        if the first operand has no mask then the one from the second is\n+        taken). If it is a callable then the specified callable must\n+        create the results ``mask`` and if necessary provide a copy.\n+        Default is `numpy.logical_or`.\n+\n+    handle_meta : callable, ``False`` or ``None``, optional\n+        If ``None`` the result will have no meta. If ``False`` the result\n+        will have a copied version of the meta of the first operand (or\n+        if the first operand has no meta then the one from the second is\n+        taken). If it is a callable then the specified callable must\n+        create the results ``meta`` and if necessary provide a copy.\n+        Default is ``False``.\n+\n+    compare_wcs : callable, ``False`` or ``None``, optional\n+        If ``None`` the result will have no wcs and no comparison between\n+        the wcs of the operands is made. If ``False`` the result will have\n+        the wcs of the first operand (or second if the first had ``None``).\n+        If it is a callable then the specified callable must\n+        compare the ``wcs``. The resulting ``wcs`` will be like if ``False``\n+        was given otherwise it raises a ``ValueError`` if the comparison was\n+        not successful. Default is ``False``.\n+\n+    uncertainty_correlation : ``Number`` or `~numpy.ndarray`, optional\n+        The correlation (rho) is defined between the uncertainties in\n+        ``sigma_AB = sigma_A * sigma_B * rho`` (Latex?). If\n+        ``propagate_uncertainties`` is *not* ``True`` this will be ignored.\n+        A value of ``0`` means uncorrelated (which is also the default).\n+        TODO: TeX of formula?\n+\n+    kwargs :\n+        Any other parameter that should be passed to the callables used.\n+\n+    Returns\n+    -------\n+    result : `~astropy.nddata.NDData`-like\n+        The resulting dataset\n+\n+    Notes\n+    -----\n+    In case a ``callable`` is used for ``mask``, ``wcs`` or ``meta`` the","path":"astropy/nddata/mixins/ndarithmetic.py","position":105,"original_position":105,"commit_id":"aa975ba56722cacf04b757ca7c5a6133a7919491","original_commit_id":"aa975ba56722cacf04b757ca7c5a6133a7919491","user":{"login":"mwcraig","id":1147167,"avatar_url":"https://avatars.githubusercontent.com/u/1147167?v=3","gravatar_id":"","url":"https://api.github.com/users/mwcraig","html_url":"https://github.com/mwcraig","followers_url":"https://api.github.com/users/mwcraig/followers","following_url":"https://api.github.com/users/mwcraig/following{/other_user}","gists_url":"https://api.github.com/users/mwcraig/gists{/gist_id}","starred_url":"https://api.github.com/users/mwcraig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwcraig/subscriptions","organizations_url":"https://api.github.com/users/mwcraig/orgs","repos_url":"https://api.github.com/users/mwcraig/repos","events_url":"https://api.github.com/users/mwcraig/events{/privacy}","received_events_url":"https://api.github.com/users/mwcraig/received_events","type":"User","site_admin":false},"body":"\"In case\" → \"If\"","created_at":"2016-01-21T21:02:52Z","updated_at":"2016-01-21T21:02:52Z","html_url":"https://github.com/astropy/astropy/pull/4272#discussion_r50463320","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/4272","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/50463320"},"html":{"href":"https://github.com/astropy/astropy/pull/4272#discussion_r50463320"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4272"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/4272","id":48687916,"html_url":"https://github.com/astropy/astropy/pull/4272","diff_url":"https://github.com/astropy/astropy/pull/4272.diff","patch_url":"https://github.com/astropy/astropy/pull/4272.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4272","number":4272,"state":"open","locked":false,"title":"NDArithmeticMixin and NDUncertainty Refactor","user":{"login":"MSeifert04","id":14200878,"avatar_url":"https://avatars.githubusercontent.com/u/14200878?v=3","gravatar_id":"","url":"https://api.github.com/users/MSeifert04","html_url":"https://github.com/MSeifert04","followers_url":"https://api.github.com/users/MSeifert04/followers","following_url":"https://api.github.com/users/MSeifert04/following{/other_user}","gists_url":"https://api.github.com/users/MSeifert04/gists{/gist_id}","starred_url":"https://api.github.com/users/MSeifert04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSeifert04/subscriptions","organizations_url":"https://api.github.com/users/MSeifert04/orgs","repos_url":"https://api.github.com/users/MSeifert04/repos","events_url":"https://api.github.com/users/MSeifert04/events{/privacy}","received_events_url":"https://api.github.com/users/MSeifert04/received_events","type":"User","site_admin":false},"body":"Initial try of splitting the large #4234. More information will follow when the splitting is done.\r\n\r\n**edit 12/22/2015: added checklist**\r\n\r\n*Next steps:*\r\n\r\n+ [ ]  Rework metadata arithmetic so that it does not enforce any specific methods of combining the metadata -- that works by calling methods on the metadata but that returns `None` with a warning if the methods don't exist. `_arithmetic_meta`\r\n+ [ ] Make thin wrapper class around a meta if it doesn't have any arithmetic operations.\r\n\r\n* Then, if that looks promising:*\r\n\r\n+ [ ] Add wrapper classes for other properties.","created_at":"2015-10-25T21:08:10Z","updated_at":"2016-01-21T21:02:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26b7c888dc770641c67eff66a5f5da8cae899bb3","assignee":{"login":"mwcraig","id":1147167,"avatar_url":"https://avatars.githubusercontent.com/u/1147167?v=3","gravatar_id":"","url":"https://api.github.com/users/mwcraig","html_url":"https://github.com/mwcraig","followers_url":"https://api.github.com/users/mwcraig/followers","following_url":"https://api.github.com/users/mwcraig/following{/other_user}","gists_url":"https://api.github.com/users/mwcraig/gists{/gist_id}","starred_url":"https://api.github.com/users/mwcraig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwcraig/subscriptions","organizations_url":"https://api.github.com/users/mwcraig/orgs","repos_url":"https://api.github.com/users/mwcraig/repos","events_url":"https://api.github.com/users/mwcraig/events{/privacy}","received_events_url":"https://api.github.com/users/mwcraig/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/26","html_url":"https://github.com/astropy/astropy/milestones/v1.2.0","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/26/labels","id":1114049,"number":26,"title":"v1.2.0","description":"","creator":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"open_issues":31,"closed_issues":23,"state":"open","created_at":"2015-05-17T16:11:47Z","updated_at":"2016-01-21T18:51:10Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/4272/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/4272/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4272/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/aa975ba56722cacf04b757ca7c5a6133a7919491","head":{"label":"MSeifert04:ndarithmeticmixin_nduncertainty","ref":"ndarithmeticmixin_nduncertainty","sha":"aa975ba56722cacf04b757ca7c5a6133a7919491","user":{"login":"MSeifert04","id":14200878,"avatar_url":"https://avatars.githubusercontent.com/u/14200878?v=3","gravatar_id":"","url":"https://api.github.com/users/MSeifert04","html_url":"https://github.com/MSeifert04","followers_url":"https://api.github.com/users/MSeifert04/followers","following_url":"https://api.github.com/users/MSeifert04/following{/other_user}","gists_url":"https://api.github.com/users/MSeifert04/gists{/gist_id}","starred_url":"https://api.github.com/users/MSeifert04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSeifert04/subscriptions","organizations_url":"https://api.github.com/users/MSeifert04/orgs","repos_url":"https://api.github.com/users/MSeifert04/repos","events_url":"https://api.github.com/users/MSeifert04/events{/privacy}","received_events_url":"https://api.github.com/users/MSeifert04/received_events","type":"User","site_admin":false},"repo":{"id":42801766,"name":"astropy","full_name":"MSeifert04/astropy","owner":{"login":"MSeifert04","id":14200878,"avatar_url":"https://avatars.githubusercontent.com/u/14200878?v=3","gravatar_id":"","url":"https://api.github.com/users/MSeifert04","html_url":"https://github.com/MSeifert04","followers_url":"https://api.github.com/users/MSeifert04/followers","following_url":"https://api.github.com/users/MSeifert04/following{/other_user}","gists_url":"https://api.github.com/users/MSeifert04/gists{/gist_id}","starred_url":"https://api.github.com/users/MSeifert04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSeifert04/subscriptions","organizations_url":"https://api.github.com/users/MSeifert04/orgs","repos_url":"https://api.github.com/users/MSeifert04/repos","events_url":"https://api.github.com/users/MSeifert04/events{/privacy}","received_events_url":"https://api.github.com/users/MSeifert04/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MSeifert04/astropy","description":"Repository for the Astropy core package","fork":true,"url":"https://api.github.com/repos/MSeifert04/astropy","forks_url":"https://api.github.com/repos/MSeifert04/astropy/forks","keys_url":"https://api.github.com/repos/MSeifert04/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MSeifert04/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MSeifert04/astropy/teams","hooks_url":"https://api.github.com/repos/MSeifert04/astropy/hooks","issue_events_url":"https://api.github.com/repos/MSeifert04/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/MSeifert04/astropy/events","assignees_url":"https://api.github.com/repos/MSeifert04/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/MSeifert04/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/MSeifert04/astropy/tags","blobs_url":"https://api.github.com/repos/MSeifert04/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MSeifert04/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MSeifert04/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/MSeifert04/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MSeifert04/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/MSeifert04/astropy/languages","stargazers_url":"https://api.github.com/repos/MSeifert04/astropy/stargazers","contributors_url":"https://api.github.com/repos/MSeifert04/astropy/contributors","subscribers_url":"https://api.github.com/repos/MSeifert04/astropy/subscribers","subscription_url":"https://api.github.com/repos/MSeifert04/astropy/subscription","commits_url":"https://api.github.com/repos/MSeifert04/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/MSeifert04/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/MSeifert04/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/MSeifert04/astropy/issues/comments{/number}","contents_url":"https://api.github.com/repos/MSeifert04/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/MSeifert04/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MSeifert04/astropy/merges","archive_url":"https://api.github.com/repos/MSeifert04/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MSeifert04/astropy/downloads","issues_url":"https://api.github.com/repos/MSeifert04/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/MSeifert04/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/MSeifert04/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/MSeifert04/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MSeifert04/astropy/labels{/name}","releases_url":"https://api.github.com/repos/MSeifert04/astropy/releases{/id}","created_at":"2015-09-20T05:43:07Z","updated_at":"2015-09-20T05:43:16Z","pushed_at":"2016-01-21T19:08:35Z","git_url":"git://github.com/MSeifert04/astropy.git","ssh_url":"git@github.com:MSeifert04/astropy.git","clone_url":"https://github.com/MSeifert04/astropy.git","svn_url":"https://github.com/MSeifert04/astropy","homepage":"www.astropy.org","size":40804,"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":"astropy:master","ref":"master","sha":"51ae92cb3a0c02827a06206182460a4cd193a2d4","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}","created_at":"2011-07-21T01:33:49Z","updated_at":"2016-01-20T04:47:38Z","pushed_at":"2016-01-21T19:08:36Z","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":59489,"stargazers_count":769,"watchers_count":769,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":482,"mirror_url":null,"open_issues_count":666,"forks":482,"open_issues":666,"watchers":769,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4272"},"html":{"href":"https://github.com/astropy/astropy/pull/4272"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/4272"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/4272/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4272/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/4272/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/aa975ba56722cacf04b757ca7c5a6133a7919491"}}}}