{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4105","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4105/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4105/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4105/events","html_url":"https://github.com/astropy/astropy/issues/4105","id":103815877,"number":4105,"title":"io.fits.getdata() lower and upper keywords broken","user":{"login":"sbailey","id":218471,"avatar_url":"https://avatars.githubusercontent.com/u/218471?v=3","gravatar_id":"","url":"https://api.github.com/users/sbailey","html_url":"https://github.com/sbailey","followers_url":"https://api.github.com/users/sbailey/followers","following_url":"https://api.github.com/users/sbailey/following{/other_user}","gists_url":"https://api.github.com/users/sbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/sbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbailey/subscriptions","organizations_url":"https://api.github.com/users/sbailey/orgs","repos_url":"https://api.github.com/users/sbailey/repos","events_url":"https://api.github.com/users/sbailey/events{/privacy}","received_events_url":"https://api.github.com/users/sbailey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-29T00:15:32Z","updated_at":"2015-08-29T00:17:39Z","closed_at":null,"body":"astropy 1.0.2 broke the functionality of the `lower` and `upper` arguments to astropy.io.fits.getdata when reading binary fits tables.  Prior to 1.0.2, the returned FITS_rec object properly handled case insensitive column names, while allowing the lower/upper keywords to specify what should be used if those objects were cast to normal numpy.array objects or written back out.  Starting with astropy 1.0.2, this broke; using the `lower` or `upper` arguments resulted in *neither* case working.  The code below demonstrates the problem:\r\n\r\n    import astropy\r\n    print astropy.__version__\r\n\r\n    from astropy.table import Table\r\n    t = Table([np.zeros(5), np.ones(5), np.arange(5)], names=['a', 'b', 'c'])\r\n    t.write('lower.fits')\r\n    t = Table([np.zeros(5), np.ones(5), np.arange(5)], names=['A', 'B', 'C'])\r\n    t.write('upper.fits')\r\n\r\n    #- Without the lower/upper keywords, columns can be accessed with either\r\n    #- upper- or lower-case names; the .dtype.names reflects whatever was in\r\n    #- the source fits file\r\n    from astropy.io import fits\r\n    lower = fits.getdata('lower.fits', 1)\r\n    upper = fits.getdata('upper.fits', 1)\r\n\r\n    print lower.dtype.names\r\n    print upper.dtype.names\r\n\r\n    np.all(lower['a'] == lower['A'])    #- Works\r\n    np.all(upper['a'] == upper['A'])    #- Works\r\n\r\n    #- Prior to astropy 1.0.2, the upper/lower keywords affected the case of\r\n    #- .dtype.names and how they are cast to normal numpy.array objects, while\r\n    #- still supporting case-insensitive column names.  This broke with\r\n    #- astropy 1.0.2, where neither upper- nor lower-case works after using\r\n    #- the upper/lower keywords.\r\n    lowup = fits.getdata('lower.fits', 1, upper=True)\r\n    lowup.dtype.names\r\n    lowup['A']              #- KeyError\r\n    lowup['a']              #- KeyError\r\n    lowup.A                 #- Works\r\n    np.array(lowup)['A']    #- Works\r\n\r\n    uplow = fits.getdata('upper.fits', 1, lower=True)\r\n    uplow.dtype.names\r\n    uplow['A']              #- KeyError\r\n    uplow['a']              #- KeyError\r\n    uplow.a                 #- Works\r\n    np.array(uplow)['a']    #- Works\r\n"},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/135920097","html_url":"https://github.com/astropy/astropy/issues/4105#issuecomment-135920097","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4105","id":135920097,"user":{"login":"sbailey","id":218471,"avatar_url":"https://avatars.githubusercontent.com/u/218471?v=3","gravatar_id":"","url":"https://api.github.com/users/sbailey","html_url":"https://github.com/sbailey","followers_url":"https://api.github.com/users/sbailey/followers","following_url":"https://api.github.com/users/sbailey/following{/other_user}","gists_url":"https://api.github.com/users/sbailey/gists{/gist_id}","starred_url":"https://api.github.com/users/sbailey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbailey/subscriptions","organizations_url":"https://api.github.com/users/sbailey/orgs","repos_url":"https://api.github.com/users/sbailey/repos","events_url":"https://api.github.com/users/sbailey/events{/privacy}","received_events_url":"https://api.github.com/users/sbailey/received_events","type":"User","site_admin":false},"created_at":"2015-08-29T00:17:39Z","updated_at":"2015-08-29T00:17:39Z","body":"For the record, this is still broken in the latest release 1.0.4.  Version 1.0.2 is where the problem first appeared.  The sample code works for versions 1.0 and 1.0.1."}}