added code from luminance/depth jneuro paper