/** * Adds a point to the sample. * Calling this method is equivalent to calling * {@code add(1.0, x, y)}. * * @param x Abscissa of the point. * @param y Observed value at {@code x}. After fitting we should * have {@code f(x)} as close as possible to this value. * * @see #add(double, double, double) * @see #add(WeightedObservedPoint) * @see #toList() */ public void add(double x, double y) { add(1d, x, y); }
private void updateFunction() { final WeightedObservedPoints obs = new WeightedObservedPoints(); int nonZeroValues = 0; double highestValue = 0.0; if (v != 0.0) { nonZeroValues++; obs.add((double) i, v); if (v > highestValue) { highestValue = v; obs.add(-1.0, 2 * highestValue); nonZeroValues++; final double[] coeff = fitter.fit(obs.toList()); approxFunction = new PolynomialFunction(coeff); return; final double[] coeff = fitter.fit(obs.toList()); approxFunction = new PolynomialFunction(coeff);
continue; WeightedObservedPoints obs = new WeightedObservedPoints(); for (SliceSparseMatrix.VerticalSliceDataPoint datapoint : verticalSlice) { obs.add(datapoint.mz, datapoint.intensity); double[] parameters = GaussianCurveFitter.create().fit(obs.toList()); sigma += FWHM_CONSTANT * parameters[2];
continue; WeightedObservedPoints obs = new WeightedObservedPoints(); for (SliceSparseMatrix.VerticalSliceDataPoint datapoint : verticalSlice) { obs.add(datapoint.mz, datapoint.intensity); double[] parameters = GaussianCurveFitter.create().fit(obs.toList()); sigma += FWHM_CONSTANT * parameters[2];
/** * Adds a point to the sample. * Calling this method is equivalent to calling * {@code add(1.0, x, y)}. * * @param x Abscissa of the point. * @param y Observed value at {@code x}. After fitting we should * have {@code f(x)} as close as possible to this value. * * @see #add(double, double, double) * @see #add(WeightedObservedPoint) * @see #toList() */ public void add(double x, double y) { add(1d, x, y); }
WeightedObservedPoints points = new WeightedObservedPoints(); for(int i=0; i<x.length; i++) { points.add(x[i], y[i]); List<WeightedObservedPoint> pointList = points.toList();
/** * Adds a point to the sample. * Calling this method is equivalent to calling * {@code add(1.0, x, y)}. * * @param x Abscissa of the point. * @param y Observed value at {@code x}. After fitting we should * have {@code f(x)} as close as possible to this value. * * @see #add(double, double, double) * @see #add(WeightedObservedPoint) * @see #toList() */ public void add(double x, double y) { add(1d, x, y); }
WeightedObservedPoints points = new WeightedObservedPoints(); for(int i=0; i<x.length; i++) { points.add(x[i], y[i]); double[] coef = curveFitter.fit(points.toList()); PolynomialFunction pf = new PolynomialFunction(coef); UnivariateFunction univariateFunction = pf.derivative();
WeightedObservedPoints points = new WeightedObservedPoints(); for(int i=0; i<x.length; i++) { points.add(x[i], y[i]); double[] coef = curveFitter.fit(points.toList()); PolynomialFunction pf = new PolynomialFunction(coef);
WeightedObservedPoints points = new WeightedObservedPoints(); for(int i=0; i<x.length; i++) { points.add(x[i], y[i]); double[] guess = new HarmonicCurveFitter.ParameterGuesser(points.toList()).guess(); curveFitter = curveFitter.withStartPoint(guess); double[] coef = curveFitter.fit(points.toList()); HarmonicOscillator pf = new HarmonicOscillator(coef[0], coef[1], coef[2]);