コード例 #1
0
 /**
  * Helper method for making synapse producers, since it happens in a few different places and is
  * important to be consistent about.
  *
  * @param component network component
  * @param synapse the synapse that will "produce" strengths
  * @param methodName the name of the method called by this producer
  * @return the synapse producer
  */
 public static PotentialProducer getSynapseProducer(
     NetworkComponent component, Synapse synapse, String methodName) {
   PotentialProducer producer =
       component.getAttributeManager().createPotentialProducer(synapse, methodName, double.class);
   producer.setCustomDescription(synapse.getId() + ":" + methodName);
   return producer;
 }
コード例 #2
0
  @Override
  public List<PotentialProducer> getPotentialProducers() {
    List<PotentialProducer> returnList = new ArrayList<PotentialProducer>();
    for (AttributeType type : getVisibleProducerTypes()) {
      if (type.getTypeName().startsWith("Neuron ")) {
        if (type.getTypeName().equalsIgnoreCase("Neuron Activation")) {
          for (Neuron neuron : network.getFlatNeuronList()) {
            returnList.add(getNeuronProducer(this, neuron, type.getMethodName()));
          }
        } else {
          for (Neuron neuron : network.getFlatNeuronList()) {
            String description = type.getDescription(neuron.getId());
            PotentialProducer producer =
                getAttributeManager().createPotentialProducer(neuron, type);
            producer.setCustomDescription(description);
            returnList.add(producer);
          }
        }
      } else if (type.getTypeName().equalsIgnoreCase("Synapse")) {
        for (Synapse synapse : network.getFlatSynapseList()) {
          String description = type.getDescription(synapse.getId());
          PotentialProducer producer = getAttributeManager().createPotentialProducer(synapse, type);
          producer.setCustomDescription(description);
          returnList.add(producer);
        }
      } else if (type.getTypeName().equalsIgnoreCase("NeuronGroupActivations")) {
        for (Group group : network.getFlatGroupList()) {
          if (group instanceof NeuronGroup) {
            returnList.add(getNeuronGroupProducer(this, (NeuronGroup) group, type.getMethodName()));
          }
        }
      } else if (type.getTypeName().equalsIgnoreCase("NeuronGroupSpikes")) {
        for (Group group : network.getFlatGroupList()) {
          if (group instanceof NeuronGroup) {
            returnList.add(getNeuronGroupProducer(this, (NeuronGroup) group, type.getMethodName()));
          }
        }
      } else if (type.getTypeName().equalsIgnoreCase("SynapseGroup")) {
        // Handle SynapseGroup attributes
        for (Group group : network.getFlatGroupList()) {
          if (group instanceof SynapseGroup) {
            PotentialProducer producer =
                getAttributeManager()
                    .createPotentialProducer(group, "getWeightVector", double[].class);
            producer.setCustomDescription("Synapse Group: " + group.getLabel());
            returnList.add(producer);
          }
        }
      }
    }

    return returnList;
  }