Пример #1
0
 /**
  * Helper method for making neuron group vector consumers, since it happens in a few different
  * places and is important to be consistent about.
  *
  * @param component network component
  * @param group the group that will "consume" activations
  * @param methodName the name of the method called by this consumer
  * @return the neuron group consumer
  */
 public static PotentialConsumer getNeuronGroupConsumer(
     NetworkComponent component, NeuronGroup group, String methodName) {
   PotentialConsumer consumer =
       component.getAttributeManager().createPotentialConsumer(group, methodName, double[].class);
   consumer.setCustomDescription(group.getId() + ":" + methodName);
   return consumer;
 }
Пример #2
0
 /**
  * Helper method for making synapse consumers, 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 "consume" strengths
  * @param methodName the name of the method called by this consumer
  * @return the synapse consumer
  */
 public static PotentialConsumer getSynapseConsumer(
     NetworkComponent component, Synapse synapse, String methodName) {
   PotentialConsumer consumer =
       component.getAttributeManager().createPotentialConsumer(synapse, methodName, double.class);
   consumer.setCustomDescription(synapse.getId() + ":" + methodName);
   return consumer;
 }
Пример #3
0
 @Override
 public List<PotentialConsumer> getPotentialConsumers() {
   List<PotentialConsumer> returnList = new ArrayList<PotentialConsumer>();
   for (AttributeType type : getVisibleConsumerTypes()) {
     if (type.getTypeName().startsWith("Neuron ")) {
       if (type.getTypeName().equalsIgnoreCase("Neuron Input Value")) {
         for (Neuron neuron : network.getFlatNeuronList()) {
           returnList.add(getNeuronConsumer(this, neuron, type.getMethodName()));
         }
       } else {
         for (Neuron neuron : network.getFlatNeuronList()) {
           String description = type.getDescription(neuron.getId());
           PotentialConsumer consumer =
               getAttributeManager().createPotentialConsumer(neuron, type);
           consumer.setCustomDescription(description);
           returnList.add(consumer);
         }
       }
     } else if (type.getTypeName().equalsIgnoreCase("Synapse")) {
       for (Synapse synapse : network.getFlatSynapseList()) {
         String description = type.getDescription(synapse.getId());
         PotentialConsumer consumer = getAttributeManager().createPotentialConsumer(synapse, type);
         consumer.setCustomDescription(description);
         returnList.add(consumer);
       }
     } else if (type.getTypeName().equalsIgnoreCase("NeuronGroup")) {
       // Handle NeuronGroup attributes
       for (Group group : network.getFlatGroupList()) {
         if (group instanceof NeuronGroup) {
           PotentialConsumer consumer =
               getNeuronGroupConsumer(this, (NeuronGroup) group, type.getMethodName());
           returnList.add(consumer);
         }
       }
     } else if (type.getTypeName().equalsIgnoreCase("SynapseGroup")) {
       // Handle SynapseGroup attributes
       for (Group group : network.getFlatGroupList()) {
         if (group instanceof SynapseGroup) {
           PotentialConsumer consumer =
               getAttributeManager()
                   .createPotentialConsumer(group, "setWeightVector", double[].class);
           consumer.setCustomDescription("Synapse Group: " + group.getLabel());
           returnList.add(consumer);
         }
       }
     }
   }
   return returnList;
 }