ChandraCXC / iris-dev

repository for tracking Iris development tasks
0 stars 0 forks source link

magnitudes aren't being converted properly #72

Closed jbudynk closed 8 years ago

jbudynk commented 8 years ago

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's SegmentStarTable 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.

jbudynk commented 8 years ago

OK, a few things are at play with this bug:

return -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.