{"action":"created","issue":{"url":"https://api.github.com/repos/ChandraCXC/iris/issues/301","repository_url":"https://api.github.com/repos/ChandraCXC/iris","labels_url":"https://api.github.com/repos/ChandraCXC/iris/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/ChandraCXC/iris/issues/301/comments","events_url":"https://api.github.com/repos/ChandraCXC/iris/issues/301/events","html_url":"https://github.com/ChandraCXC/iris/pull/301","id":159636639,"number":301,"title":"Fix issue with AB magnitudes not being converted correctly.","user":{"login":"jbudynk","id":6233750,"avatar_url":"https://avatars.githubusercontent.com/u/6233750?v=3","gravatar_id":"","url":"https://api.github.com/users/jbudynk","html_url":"https://github.com/jbudynk","followers_url":"https://api.github.com/users/jbudynk/followers","following_url":"https://api.github.com/users/jbudynk/following{/other_user}","gists_url":"https://api.github.com/users/jbudynk/gists{/gist_id}","starred_url":"https://api.github.com/users/jbudynk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbudynk/subscriptions","organizations_url":"https://api.github.com/users/jbudynk/orgs","repos_url":"https://api.github.com/users/jbudynk/repos","events_url":"https://api.github.com/users/jbudynk/events{/privacy}","received_events_url":"https://api.github.com/users/jbudynk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ChandraCXC/iris/labels/2%20-%20Working","name":"2 - Working","color":"CCCCCC"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-10T13:36:31Z","updated_at":"2016-06-16T17:31:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ChandraCXC/iris/pulls/301","html_url":"https://github.com/ChandraCXC/iris/pull/301","diff_url":"https://github.com/ChandraCXC/iris/pull/301.diff","patch_url":"https://github.com/ChandraCXC/iris/pull/301.patch"},"body":"Addresses ChandraCXC/iris-dev#72\r\n\r\nThis PR fixes an issue where conversions between magnitudes and flux/flux densities were not done correctly.\r\n\r\nFirst, the wrong units conversion method was being used in [`SegmentStarTable::setFluxUnits()`](https://github.com/ChandraCXC/iris/blob/master/iris-common/src/main/java/cfa/vo/iris/sed/stil/SegmentStarTable.java#L221). Before, it was using `UnitsManager::convertY()`. Now, it uses `UnitsManager::convertErrors()` for the flux errors which has a special cases for converting errors to/from magnitude units (in the Specview units code).\r\n\r\nNext, Specview's `YUnits` conversion method for AB magnitudes wasn't perfect. This has been fixed in line [862](https://github.com/ChandraCXC/iris/blob/iris-dev-72-magnitudes-conversion/iris-common/src/main/java/cfa/vo/iris/units/spv/YUnits.java#L862). This is what was causing the flux values to change when the user converts back and forth between ABMAG and another unit multiple times.\r\n\r\nConverting errors between magnitude and flux/flux density units, however, is more tricky. Even doing calculations by hand, I haven't figured out how to convert the errors back and forth between mags and flux. So as a solution, this PR stores *all* the original flux values and errors, along with the original units, and always starts from here when converting between units. I am not happy with this solution, as this takes up more space. However, now we could have a method to reset the SED back to it's original state without any issues.\r\n\r\nTODOs:\r\n   - make sure the OriginalFlux column in the MB shows the original units."},"comment":{"url":"https://api.github.com/repos/ChandraCXC/iris/issues/comments/226556443","html_url":"https://github.com/ChandraCXC/iris/pull/301#issuecomment-226556443","issue_url":"https://api.github.com/repos/ChandraCXC/iris/issues/301","id":226556443,"user":{"login":"jbudynk","id":6233750,"avatar_url":"https://avatars.githubusercontent.com/u/6233750?v=3","gravatar_id":"","url":"https://api.github.com/users/jbudynk","html_url":"https://github.com/jbudynk","followers_url":"https://api.github.com/users/jbudynk/followers","following_url":"https://api.github.com/users/jbudynk/following{/other_user}","gists_url":"https://api.github.com/users/jbudynk/gists{/gist_id}","starred_url":"https://api.github.com/users/jbudynk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbudynk/subscriptions","organizations_url":"https://api.github.com/users/jbudynk/orgs","repos_url":"https://api.github.com/users/jbudynk/repos","events_url":"https://api.github.com/users/jbudynk/events{/privacy}","received_events_url":"https://api.github.com/users/jbudynk/received_events","type":"User","site_admin":false},"created_at":"2016-06-16T17:31:48Z","updated_at":"2016-06-16T17:31:48Z","body":"Rebased onto master. Original tip was 538de2f"}}
{"actor":{"display_login":"jbudynk"}}