Package ca.nengo.util.impl

Examples of ca.nengo.util.impl.TimeSeries1DImpl


    myCurrentOrigin.setValues(0, 0, new float[]{0});
    myName = name;
    myScale = scale;
    myBias = bias;
    myRadialInput = 0;
    myCurrent = new TimeSeries1DImpl(new float[]{0}, new float[]{0}, Units.UNK);
  }
View Full Code Here


      if (myNoise != null) {
        generatorInput[i] = myNoise.getValue(startTime, endTime, generatorInput[i]);
      }
    }

    myCurrent = new TimeSeries1DImpl(current.getTimes(), generatorInput, Units.UNK);

    mySpikeOrigin.run(myCurrent.getTimes(), generatorInput);
    myCurrentOrigin.setValues(startTime, endTime, new float[]{myUnscaledCurrent});
  }
View Full Code Here

      if (output instanceof RealOutput) {
        rate = ((RealOutput) output).getValues()[0];
      } else if (output instanceof SpikeOutput) {
        rate = ((SpikeOutput) output).getValues()[0] ? 1/(times[times.length-1]-times[0]) : 0;
      }
      result = new TimeSeries1DImpl(new float[]{times[times.length-1]}, new float[]{rate}, Units.SPIKES_PER_S);
    } else if (stateName.equals(CURRENT)) {
      float[] times = myCurrent.getTimes();
      result = new TimeSeries1DImpl(new float[]{times[times.length-1]}, new float[]{myUnscaledCurrent}, Units.ACU);
    } else if (myGenerator instanceof Probeable) {
      result = ((Probeable) myGenerator).getHistory(stateName);
    } else {
      throw new SimulationException("The state " + stateName + " is unknown");
    }
View Full Code Here

      float rate = myConstantRateFunction.map(new float[]{current[current.length-1]});
      return new RealOutputImpl(new float[]{rate}, Units.SPIKES_PER_S, time[time.length-1]);
    } else {
      boolean spike = false;

      myDynamicsOutput = myIntegrator.integrate(myDynamics, new TimeSeries1DImpl(time, current, Units.uAcm2));
      float[][] values = myDynamicsOutput.getValues();

      for (int i = 0; i < values.length && !spike; i++) {
        if (values[i][myVDim] >= mySpikeThreshold) {
          boolean crossingThreshold = i > 0 && values[i-1][myVDim] < mySpikeThreshold;
View Full Code Here

   */
  public GruberSpikeGenerator() {
    myDynamics = new GruberDynamics(ourResetPotential);
    myIntegrator = new RK45Integrator();
    myLastSpikeTime = -1;
    myMembranePotentialHistory = new TimeSeries1DImpl(new float[]{0}, new float[]{0}, Units.mV);
    mySteadyStateVmFunction = getSteadyStateVmFunction();

    myMode = SimulationMode.DEFAULT;
    mySupportedModes = new SimulationMode[]{SimulationMode.DEFAULT, SimulationMode.RATE, SimulationMode.CONSTANT_RATE};
  }
View Full Code Here

      float rate = 0;
      if (Vm > Vf) {
                rate = 1f / getRefreactoryTime(Vm);
            }

      myMembranePotentialHistory = new TimeSeries1DImpl(new float[]{time[0]}, new float[]{Vm}, Units.mV);
      result = new RealOutputImpl(new float[]{rate}, Units.SPIKES_PER_S, time[time.length-1]);
    } else {
      float[][] input = new float[current.length][];
      for (int i = 0; i < input.length; i++) {
        input[i] = new float[]{current[i], myDopamine};
View Full Code Here

   * Test method for {@link ca.nengo.math.impl.TimeSeriesFunction#map(float[])}.
   * @throws StructuralException
   */
  public void testMap() throws StructuralException {
    //this is code that was giving Lloyd some trouble (not really a unit test) ...
    TimeSeries ts = new TimeSeries1DImpl(new float[]{ 0.0f, 0.5f, 1.0f},
        new float[]{0.0f, 0.5f, 1.0f}, Units.UNK);
    Function f = new TimeSeriesFunction(ts , 0);
//    FunctionInput input = new FunctionInput("input", new Function[]{f}, Units.UNK);

    //now for a little test
View Full Code Here

      }
      TestUtil.assertClose(approx, target.map(evalPoints[j]), 0.0001f);
    }
   
    //testing with eval signals
    TimeSeries1DImpl targetsig = (TimeSeries1DImpl)TimeSeriesFunction.makeSeries(new FourierFunction(frequencies, amplitudes, phases), 0.0f, 0.001f, 1.0f, Units.UNK);
    float[] times = targetsig.getTimes();
    float[][][] valuesig = new float[frequencies.length][1][];
    for (int i = 0; i < frequencies.length; i++) {
      Function component = new FourierFunction(new float[]{frequencies[i]}, new float[]{1}, new float[]{phases[i]});
      valuesig[i][0] = new float[times.length];
      for (int j = 0; j < times.length; j++) {
        valuesig[i][0][j] = component.map(new float[]{times[j]});
      }
    }
    float[][][] evalsigs = new float[1][1][];
    evalsigs[0][0] = times;
    factory = new WeightedCostApproximator.Factory(0f);
    WeightedCostApproximator approximator2 = (WeightedCostApproximator)factory.getApproximator(evalsigs, valuesig);
    coefficients = approximator2.findCoefficients(MU.transpose(targetsig.getValues())[0]);
   
    float[] approxsig = new float[times.length];
    for (int j = 0; j < times.length; j++) {
      approxsig[j] = 0f;
      for (int i = 0; i < frequencies.length; i++) {
        approxsig[j] += coefficients[i] * valuesig[i][0][j];
      }
    }
   
    TestUtil.assertClose(0.0f, MU.sum(MU.difference(approxsig,targetsig.getValues1D())), 0.0001f);
   
   
  }
View Full Code Here

    float[] values = new float[steps];
    for (int i = 0; i < steps; i++) {
      times[i] = start + i * increment;
      values[i] = function.map(new float[]{times[i]});
    }
    return new TimeSeries1DImpl(times, values, units);
  }
View Full Code Here

        times[i] = startTime + i * dt;
        currents[i] = update(myTerminations.values(), false, dt, dt);
      }
    }

    return new TimeSeries1DImpl(times, currents, myCurrentUnits);
  }
View Full Code Here

TOP

Related Classes of ca.nengo.util.impl.TimeSeries1DImpl

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.