Package ca.nengo.model

Examples of ca.nengo.model.Termination


        for (UINeoNode nodeUI : getUINodes()) {
            for (UITermination terminationUI : nodeUI.getVisibleTerminations()) {
                if (terminationUI.getConnector() != null) {
                    UIOrigin originUI = terminationUI.getConnector().getOriginUI();

                    Termination termination = terminationUI.getModel();
                    Origin origin = originUI.getModel();

                    Projection projection = projectionMap.get(termination);
                    if (projection != null && projection.getOrigin() == origin) {
                        /*
                         * Projection already exists
                         */
                        projectionsToAdd.remove(projectionMap.get(termination));

                    } else {
                        projectionsToRemove.add(terminationUI.getConnector());
                    }
                }
            }
        }

        /*
         * Destroy unreferenced projections
         */
        for (UIProjection projectionUI : projectionsToRemove) {
            UITermination terminationUI = projectionUI.getTermination();

            projectionUI.destroy();
            if (!isFirstUpdate) {
                terminationUI.showPopupMessage("REMOVED Projection to "
                        + terminationUI.getNodeParent().getName() + "." + terminationUI.getName());
            }
        }

        /*
         * Construct projections
         */
        for (Projection projection : projectionsToAdd) {
            Origin origin = projection.getOrigin();
            Termination term = projection.getTermination();

            UINeoNode nodeOrigin = getUINode(origin.getNode());

            UINeoNode nodeTerm = getUINode(term.getNode());

            if (nodeOrigin != null && nodeTerm != null) {
                UIOrigin originUI = nodeOrigin.showOrigin(origin.getName());
                UITermination termUI = nodeTerm.showTermination(term.getName());

                originUI.connectTo(termUI, false);
                if (!isFirstUpdate) {
                    termUI.showPopupMessage("NEW Projection to " + termUI.getName() + "."
                            + getName());
                }
            } else {
                if (nodeOrigin == null) {
                    Util.Assert(false, "Could not find a Origin attached to a projection: "
                            + origin.getNode().getName());
                }
                if (nodeTerm == null) {
                    Util.Assert(false, "Could not find a Termination attached to a projection: "
                            + term.getNode().getName());
                }
            }

        }

