colorspace 0.1.0

A crate for colorimetry covering spectral, RGB, XYZ, L*a'b' and conversions thereof
Documentation
use crate::vspd::*;
use crate::cmf::CMF;

pub fn spd_to_lumens(spd: &VSPD, cmf: &CMF) -> f64 {
    // should probably do a modified verison of ASTM E-308 here but for
    // now just do a straight interpolated integration
    let cmf = cmf.y_bar.align(spd.shape());
    let s = spd.values().zip(cmf.values()).map(|(s, y)| s * y).sum::<f64>();

    s * 683.0 / spd.len() as f64
}