std::vector< double > HOGComputer18p4_General::undecorate_feat(std::vector< double > feat)
  {
    // 
    int num_cells = feat.size()/getNBins();
    
    // quadrupple every cell to match the 18*4 feature.
    vector<double> raw_feat(num_cells*4*18,0); 
    int raw_pos = 0;
    for(int cellIter = 0; cellIter < num_cells; cellIter++)
      // we need to write the cell from feat 4 times into
      // raw_feat
      for(int jter = 0; jter < 4; jter++)
	for(int bin = 0; bin < 18; bin++)
	{
	  int feat_idx = bin + cellIter*getNBins();
	  int raw_idx  = bin + cellIter*hog18x4mapped.getNBins() + jter*18;
	  assert(feat_idx >= 0 && feat_idx < feat.size());
	  assert(raw_idx >= 0 && raw_idx < raw_feat.size());
	  raw_feat[raw_idx] = feat[feat_idx];
	}
    return raw_feat;
  }
Ejemplo n.º 2
0
IMDHistoWorkspace_sptr ReflectometryTransform::executeMDNormPoly(
    MatrixWorkspace_const_sptr inputWs) const {

  auto input_x_dim = inputWs->getXDimension();

  MDHistoDimension_sptr dim0 = MDHistoDimension_sptr(new MDHistoDimension(
      input_x_dim->getName(), input_x_dim->getDimensionId(),
      input_x_dim->getMDFrame(),
      static_cast<Mantid::coord_t>(input_x_dim->getMinimum()),
      static_cast<Mantid::coord_t>(input_x_dim->getMaximum()),
      input_x_dim->getNBins()));

  auto input_y_dim = inputWs->getYDimension();

  MDHistoDimension_sptr dim1 = MDHistoDimension_sptr(new MDHistoDimension(
      input_y_dim->getName(), input_y_dim->getDimensionId(),
      input_y_dim->getMDFrame(),
      static_cast<Mantid::coord_t>(input_y_dim->getMinimum()),
      static_cast<Mantid::coord_t>(input_y_dim->getMaximum()),
      input_y_dim->getNBins()));

  auto outWs = boost::make_shared<MDHistoWorkspace>(dim0, dim1);

  for (size_t nHistoIndex = 0; nHistoIndex < inputWs->getNumberHistograms();
       ++nHistoIndex) {
    const MantidVec X = inputWs->readX(nHistoIndex);
    const MantidVec Y = inputWs->readY(nHistoIndex);
    const MantidVec E = inputWs->readE(nHistoIndex);

    for (size_t nBinIndex = 0; nBinIndex < inputWs->blocksize(); ++nBinIndex) {
      auto value_index = outWs->getLinearIndex(nBinIndex, nHistoIndex);
      outWs->setSignalAt(value_index, Y[nBinIndex]);
      outWs->setErrorSquaredAt(value_index, E[nBinIndex] * E[nBinIndex]);
    }
  }
  return outWs;
}
 size_t HOGComputer18p4_General::getDescriptorSize()
 {
   return getNBins()*cellsPerBlock()*blocks_x()*blocks_y();
 }