

The Colors of Chemistry - EvanMiller
http://jiahao.github.io/julia-blog/2014/06/09/the-colors-of-chemistry.html

======
StefanKarpinski
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.

~~~
gipp
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.

~~~
acidflask
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...

------
jwmerrill
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?

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

~~~
acidflask
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.

------
gourneau
Dang, I want those interactive plots with IPython notebooks

~~~
heptal
[http://bokeh.pydata.org/](http://bokeh.pydata.org/)

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

------
throwwit
Are Google analytics usually in Julia notebooks?

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

------
cpa

        λ->planck(λ*nm,T=T)*m^3/Watt*cie_color_match(λ)
    

This syntax made me cringe hard. Kids these days…

~~~
acidflask
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.

~~~
cpa
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?

