1) The wavelengths are reversed on line 201: dw = lambda_eff[0] - lambda_eff[1], the convention for the array is [blue, red], so this should instead by [1] - [0]
2) Fixing that will cause a problem for magnitude inputs. The current behavior is correct:
The convention for color in magnitudes is blue - red, so 1 mag is a red color, and results in a red spectral gradient. However, if (1) is fixed, the code will return a blue gradient for a red color index. This must also be addressed.
High-level problem description The color is wrong for linear inputs:
The colors are inverted. There are two problems:
1) The wavelengths are reversed on line 201:
dw = lambda_eff[0] - lambda_eff[1]
, the convention for the array is [blue, red], so this should instead by [1] - [0]2) Fixing that will cause a problem for magnitude inputs. The current behavior is correct:
The convention for color in magnitudes is blue - red, so 1 mag is a red color, and results in a red spectral gradient. However, if (1) is fixed, the code will return a blue gradient for a red color index. This must also be addressed.