View Full Code Here


  @Override
  protected Object createModel(ConfigResult configuredProperties, String uniqueName) throws ConfigException {
       

    Termination term = null;
    try {
      term = nefEnsembleParent.addDecodedTermination(uniqueName,
          (float[][]) configuredProperties.getValue(pTransformMatrix), (Float) configuredProperties
              .getValue(pTauPSC), (Boolean) configuredProperties.getValue(pIsModulatory));
View Full Code Here

   * @return PTermination created, null if not
   */
  public UITermination addDecodedTermination() {

    try {
      Termination term = (Termination) ModelFactory.constructModel(this,
          new CDecodedTermination(getModel()));

      UITermination termUI = UITermination.createTerminationUI(this, term);
      showPopupMessage("New decoded TERMINATION added");
      addWidget(termUI);
View Full Code Here

    }

    if (origin != null) {
      probeHolder = showOrigin(origin.getName());
    } else if (origin == null) {
      Termination term = null;
      try {
        term = getModel().getTermination(probeUI.getName());

      } catch (StructuralException e) {
      }
      if (term != null) {
                probeHolder = showTermination(term.getName());
            }
    }

    if (probeHolder != null) {
      probeUI.setOffset(0, probeHolder.getHeight() / 2);
View Full Code Here

    termUI = (UITermination) getChild(terminationName, UITermination.class);
    if (termUI == null) {
      // Otherwise try to create it
      try {

        Termination termModel = getModel().getTermination(terminationName);
        if (termModel != null) {
          termUI = UITermination.createTerminationUI(this, termModel);
          addWidget(termUI);
        } else {
          Util.Assert(false, "Could not find termination: " + terminationName);
View Full Code Here

      super(name, Arrays.asList(origins), Arrays.asList(terminations));
      myExpandedTerminations = new LinkedHashMap<String, Termination>(10);
    }

    public Termination addTermination(String name, float[][] weights, float tauPSC, boolean modulatory) throws StructuralException {
      Termination result = new BasicTermination(this, new SimpleLTISystem(1, 1, 1), null, name);
      myExpandedTerminations.put(name, result);
      return result;
    }
View Full Code Here

     
      inputOnGPU[i] = new boolean[networkArrayTerminations.length];
      outputRequiredOnCPU[i] = new int[networkArrayOrigins.length];
     
      for(j = 0; j < networkArrayTerminations.length; j++){
        Termination termination = networkArrayTerminations[j];
        boolean terminationWrapped = termination instanceof TerminationWrapper;
        if(terminationWrapped)
          termination = ((TerminationWrapper) termination).getBaseTermination();
       
        k = 0;
        boolean projectionMatches = false;
       
        while(!projectionMatches && k < myGPUProjections.length){
          Termination projectionTermination = myGPUProjections[k].getTermination();
          boolean projectionTerminationWrapped = projectionTermination instanceof TerminationWrapper;
          if(projectionTerminationWrapped)
            projectionTermination = ((TerminationWrapper) projectionTermination).getBaseTermination();
         
          projectionMatches = termination == projectionTermination;
View Full Code Here

   */
  public void testReset() throws StructuralException, SimulationException {
    ExpandableSynapticIntegrator si = new LinearSynapticIntegrator(.001f, Units.ACU);
    si.addTermination("test", new float[]{1f}, 1f, false);
   
    Termination t = si.getTerminations()[0];
    t.setValues(new SpikeOutputImpl(new boolean[]{true}, Units.SPIKES, 0));   
    for (int i = 0; i < 10; i++) {
      si.run(.001f * ((float) i), .001f * ((float) i+1));     
      t.setValues(new SpikeOutputImpl(new boolean[]{false}, Units.SPIKES, 0));
    }
    TimeSeries1D current = si.run(.010f, .011f);
    assertTrue(current.getValues()[1][0] > .9f);
   
    si.reset(false); //there is no random setting to test
View Full Code Here

    Plotter.plot(integrator);
    Plotter.plot(integrator, NEFEnsemble.X);
   
    float tau = .05f;
   
    Termination interm = integrator.addDecodedTermination("input", new float[][]{new float[]{tau}}, tau, false);
//    Termination interm = integrator.addDecodedTermination("input", new float[][]{new float[]{1f}}, tau);
    network.addProjection(input.getOrigin(FunctionInput.ORIGIN_NAME), interm);
   
    Termination fbterm = integrator.addDecodedTermination("feedback", new float[][]{new float[]{1f}}, tau, false);
    network.addProjection(integrator.getOrigin(NEFEnsemble.X), fbterm);
   
    //System.out.println("Network creation: " + (System.currentTimeMillis() - start));
    return network;
  }
View Full Code Here

      nodeToVertex.put(node, vertex);
    }
 
    for(Projection proj : projections){
     
      Termination projectionTermination = proj.getTermination();
      boolean projectionTerminationWrapped = projectionTermination instanceof TerminationWrapper;
      if(projectionTerminationWrapped)
        projectionTermination = ((TerminationWrapper) projectionTermination).getBaseTermination();
     
      Node terminationNode = projectionTermination.getNode();

      Origin projectionOrigin = proj.getOrigin();
      boolean projectionOriginWrapped = projectionOrigin instanceof OriginWrapper;
     
      if(projectionOriginWrapped)
        projectionOrigin = ((OriginWrapper) projectionOrigin).getWrappedOrigin();
     
      Node originNode = projectionOrigin.getNode();
     
      //Don't add self loops, since they are irrelevant to the min-cut computation
      //(and it allows us to use a SimpleWeightedGraph object).
      if(originNode != terminationNode){
        NodeVertex terminationVertex = nodeToVertex.get(terminationNode)
        NodeVertex originVertex = nodeToVertex.get(originNode)
       
        DefaultWeightedEdge edge = networkGraph.addEdge(originVertex, terminationVertex);
        int edgeWeight = projectionTermination.getDimensions();
       
        if(edge != null){
          networkGraph.setEdgeWeight(edge, (double)edgeWeight);
        }else{
          edge = networkGraph.getEdge(originVertex, terminationVertex);
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.