Package ca.nengo.math

Examples of ca.nengo.math.CurveFitter


  /*
   * Test method for 'ca.nengo.math.impl.LinearCurveFitter.fit()'
   */
  public void testFindCoefficients() {
    Function target = new Polynomial(new float[]{1f,4f,-3f,0.5f});
    CurveFitter lcf = new LinearCurveFitter();
    float[][] values = new float[2][10];
   
    for (int i=0; i<values[0].length; i++) {
      values[0][i] = -9 + i * 2;
      values[1][i] = target.map(new float[]{values[0][i]});
    }
   
    Function fitted = lcf.fit(values[0], values[1]);
   
//    Plotter.plot(target, -10, 0.1f, 10, "target");
//    Plotter.plot(fitted, -10, 0.5f, 10, "fitted");
   
    float targetVal = 0f;
View Full Code Here


    for (int i = 0; i < myCurrents.length; i++) {
      countSpikes(myCurrents[i], dt, myTransientTime);
      rates[i] = countSpikes(myCurrents[i], dt, simTime) / simTime;
    }

    CurveFitter cf = new LinearCurveFitter();
    Function result = cf.fit(myCurrents, rates);
    myConstantRateFunction = result;
    myConstantRateFunctionOK = true;
    myMode = mode;
  }
View Full Code Here

    myMode = SimulationMode.DEFAULT;
    mySupportedModes = new SimulationMode[]{SimulationMode.DEFAULT, SimulationMode.RATE, SimulationMode.CONSTANT_RATE};
  }

  private Function getSteadyStateVmFunction() {
    CurveFitter fitter = new LinearCurveFitter();

    float[] current = new float[]{0f, .25f, .5f, .75f, 1f, 1.25f, 1.5f, 1.75f, 2f, 2.25f, 2.5f, 2.75f, 3f, 3.5f, 4f, 5f, 6f, 8f, 10f, 15f, 20f, 30f, 40f, 50f, 60f};
    float[] Vm = new float[current.length];
    float[] rt = new float[current.length];
    for (int i = 0; i < current.length; i++) {
      TimeSeries input = new TimeSeriesImpl(new float[]{0, 0.5f},
          new float[][]{new float[]{current[i], 1.0f}, new float[]{current[i], 1.0f}}, new Units[]{Units.uAcm2, Units.UNK});
      TimeSeries output = myIntegrator.integrate(myDynamics, input);
      Vm[i] = output.getValues()[output.getValues().length - 1][0];
      reset(false);
//      Plotter.plot(output, "simulation "+i);
      rt[i] = getRefreactoryTime(Vm[i]);
    }

    Function result = fitter.fit(current, Vm);
//    Plotter.plot(result, 0, .1f, 60, "current -> Vm");
//    Plotter.plot(current, rt, "current -> rt");
    return result;
  }
View Full Code Here

TOP

Related Classes of ca.nengo.math.CurveFitter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.