Apply Gaussian smearing to spectrum y value.

        Args:
            sigma: Std dev for Gaussian smear function
427806
def smear(self, sigma):
        
        diff = [self.x[i + 1] - self.x[i] for i in range(len(self.x) - 1)]
        avg_x_per_step = np.sum(diff) / len(diff)
        if len(self.ydim) == 1:
            self.y = gaussian_filter1d(self.y, sigma / avg_x_per_step)
        else:
            self.y = np.array([
                gaussian_filter1d(self.y[:, k], sigma / avg_x_per_step)
                for k in range(self.ydim[1])]).T
533536
def sigma_fltr(dem, n=3):
    
    std = dem.std()
    u = dem.mean()
    print('Excluding values outside of range: {1:0.2f} +/- {0}*{2:0.2f}'.format(n, u, std))
    rangelim = (u - n*std, u + n*std)
    out = range_fltr(dem, rangelim)
    return out
1215584
private double gaussianUpdate(int predicate, int oid, double correctionConstant) {
        double param = params[predicate].getParameters()[oid];
        double x0 = 0.0;
        double modelValue = modelExpects[0][predicate].getParameters()[oid];
        double observedValue = observedExpects[predicate].getParameters()[oid];
        for (int i = 0; i < 50; i++) {
            double tmp = modelValue * Math.exp(correctionConstant * x0);
            double f = tmp + (param + x0) / sigma - observedValue;
            double fp = tmp * correctionConstant + 1 / sigma;
            if (fp == 0) {
                break;
            }
            double x = x0 - f / fp;
            if (Math.abs(x - x0) < 0.000001) {
                x0 = x;
                break;
            }
            x0 = x;
        }
        return x0;
    }
349748
def gauss_blur( sigma, max_error = 1.0 / 0x100 )
      filter_type = DFLOAT.align typecode
      filter = Sequence[ *Array.gauss_blur_filter( sigma, max_error / dimension ) ].
        to_type filter_type
      ( dimension - 1 ).downto( 0 ).inject self do |retval,i|
        retval.convolve filter
      end
    end
