Hacker News new | past | comments | ask | show | jobs | submit login
The Colors of Chemistry (jiahao.github.io)
108 points by EvanMiller on June 9, 2014 | hide | past | favorite | 14 comments



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.

Still, Julia is neat though.


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?


There's something odd about how my normalization heuristic behaves with this particular spectrum. I haven't yet looked into it.


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.


Dang, I want those interactive plots with IPython notebooks



C.R.E.A.M. - CIE Rules Everything Around Me

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.


Are Google analytics usually in Julia notebooks?


No, I put that in the first cell. You can take it out of the notebook if you want.


    λ->planck(λ*nm,T=T)*m^3/Watt*cie_color_match(λ)
This syntax made me cringe hard. Kids these days…


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:

    def def(x):
        pass
Weird, uh?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: