{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/5384","labels_url":"https://api.github.com/repos/numpy/numpy/issues/5384/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/5384/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/5384/events","html_url":"https://github.com/numpy/numpy/issues/5384","id":52617640,"number":5384,"title":"numpy.ma wants to mask out my infs","user":{"login":"argriffing","id":101416,"avatar_url":"https://avatars.githubusercontent.com/u/101416?v=3","gravatar_id":"","url":"https://api.github.com/users/argriffing","html_url":"https://github.com/argriffing","followers_url":"https://api.github.com/users/argriffing/followers","following_url":"https://api.github.com/users/argriffing/following{/other_user}","gists_url":"https://api.github.com/users/argriffing/gists{/gist_id}","starred_url":"https://api.github.com/users/argriffing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argriffing/subscriptions","organizations_url":"https://api.github.com/users/argriffing/orgs","repos_url":"https://api.github.com/users/argriffing/repos","events_url":"https://api.github.com/users/argriffing/events{/privacy}","received_events_url":"https://api.github.com/users/argriffing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-22T03:44:52Z","updated_at":"2015-01-01T17:06:52Z","closed_at":null,"body":"```python\r\nfrom __future__ import print_function, division\r\n\r\nimport numpy as np\r\n\r\nprint('numpy version', np.__version__)\r\n\r\na = np.ma.array([1.0, 2.0, np.inf], mask=[0, 0, 0])\r\nb = np.ma.array([1.0, 2.0, 3.0], mask=[0, 0, 0])\r\nq = a/b\r\nprint(repr(a))\r\nprint(repr(b))\r\nprint(repr(q))\r\n```\r\n\r\n```\r\nnumpy version 1.10.0.dev-243ab56\r\nmasked_array(data = [1.0 2.0 inf],\r\n             mask = [False False False],\r\n       fill_value = 1e+20)\r\n\r\nmasked_array(data = [1.0 2.0 3.0],\r\n             mask = [False False False],\r\n       fill_value = 1e+20)\r\n\r\nmasked_array(data = [1.0 1.0 --],\r\n             mask = [False False  True],\r\n       fill_value = 1e+20)\r\n```"},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/68491779","html_url":"https://github.com/numpy/numpy/issues/5384#issuecomment-68491779","issue_url":"https://api.github.com/repos/numpy/numpy/issues/5384","id":68491779,"user":{"login":"abalkin","id":535197,"avatar_url":"https://avatars.githubusercontent.com/u/535197?v=3","gravatar_id":"","url":"https://api.github.com/users/abalkin","html_url":"https://github.com/abalkin","followers_url":"https://api.github.com/users/abalkin/followers","following_url":"https://api.github.com/users/abalkin/following{/other_user}","gists_url":"https://api.github.com/users/abalkin/gists{/gist_id}","starred_url":"https://api.github.com/users/abalkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abalkin/subscriptions","organizations_url":"https://api.github.com/users/abalkin/orgs","repos_url":"https://api.github.com/users/abalkin/repos","events_url":"https://api.github.com/users/abalkin/events{/privacy}","received_events_url":"https://api.github.com/users/abalkin/received_events","type":"User","site_admin":false},"created_at":"2015-01-01T17:06:52Z","updated_at":"2015-01-01T17:06:52Z","body":"The \"intention\" in ma is to avoid non-finite values in data representation.  The operations within ma should never produce unmasked non-finite values (and to the extent possible, even masked non-finite values.)  If you deliberately create a non-finite entry in a masked array, you are really in the realm of undefined behavior.   Remember: ma was designed at the time when IEEE 764 standard was not universally supported and most operations with non-finite numbers wold lead to undefined/system-dependent behavior.  Furthermore, ma was designed to be type agnostic and most numpy types do not have non-finite values.\r\n\r\nWhether or not, we should now define how ma should treat non-finite IEEE 764 values, is a separate question and not an easy one.  My gut feeling is that people who can limit themselves to floating point data are better off not using ma and vice versa - people who use ma should enjoy living in the nan/inf-free world.\r\n"}}