wavelength calculation. big wip