added debugging messages to spectrum calc