Even if you don't follow the first half, it's worth skimming to get to the bottom where the computations predict the colors of chemical compounds with remarkable accuracy. The "Copper (II) aqua ion" one is the most impressive to me – the entire color spectrum is spot on.
It's not really "predicting" the colors, per se. The UV spectra being downloaded contain that information already. The code being demoed here is just a transformation of that data to "perceived" color. It's just a transformation between two equivalent representations, not "prediction" really.
Agreed, not really a prediction, but rather a projection. Still, it surprises me that few people take the trouble to make the connection between the spectra and the perceived colors. Seems like photochemistry and colorimetry don't intersect as often as they ought to...
What's going on with Rhodamine B? Its color doesn't change as a function of concentration? Why does its transmittance data seem to bounce back and forth between 0 and 1?
Ah here we go. The spectrum for Rhodamine B is noisy and it's throwing the normalization heuristic off. I've added a moving average filter and zeroed out some small noise in the >600 nm range and the colors make more sense now.
So many factors go into color matching and this is just the tip of the iceberg. Pigments vs dyes, solutions vs solid substrates, angles, light sources, observers...etc. Color is subjective, so creating an objective color-output that matches an average person's perceptual color vision is one hell of a fascinating, and expensive puzzle.
Is this so unreasonable? I needed to curry the function to sweep over the temperature T. And if you take out the units, it's simply pointwise multiplication of two functions.
Yes and no. The syntax x -> f(x) is borrowed from functional programming, which borrows it from λ-calculus.
In λ-calculus, λx. f(x) is the function which maps x to f(x). So, λ -> f(λ) makes me cringe hard, because λ is a keyword! It's like trying to write in Python: