Package ca.nengo.model

Examples of ca.nengo.model.Termination


  }

  public void testAdaptation() throws StructuralException, SimulationException {
    NetworkImpl network = new NetworkImpl();
    LinearSynapticIntegrator integrator = new LinearSynapticIntegrator(.001f, Units.ACU);
    Termination t = integrator.addTermination("input", new float[]{1}, .005f, false);
    ALIFSpikeGenerator generator = new ALIFSpikeGenerator(.0005f, .02f, .2f, .05f);
    SpikingNeuron neuron = new SpikingNeuron(integrator, generator, 2, 5, "neuron");
    network.addNode(neuron);

    Function f = new PiecewiseConstantFunction(new float[]{1, 2}, new float[]{0, 1, -1});
View Full Code Here


        originNodeFullName.append(tempOrigin.getNode().getName() + ".");
        tempOrigin = ((OriginWrapper) tempOrigin).getWrappedOrigin();
      }
     
      StringBuilder terminationNodeFullName = new StringBuilder();
      Termination tempTermination = myTermination;

      while(tempTermination instanceof TerminationWrapper)
      {
        terminationNodeFullName.append(tempTermination.getNode().getName() + ".");
        tempTermination = ((TerminationWrapper) tempTermination).getWrappedTermination();
      }
     
      DecodedTermination dTermination;
      StringBuilder transformString = new StringBuilder();
     
      transformString.append('[');
      if(tempTermination instanceof DecodedTermination)
      {
        dTermination = (DecodedTermination) tempTermination;
        transformString.append(getTransformScript(dTermination, "transform = ".length()));
        terminationNodeFullName.append(tempTermination.getNode().getName());
      }
      else if(tempTermination instanceof EnsembleTermination &&
          tempTermination.getNode() instanceof NetworkArrayImpl)
      {
        terminationNodeFullName.deleteCharAt(terminationNodeFullName.length()-1);
       
        boolean first = true;
        for(Node node : tempTermination.getNode().getChildren())
        {
          if(first)
          {
            first = false;
          }else {
            transformString.append(",\n" + new String(new char["transform = ".length() + 1]).replace("\0", " "));
          }
         
          // this relies on the decoded terminations in the child nodes having the
          // same name as the ensemble termination that contains them
          try{
            dTermination = (DecodedTermination) node.getTermination(tempTermination.getName());
          }catch(Exception e){
            dTermination = null;
          }
         
          transformString.append(getTransformScript(dTermination, "transform = ".length() + 1));
View Full Code Here

   * Test method for 'ca.bpt.cn.model.impl.NetworkImpl.getProjections()'
   */
  public void testGetProjections() throws StructuralException {
    Origin o1 = new ProjectionImplTest.MockOrigin("o1", 1);
    Origin o2 = new ProjectionImplTest.MockOrigin("o2", 1);
    Termination t1 = new ProjectionImplTest.MockTermination("t1", 1);
    Termination t2 = new ProjectionImplTest.MockTermination("t2", 1);
    Termination t3 = new ProjectionImplTest.MockTermination("t3", 2);

    myNetwork.addProjection(o1, t1);
    myNetwork.addProjection(o1, t2);

    assertEquals(2, myNetwork.getProjections().length);
View Full Code Here

    float I = 4;
   
    LinearSynapticIntegrator integrator = new LinearSynapticIntegrator();
    IzhikevichSpikeGenerator generator = new IzhikevichSpikeGenerator(IzhikevichSpikeGenerator.Preset.REGULAR_SPIKING);
    ExpandableSpikingNeuron neuron = new ExpandableSpikingNeuron(integrator, generator, 1, 0, "neuron");   
    Termination t = neuron.addTermination("input", MU.I(1), .001f, false);
   
    FunctionInput input = new FunctionInput("input", new Function[]{new ConstantFunction(1, I)}, Units.UNK);
   
    Network network = new NetworkImpl();
    network.addNode(input);
View Full Code Here

     * @throws StructuralException if named Termination does not exist
     * @see ca.nengo.model.ExpandableNode#removeTermination(java.lang.String)
     */
    public synchronized Termination removeTermination(String name) throws StructuralException {
        if (myTerminations.containsKey(name)) {
            Termination result = myTerminations.remove(name);

            fireVisibleChangeEvent();
            return result;
        }

View Full Code Here

    int count=0;
    for(int i=0; i < myNumNodes; i++) {
      for(int j=0; j < index.length; j++) {
        if(index[j] == i) {
          Termination t = myNodes[i].addTermination(name, MU.copy(matrix,count*myNodes[i].getNeurons(),0,myNodes[i].getNeurons(),-1),
              tauPSC, isModulatory);
          count++;
          terminations.add(t);
          break;
        }
View Full Code Here

      for (Origin exposedOrigin : getOrigins()) {
        Origin clonedOrigin = ((OriginWrapper) exposedOrigin).getBaseOrigin().clone(result);
        result.exposeOrigin(clonedOrigin, exposedOrigin.getName());
      }
      for (Termination exposedTermination : getTerminations()) {
        Termination clonedTermination = ((TerminationWrapper) exposedTermination).getBaseTermination().clone(result);
        result.exposeTermination(clonedTermination, exposedTermination.getName());
      }
     
      return result;
    }
View Full Code Here

   * @see ca.nengo.model.ExpandableNode#removeTermination(java.lang.String)
   */
  @Override
    public synchronized Termination removeTermination(String name) throws StructuralException {
    if (myExpandedTerminations.containsKey(name)) {
        Termination result = myExpandedTerminations.remove(name);
      for (ExpandableNode myExpandableNode : myExpandableNodes) {
        myExpandableNode.removeTermination(name);
      }

      fireVisibleChangeEvent();
View Full Code Here

    // uiViewer.addNeoNode(uiInput);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble integrator = ef.make("integrator", 500, 1, "integrator1", false);
    Termination interm = integrator.addDecodedTermination("input",
        new float[][] { new float[] { tau } }, tau, false);
    Termination fbterm = integrator.addDecodedTermination("feedback",
        new float[][] { new float[] { 1f } }, tau, false);

    network.addNode(integrator);
    Thread.sleep(1000);
    network.addNode(input);
View Full Code Here

    // uiViewer.addNeoNode(uiInput);

    NEFEnsembleFactory ef = new NEFEnsembleFactoryImpl();
    NEFEnsemble integrator = ef.make("integrator", 500, 1, "integrator1",
        false);
    Termination interm = integrator.addDecodedTermination("input",
        new float[][] { new float[] { tau } }, tau, false);
    Termination fbterm = integrator.addDecodedTermination("feedback",
        new float[][] { new float[] { 1f } }, tau, false);

    network.addNode(integrator);
    Thread.sleep(1000);
    network.addNode(input);
View Full Code Here

TOP

Related Classes of ca.nengo.model.Termination

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.