int ResetStateOnTriggerTestProbe::outputState(double timevalue) {
   getValues(timevalue); // calls calcValues
   if (parent->columnId()!=0) { return PV_SUCCESS; }
   if (probeStatus != 0) {
      int nBatch = getNumValues();
      if (nBatch==1) {
         int nnz = (int) nearbyint(getValuesBuffer()[0]);
         fprintf(outputstream->fp, "%s t=%f, %d neuron%s the wrong value.\n",
               getMessage(), timevalue, nnz, nnz==1 ? " has" : "s have");
      }
      else {
         for (int k=0; k<nBatch; k++) {
            int nnz = (int) nearbyint(getValuesBuffer()[k]);
            fprintf(outputstream->fp, "%s t=%f, batch element %d, %d neuron%s the wrong value.\n",
                  getMessage(), timevalue, k, nnz, nnz==1 ? " has" : "s have");
         }
      }
   }
   return PV_SUCCESS;
}
Exemple #2
0
int L2NormProbe::calcValues(double timevalue) {
   int status = AbstractNormProbe::calcValues(timevalue);
   if (status != PV_SUCCESS) { return status; }
   if (exponent != 2.0) {
      double * valBuf = getValuesBuffer();
      int numVals = this->getNumValues();
      for (int b=0; b<numVals; b++) {
         double v = valBuf[b];
         valBuf[b] = pow(v, exponent/2.0);
      }
   }
   return PV_SUCCESS;
}
int ResetStateOnTriggerTestProbe::calcValues(double timevalue) {
   int nBatch = getNumValues();
   if (timevalue > parent->getStartTime()) {
      int N = targetLayer->getNumNeurons();
      int NGlobal = targetLayer->getNumGlobalNeurons();
      PVLayerLoc const * loc = targetLayer->getLayerLoc();
      PVHalo const * halo = &loc->halo;
      int inttime = (int) nearbyintf(timevalue/parent->getDeltaTime());
      for (int b=0; b<nBatch; b++) {
         int numDiscreps = 0;
         pvadata_t const * activity = targetLayer->getLayerData() + b*targetLayer->getNumExtended();
         for (int k=0; k<N; k++) {
            int kex = kIndexExtended(k, loc->nx, loc->ny, loc->nf, halo->lt, halo->rt, halo->dn, halo->up);
            pvadata_t a = activity[kex];
            int kGlobal = globalIndexFromLocal(k, *loc);
            int correctValue = 4*kGlobal*((inttime + 4)%5+1) + (kGlobal==((((inttime-1)/5)*5)+1)%NGlobal);
            if ( a != (pvadata_t) correctValue ) { numDiscreps++; }
         }
         getValuesBuffer()[b] = (double) numDiscreps;
      }
      MPI_Allreduce(MPI_IN_PLACE, getValuesBuffer(), nBatch, MPI_DOUBLE, MPI_SUM, parent->icCommunicator()->communicator());
      if (probeStatus==0) {
         for (int k=0; k<nBatch; k++) {
            if (getValuesBuffer()[k]) {
               probeStatus = 1;
               firstFailureTime = timevalue;
            }
         }
      }      
   }
   else {
      for (int b=0; b<nBatch; b++) {
         getValuesBuffer()[b] = 0.0;
      }
   }
   return PV_SUCCESS;
}
Exemple #4
0
/**
 * @time
 * @l
 * @k
 * @kex
 * NOTES:
 *     - Only the activity buffer covers the extended frame - this is the frame that
 * includes boundaries.
 *     - The other dynamic variables (G_E, G_I, V, Vth) cover the "real" or "restricted"
 *     frame.
 */
int PointLIFProbe::writeState(double timed)
{
   if (parent->columnId()==0 && timed >= writeTime) {
      pvAssert(outputStream);
      writeTime += writeStep;
      PVLayerLoc const * loc = getTargetLayer()->getLayerLoc();
      const int k = kIndex(xLoc, yLoc, fLoc, loc->nxGlobal, loc->nyGlobal, loc->nf);
      double * valuesBuffer = getValuesBuffer();
      outputStream->printf("%s t=%.1f %d"
            "G_E=" CONDUCTANCE_PRINT_FORMAT
            " G_I=" CONDUCTANCE_PRINT_FORMAT
            " G_IB=" CONDUCTANCE_PRINT_FORMAT
            " V=" CONDUCTANCE_PRINT_FORMAT
            " Vth=" CONDUCTANCE_PRINT_FORMAT
            " a=%.1f",
            getMessage(), timed, k,
            valuesBuffer[0], valuesBuffer[1], valuesBuffer[2],
            valuesBuffer[3], valuesBuffer[4], valuesBuffer[5]);
      output() << std::endl;
   }
   return PV_SUCCESS;
}
Exemple #5
0
double PointProbe::getA() {
   return getValuesBuffer()[1];
}