TEST: added tests for compute residual field functions. Renamed sigma to sigmasq and added missing 'with nogil' clause