Package ca.nengo.model

Examples of ca.nengo.model.InstantaneousOutput


     
        if(myNodeThreadPool != null){
            myNodeThreadPool.step(startTime, endTime);
        }else{
            for (Projection myProjection : myProjections) {
                InstantaneousOutput values = myProjection.getOrigin().getValues();
                myProjection.getTermination().setValues(values);
            }

            for (Node myNode : myNodes) {
                if(myNode instanceof NetworkImpl) {
View Full Code Here


  public TimeSeries getHistory(String stateName) throws SimulationException {
    TimeSeries result = null;
    if (stateName.equals("I")) {
      result = myCurrent;
    } else if (stateName.equals("rate")) {
      InstantaneousOutput output = mySpikeOrigin.getValues();
      float[] times = myCurrent.getTimes();
      float rate = 0;
      if (output instanceof RealOutput) {
        rate = ((RealOutput) output).getValues()[0];
      } else if (output instanceof SpikeOutput) {
View Full Code Here

    } else {
      float[] values = new float[myDimension];
      Iterator<PassthroughTermination> it = myTerminations.values().iterator();
      while (it.hasNext()) {
        PassthroughTermination termination = it.next();
        InstantaneousOutput io = termination.getValues();
        if (io instanceof RealOutput) {
          values = MU.sum(values, ((RealOutput) io).getValues());
        } else if (io instanceof SpikeOutput) {
          boolean[] spikes = ((SpikeOutput) io).getValues();
          for (int i = 0; i < spikes.length; i++) {
            if (spikes[i]) {
                            values[i] += 1f/(endTime - startTime);
                        }
          }
        } else if (io == null) {
          throw new SimulationException("Null input to Termination " + termination.getName());
        } else {
          throw new SimulationException("Output type unknown: " + io.getClass().getName());
        }
      }
      myOrigin.setValues(new RealOutputImpl(values, Units.UNK, endTime));
    }
  }
View Full Code Here

    /**
     * @see ca.nengo.model.neuron.SpikeGenerator#run(float[], float[])
     */
    public InstantaneousOutput run(float[] time, float[] current) {
        InstantaneousOutput result = null;

        //calculates rate as a function of current
        if (myMode.equals(SimulationMode.CONSTANT_RATE)) {
            result = new RealOutputImpl(new float[]{myRateFunction.map(new float[]{current[0]})}, Units.SPIKES_PER_S, time[time.length-1]);
        } else if (myMode.equals(SimulationMode.RATE)) {
View Full Code Here

  /**
   * @see ca.nengo.model.neuron.SpikeGenerator#run(float[], float[])
   */
  public InstantaneousOutput run(float[] time, float[] current) {
    InstantaneousOutput result = null;

    if (myMode.equals(SimulationMode.CONSTANT_RATE)) {
      float Vm = mySteadyStateVmFunction.map(new float[]{current[0]});

      float rate = 0;
View Full Code Here

  public void testRun() throws StructuralException, SimulationException {
    myIntegrator.addTermination("test", new float[]{1}, .005f, false);
    myIntegrator.getTerminations()[0].setValues(new RealOutputImpl(new float[]{5}, Units.SPIKES_PER_S, 0));
   
    myNeuron.run(0, .005f);
    InstantaneousOutput output = myNeuron.getOrigins()[0].getValues();
    assertTrue(output instanceof SpikeOutput);
    assertTrue(((SpikeOutput) output).getValues()[0] == false);
   
    myNeuron.run(0, .005f);
    output = myNeuron.getOrigins()[0].getValues();
View Full Code Here

    for (int i = 0; i < myNodes.length; i++) {
      myNodes[i].run(startTime, endTime);

      if (myCollectSpikesFlag && (myCollectSpikesRatio == 1 || i % myCollectSpikesRatio == 0)) {
        try {
          InstantaneousOutput output = myNodes[i].getOrigin(Neuron.AXON).getValues();
          if (output instanceof PreciseSpikeOutput) {
            PreciseSpikeOutput precise=((PreciseSpikeOutput) output);
            if (precise.getValues()[0]) {
              mySpikePattern.addSpike(i, endTime+precise.getSpikeTimes()[0]);
            }
View Full Code Here

    }

    public void setTerminationState(float time) throws StructuralException {
        if (myLastTime >= time) { return; }

        InstantaneousOutput state = this.getInput();
        if (state == null) {
            if (myInput != null) {
                Arrays.fill(myInput, 0.0f);
            }
            if (myFilteredInput != null) {
                Arrays.fill(myFilteredInput, 0.0f);
            }
            return;
        }

        float integrationTime = 0.001f;
        if (myInput == null) {
            myInput = new float[state.getDimension()];
        }
        updateRaw(myInput, state, integrationTime);

        float tauPSC = getNodeTerminations()[0].getTau();
        if (myFilteredInput == null) {
            myFilteredInput = new float[state.getDimension()];
        }
        updateFiltered(myInput, myFilteredInput, tauPSC, integrationTime);
        myLastTime = time;
    }
View Full Code Here

          myInSpiking[i] = false;
        }
    }

    private void updateInput() {
        InstantaneousOutput input = this.getInput();
        myInSpiking = ((SpikeOutput) input).getValues();
    }
View Full Code Here

        updateHistory(myPostSpiking, myPostSpikeHistory, (SpikeOutput)state, time);
    }

    private void updateInput(float time) throws StructuralException {
        InstantaneousOutput input = this.getInput();

        if (!(input instanceof SpikeOutput)) {
            throw new StructuralException("Termination must be Spiking in STDPTermination");
        }
View Full Code Here

TOP

Related Classes of ca.nengo.model.InstantaneousOutput

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.