{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4797","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4797/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4797/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4797/events","html_url":"https://github.com/astropy/astropy/pull/4797","id":149937156,"number":4797,"title":"included an NDDataAllMixins class as alternative to NDDataArray.","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},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/nddata","name":"nddata","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-04-21T02:00:25Z","updated_at":"2016-04-23T12:18:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/4797","html_url":"https://github.com/astropy/astropy/pull/4797","diff_url":"https://github.com/astropy/astropy/pull/4797.diff","patch_url":"https://github.com/astropy/astropy/pull/4797.patch"},"body":"The `NDDataAllMixins`-class (horrible name but I haven't figured out a better name) is an alternative to the compatibility class `NDDataArray`. It's nothing special it's an empty class that could serve for demonstration purposes in the documentation and as an useable implementation of `NDData`+Mixins for user that don't want to subclass themself.\r\n\r\nI've changed the tests for the Mixins to use this class. But I really don't like the name.\r\n\r\nRationale for this class:\r\n\r\n`NDDataArray` was kept as compatibility class during APE7 (see [Transition to astropy 1.0](https://astropy.readthedocs.org/en/v1.0.9/nddata/index.html#transition-to-astropy-1-0)). It provides all Mixins too but with a `numpy.ndarray`-like interface.\r\n\r\nIn my opinion `NDDataArray` would need a lot of work to make it recommendable. The `ndarray`-like-ness is a bit of a curse because it only keeps the `data` and `mask` (see [https://github.com/astropy/astropy/blob/master/astropy/nddata/compat.py#L237](sourcecode)) but throws away everything else. This gives unexpected results when using UFUNCS:\r\n\r\n```\r\nfrom astropy.nddata import NDDataArray, NDDataAllMixins\r\nimport numpy as np\r\nndd1 = NDDataAllMixins(np.ones((3,3)), \r\n                       meta={'cool': True}, \r\n                       mask=np.random.random((3,3))>0.5,\r\n                       uncertainty=StdDevUncertainty(np.ones((3,3))),\r\n                       unit='m')\r\nndd2 = NDDataArray(ndd1, copy=True)\r\nnp.sin(ndd2)\r\nmasked_array(data =\r\n [[0.8414709848078965 -- --]\r\n [0.8414709848078965 -- --]\r\n [0.8414709848078965 -- 0.8414709848078965]],\r\n             mask =\r\n [[False  True  True]\r\n [False  True  True]\r\n [False  True False]],\r\n       fill_value = 1e+20)\r\n```\r\nWhile it just simple doesn't work with `NDDataAllMixins`:\r\n```\r\nnp.sin(ndd1)\r\nAttributeError: 'NDDataAllMixins' object has no attribute 'sin'\r\n```\r\n\r\nSo instead of telling people to subclass `NDData` and `NDArithmeticMixin` or `NDData` and `NDIOMixin` or `NDData` and `NDSlicingMixin` one could just describe `NDDataAllMixins` which has all these Mixins implemented without promoting `NDDataArray` (which also puts more restrictions on the implementation than `NDData` does).\r\n\r\nLong story short:\r\nThe reason is because I want to rewrite parts of the `nddata`-package documentation:\r\n- NDDataAllMixins as _the class_ the users probably want to use (Getting started and explaining the Mixins)\r\n- NDData if the user wants just the container (no arithmetics, slicing or io-interface)\r\n- NDDataBase if the user wants the abstract meta-container because NDData is too restricted for his use-case.\r\n- don't mention `NDDataArray` that's just for compatibility with pre-astropy 1.0 code as far as I see it."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/213730952","html_url":"https://github.com/astropy/astropy/pull/4797#issuecomment-213730952","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4797","id":213730952,"user":{"login":"pllim","id":2090236,"avatar_url":"https://avatars.githubusercontent.com/u/2090236?v=3","gravatar_id":"","url":"https://api.github.com/users/pllim","html_url":"https://github.com/pllim","followers_url":"https://api.github.com/users/pllim/followers","following_url":"https://api.github.com/users/pllim/following{/other_user}","gists_url":"https://api.github.com/users/pllim/gists{/gist_id}","starred_url":"https://api.github.com/users/pllim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pllim/subscriptions","organizations_url":"https://api.github.com/users/pllim/orgs","repos_url":"https://api.github.com/users/pllim/repos","events_url":"https://api.github.com/users/pllim/events{/privacy}","received_events_url":"https://api.github.com/users/pllim/received_events","type":"User","site_admin":false},"created_at":"2016-04-23T12:18:24Z","updated_at":"2016-04-23T12:18:24Z","body":"`NDDataPlus`? "}}