1161169
def y0astep():
    
    """

    global mp_b
    mp_b[:] = mp_inv_off_diag * np.sum((mp_S + mp_rho*(mp_DX+mp_U0)),
                                       axis=mp_axisM, keepdims=True)
1141526
def get_2D_samples_gauss(n, m, sigma, random_state=None):
    
    return make_2D_samples_gauss(n, m, sigma, random_state=None)
1049763
def T_sigma(self, sigma):
        
        R_sigma, Q_sigma = self.RQ_sigma(sigma)
        return lambda v: R_sigma + self.beta * Q_sigma.dot(v)
778417
def k_s(X):
    
    xbar, sigma = pmag.gausspars(X)
    d, f = 0, 0.
    for i in range(1, len(X) + 1):
        b = old_div(float(i), float(len(X)))
        a = gaussfunc(X[i - 1], xbar, sigma)
        if abs(f - a) > abs(b - a):
            delta = abs(f - a)
        else:
            delta = abs(b - a)
        if delta > d:
            d = delta
        f = b
    return d, xbar, sigma
880909
function Gaussian(parms) {
      if (parms == null) {
        parms = {};
      }
      if (parms.pi !== void 0) {
        this.pi = parms["pi"];
        this.tau = parms["tau"];
      } else if (parms.mu !== void 0) {
        this.pi = pow(parms["sigma"], -2);
        this.tau = this.pi * parms["mu"];
      } else {
        this.pi = 0;
        this.tau = 0;
      }
      if (isNaN(this.pi) || isNaN(this.tau)) {
        throw new Error("Gaussian parms can not be NaN");
      }
    }
607121
def gauss_pdf(x, mu, sigma):
    """"""
    return 1 / np.sqrt(2 * np.pi) / sigma * np.exp(-(x - mu) ** 2 / 2. / sigma ** 2)
630795
protected static Kernel1D_F32 derivative1D_F32(int order, double sigma, int radius, boolean normalize) {

		Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1);
		float[] gaussian = ret.data;
		int index = 0;
		switch( order ) {
			case 1:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative1(0, sigma, i);
				}
				break;

			case 2:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative2(0, sigma, i);
				}
				break;

			case 3:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative3(0, sigma, i);
				}
				break;

			case 4:
				for (int i = radius; i >= -radius; i--) {
					gaussian[index++] = (float) UtilGaussian.derivative4(0, sigma, i);
				}
				break;

			default:
				throw new IllegalArgumentException("Only derivatives of order 1 to 4 are supported");
		}

		// multiply by the same factor as the gaussian would be normalized by
		// otherwise it will effective change the intensity of the input image
		if( normalize ) {
			double sum = 0;
			for (int i = radius; i >= -radius; i--) {
				sum += UtilGaussian.computePDF(0, sigma, i);
			}
			for (int i = 0; i < gaussian.length; i++) {
				gaussian[i] /= sum;
			}
		}
		
		return ret;
	}
126598
def _gpinv(probs, kappa, sigma):
    """"""
    x = np.full_like(probs, np.nan)
    if sigma <= 0:
        return x
    ok = (probs > 0) & (probs < 1)
    if np.all(ok):
        if np.abs(kappa) < np.finfo(float).eps:
            x = -np.log1p(-probs)  # pylint: disable=invalid-unary-operand-type
        else:
            x = np.expm1(-kappa * np.log1p(-probs)) / kappa
        x *= sigma
    else:
        if np.abs(kappa) < np.finfo(float).eps:
            x[ok] = -np.log1p(-probs[ok])  # pylint: disable=unsupported-assignment-operation, E1130
        else:
            x[ok] = (  # pylint: disable=unsupported-assignment-operation
                np.expm1(-kappa * np.log1p(-probs[ok])) / kappa
            )
        x *= sigma
        x[probs == 0] = 0
        if kappa >= 0:
            x[probs == 1] = np.inf  # pylint: disable=unsupported-assignment-operation
        else:
            x[probs == 1] = -sigma / kappa  # pylint: disable=unsupported-assignment-operation

    return x
424521
def gtlike_spectrum_to_vectors(spectrum):
    


    parameters = pyLike.ParameterVector()
    spectrum.getParams(parameters)

    npar = max(parameters.size(), 10)
    o = {'param_names': np.zeros(npar, dtype='S32'),
         'param_values': np.empty(npar, dtype=float) * np.nan,
         'param_errors': np.empty(npar, dtype=float) * np.nan,
         }

    for i, p in enumerate(parameters):
        o['param_names'][i] = p.getName()
        o['param_values'][i] = p.getTrueValue()
        perr = abs(p.error() * p.getScale()) if p.isFree() else np.nan
        o['param_errors'][i] = perr

    return o
628164
def _sigma_ep(self, gam, eps):
        
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            return self._sigma_1(gam, eps)
1202326
def log_gaussian(x, y, x_sigma, y_sigma, mu):
    
    if x_sigma==0.0 or y_sigma==0.0:
        return x * 0.0

    with float_error_ignore():
        x_w = np.divide(np.log(x)-mu, x_sigma*x_sigma)
        y_h = np.divide(np.log(y)-mu, y_sigma*y_sigma)

        return np.exp(-0.5*x_w*x_w + -0.5*y_h*y_h)
12313
def generate_gaussian_profile(seeing_fwhm):
    """"""
    FWHM_G = 2 * math.sqrt(2 * math.log(2))
    sigma = seeing_fwhm / FWHM_G
    amplitude = 1.0 / (2 * math.pi * sigma * sigma)
    seeing_model = Gaussian2D(amplitude=amplitude,
                              x_mean=0.0,
                              y_mean=0.0,
                              x_stddev=sigma,
                              y_stddev=sigma)
    return seeing_model
1257313
private void detectCandidateFeatures(T image, double sigma ) {

		// adjust corner intensity threshold based upon the current scale factor
		float scaleThreshold = (float) (baseThreshold / Math.pow(sigma, scalePower));
		detector.setThreshold(scaleThreshold);
		computeDerivative.setInput(image);

		D derivX = null, derivY = null;
		D derivXX = null, derivYY = null, derivXY = null;

		if (detector.getRequiresGradient()) {
			derivX = computeDerivative.getDerivative(true);
			derivY = computeDerivative.getDerivative(false);
		}
		if (detector.getRequiresHessian()) {
			derivXX = computeDerivative.getDerivative(true, true);
			derivYY = computeDerivative.getDerivative(false, false);
			derivXY = computeDerivative.getDerivative(true, false);
		}

		detector.process(image, derivX, derivY, derivXX, derivYY, derivXY);

		List<Point2D_I16> m = maximums;
		m.clear();
		if( detector.isDetectMaximums() ) {
			QueueCorner q = detector.getMaximums();
			for (int i = 0; i < q.size; i++) {
				m.add(q.get(i).copy());
			}
		}
		if( detector.isDetectMinimums() ) {
			QueueCorner q = detector.getMinimums();
			for (int i = 0; i < q.size; i++) {
				m.add(q.get(i).copy());
			}
		}
	}