Closed jbudynk closed 8 years ago
OK, a few things are at play with this bug:
YUnits
conversion method for AB magnitudes isn't perfect. At line 862, it should bereturn -2.5 * Math.log10(arg) + ABZERO);
this is what was causing the flux values to change when the user converts back and forth between ABMAG and another unit multiple times.
setFluxUnits()
in iris-common's SegmentStarTable
should be using units.convertErrors
for the errors and not units.convertY
, as there are rules for converting errors to/from magnitude units in the specview code.setFlux...
methods in SegmentStarTable.setFluxUnits()
matters. If the flux values are converted first, then the wrong flux values are passed into convertErrors
for converting the flux errors. The flux values should be converted after the errors are converted.
This issue was first discovered in PR ChandraCXC/iris#275. Changing the units from any flux/flux density to magnitudes (ABMAG or STMAG) converts the flux and flux errors incorrectly.
I've been checking
setFluxUnits()
in iris-common'sSegmentStarTable
class to see what's happening. My guess is we should be always going back to the original flux values when computing any unit changes, but what does Iris 2.1 do?The SPV units code in Iris is the same as it is in Specview, so I don't think there's anything wrong with spv's
YUnits
conversion methods.