Package ca.nengo.model.impl

Examples of ca.nengo.model.impl.RealOutputImpl


  private RealOutput myRealOutput;
 
  protected void setUp() throws Exception {
    super.setUp();
   
    myRealOutput = new RealOutputImpl(new float[]{1f}, Units.SPIKES_PER_S, 0);
  }
View Full Code Here


   */
  public InstantaneousOutput run(float[] time, float[] current) {
    InstantaneousOutput result = null;

    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)) {
      float totalTimeSpan = time[time.length-1] - time[0];
      float ratePerSecond = myRateFunction.map(new float[]{MU.mean(current)});
      float ratePerStep = totalTimeSpan * ratePerSecond;
      float numSpikes = new PoissonPDF(ratePerStep).sample()[0];

      result = new RealOutputImpl(new float[]{numSpikes / totalTimeSpan}, Units.SPIKES_PER_S, time[time.length-1]);
    } else {
      boolean spike = false;
      for (int i = 0; i < time.length - 1 && !spike; i++) {
        float timeSpan = time[i+1] - time[i];

View Full Code Here

    if ( !(values instanceof RealOutput) ) {
      throw new SimulationException("Only real-valued input is accepted at a DecodedTermination");
    }

    RealOutput ro = (RealOutput) values;
    myInputValues = new RealOutputImpl(MU.sum(ro.getValues(), myStaticBias), ro.getUnits(), ro.getTime());

    if (!myValuesSet) {
            myValuesSet = true;
        }
  }
View Full Code Here

      setDynamics(myOutputDimension);
    }

    if (!myValuesSet) {
      ourLogger.warn("Input values not set on termination " + myName + ".  Assuming input of zero.");
      setValues(new RealOutputImpl(new float[getDimensions()], Units.UNK, 0.0f));
    }

    float[][] transform = getTransform();
    if (myScalingTermination != null) {
      float scale = myScalingTermination.getOutput()[0];
View Full Code Here

  /**
   * @see ca.nengo.model.Resettable#reset(boolean)
   */
  public void reset(boolean randomize) {
    resetInitialState();
    myInputValues = new RealOutputImpl(new float[getDimensions()], Units.UNK, 0);
    myValuesSet = false;
  }
View Full Code Here

                    if (pet instanceof ModulatedPlasticEnsembleTermination) {
                        DecodedTermination modTerm = (DecodedTermination)
                            this.getTermination(((ModulatedPlasticEnsembleTermination) pet).getModTermName());

                        InstantaneousOutput input = new RealOutputImpl(modTerm.getOutput(), Units.UNK, endTime);
                        ((ModulatedPlasticEnsembleTermination) pet).setModTerminationState
                          (modTerm.getName(), input, endTime);
                    }
                }
                catch (StructuralException e) {
View Full Code Here

    {
      float spikeRate = 0f;
      if(spiking)
        spikeRate = 1f/(time[time.length-1] - time[0]);
      mySpikeRate = mySpikeRate*0.99f + spikeRate*0.01f; //using a moving average (this is fairly ad-hoc)
      return new RealOutputImpl(new float[]{mySpikeRate}, Units.SPIKES_PER_S, time[time.length-1]);
    }
    else
      return new SpikeOutputImpl(new boolean[]{spiking}, Units.SPIKES, time[time.length-1]);
  }
View Full Code Here

    } else if (myMode.equals(SimulationMode.RATE)) {
      float rate = I > 1 ? 1f / ( myTauRef - myTauRC * ((float) Math.log(1f - 1f/I)) ) : 0;
      myN += (rate * dt) * myIncN; //analog of # spikes X increment

      myRateHistory = new float[]{rate};
      result = new RealOutputImpl(new float[]{rate}, Units.SPIKES_PER_S, time[time.length-1]);
    } else {
      float rate = I_in > 1 ? 1f / ( myTauRef - myTauRC * ((float) Math.log(1f - 1f/I_in)) ) : 0;

      myRateHistory = new float[]{rate};
      result = new RealOutputImpl(new float[]{rate}, Units.SPIKES_PER_S, time[time.length-1]);
    }

    myTime = new float[]{time[time.length-1]};
    myNHistory = new float[]{myN};
    myVHistory = new float[]{myV};
View Full Code Here

  /**
   * @see ca.nengo.model.Resettable#reset(boolean)
   */
  public void reset(boolean randomize) {
    float time = (myOutput == null) ? 0 : myOutput.getTime();
    myOutput = new RealOutputImpl(new float[myFunctions.length], Units.UNK, time);

    if (myNoise != null) {
            myNoise.reset(randomize);
        }
    if (myNoises != null) {
View Full Code Here

        values[i] = myNoises[i].getValue(startTime, endTime, values[i]);
      }
    }

    myTime = endTime;
    myOutput = new RealOutputImpl(values, Units.UNK, endTime);
  }
View Full Code Here

TOP

Related Classes of ca.nengo.model.impl.RealOutputImpl

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.