reading cubes from memory stream (for debug purposes)
computing kappa-map with proper coefficients