{"action":"created","issue":{"url":"https://api.github.com/repos/desihub/desispec/issues/52","labels_url":"https://api.github.com/repos/desihub/desispec/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/desihub/desispec/issues/52/comments","events_url":"https://api.github.com/repos/desihub/desispec/issues/52/events","html_url":"https://github.com/desihub/desispec/issues/52","id":100579471,"number":52,"title":"combine_ivar doesn't work as advertised","user":{"login":"weaverba137","id":3780690,"avatar_url":"https://avatars.githubusercontent.com/u/3780690?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverba137","html_url":"https://github.com/weaverba137","followers_url":"https://api.github.com/users/weaverba137/followers","following_url":"https://api.github.com/users/weaverba137/following{/other_user}","gists_url":"https://api.github.com/users/weaverba137/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverba137/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverba137/subscriptions","organizations_url":"https://api.github.com/users/weaverba137/orgs","repos_url":"https://api.github.com/users/weaverba137/repos","events_url":"https://api.github.com/users/weaverba137/events{/privacy}","received_events_url":"https://api.github.com/users/weaverba137/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/desihub/desispec/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-12T16:11:40Z","updated_at":"2015-08-13T17:55:35Z","closed_at":null,"body":"The test in `desispec.test.test_util.TestNight.test_combine_ivar()` performs this test:\r\n\r\n```python\r\n        ivar = util.combine_ivar(1, 2)\r\n```\r\n\r\n`desispec.util.combine_ivar` tries to convert the scalar values to an array, using\r\n\r\n```python\r\n    iv1 = np.asarray(ivar1)  #- handle list, tuple, ndarray, and scalar input\r\n    iv2 = np.asarray(ivar2)\r\n```\r\n\r\nHowever, for scalar input, `np.asarray()` returns a numpy *scalar*, which cannot be indexed.  When the combined inverse variance is computed, \r\n\r\n```python\r\n    ivar[ii] = 1.0 / (1.0/iv1[ii] + 1.0/iv2[ii])\r\n```\r\n\r\nthe indexing of the scalar values throws an exception.\r\n\r\nIt is very strange that this test *ever* passed."},"comment":{"url":"https://api.github.com/repos/desihub/desispec/issues/comments/130779990","html_url":"https://github.com/desihub/desispec/issues/52#issuecomment-130779990","issue_url":"https://api.github.com/repos/desihub/desispec/issues/52","id":130779990,"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-13T17:55:35Z","updated_at":"2015-08-13T17:55:35Z","body":"Good to support numpy 1.8.x, but it would probably be better to handle this using np.atleast_1d() instead of the original np.asarray(), rather than the explicit numpy version checking in commit d4f7735 .\r\n"}}