def _calc_error(scale, weights, error_input, add_mu=False, add_mu_small=False): error = utils.l2norm_weighted(error_input, scale, weights) if add_mu: error = utils.l2norm(error, MU_ERROR) if add_mu_small: error = utils.l2norm(error, MU_ERROR_SMALL) return error
def _calc_error( scale: float, weights: tuple, error_input: tuple, add_mu: bool = False, add_mu_small: bool = False, ) -> ma.MaskedArray: error = utils.l2norm_weighted(error_input, scale, weights) if add_mu is True: error = utils.l2norm(error, MU_ERROR) if add_mu_small is True: error = utils.l2norm(error, MU_ERROR_SMALL) return error
def test_l2_norm_weighted(): x = (2, 3) weights = (1, 2) scale = 10 assert_array_almost_equal(utils.l2norm_weighted(x, scale, weights), 10 * np.sqrt([40]))
def _calc_bias(scale, weights): return utils.l2norm_weighted(bias_input, scale, weights)
def _calc_n_bias(): z_bias = bias_input[0] dia_bias = db2lin(results['Do_bias']) return utils.l2norm_weighted((z_bias, dia_bias), 1, (1, 6))
def test_calc_error(): from cloudnetpy.utils import l2norm_weighted expected = l2norm_weighted(ERROR_INPUT, 1, 1) testing.assert_almost_equal(de._calc_error(1, 1, ERROR_INPUT), expected)
def _calc_bias(scale: float, weights: tuple) -> ma.MaskedArray: return utils.l2norm_weighted(bias_input, scale, weights)
def _calc_n_bias() -> ma.MaskedArray: z_bias = bias_input[0] dia_bias = db2lin(results["Do_bias"]) return utils.l2norm_weighted((z_bias, dia_bias), 1, (1, 6))
def test_l2_norm_weighted(data, scale, weights, result): assert_array_almost_equal(utils.l2norm_weighted(data, scale, weights), result)