Closed keflavich closed 1 year ago
I am getting the similar issue, but my flux does have units actually (erg/cm^2 s). Instead of the original line I did a very "stupid" fix: `lines.append(np.column_stack([s.wav / u.micron, flux / u.erg u.cm * 2 u.s]))` And it actually worked. I don't think it is a real solution, but I did not see anything wrong with the fit I got in the end.
EDIT (03.12.21):
In case anyone is reading this in the future: since the units of flux seems to be indeed gone for some other models (like in the OP's example), the ugly work around that works in either case would be this:
try:
lines.append(np.column_stack([s.wav / s.wav.unit, flux / flux.unit]))
except:
lines.append(np.column_stack([s.wav / s.wav.unit, flux]))
@Korboal that's a fine workaround; numpy can concatenate things that are unitless-equivalent, and you've effectively dropped the units
I think this should be fixed in main
- I just stripped the units before stacking as they are not needed for plotting. Can someone confirm this works now?
I suspect this is a regression caused by changes in astropy, but I'm not sure.
The problem line is this in plot.py:
s.wav
has units ofu.um
, whileflux
is unitless (but should be mJy). Numpy can't handle mixed units/non-unit values.Full traceback: