Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Public Member Functions | List of all members
ska::cheetah::sps_clustering::SpsClustering Class Reference

A class that will merge candidates that have been labeled in the same group. More...

#include <cheetah/sps_clustering/SpsClustering.h>

Collaboration diagram for ska::cheetah::sps_clustering::SpsClustering:
Collaboration graph

Public Member Functions

 SpsClustering (Config const &config)
 consructor
 
template<typename NumRepType >
std::shared_ptr< data::SpCcl< NumRepType > > operator() (std::shared_ptr< data::SpCcl< NumRepType >> const &cands)
 remove duplicate candidates More...
 

Detailed Description

A class that will merge candidates that have been labeled in the same group.

Will take SpCcl object as an argument and return the same object

Definition at line 39 of file SpsClustering.h.

Member Function Documentation

◆ operator()()

template<typename NumRepType >
std::shared_ptr< data::SpCcl< NumRepType > > ska::cheetah::sps_clustering::SpsClustering::operator() ( std::shared_ptr< data::SpCcl< NumRepType >> const &  cands)

remove duplicate candidates

cnadidates are considered to be duplicates if they are clustered together within the bounds provided by the configuration

Returns
a new shared_ptr<SpCcl> candidate object with representative candidate fro each cluster. The representative is the candidate with the maximum signal to noise ratio

Definition at line 32 of file SpsClustering.cpp.

33 {
34  if (! _config.active())
35  return cands;
36 
37  std::shared_ptr<data::SpCcl<NumRepType>> merged_cands = std::make_shared<data::SpCcl<NumRepType>>(cands->tf_blocks());
38  std::vector<std::vector<size_t>> groups = _clustered_candidates(*cands);
39 
40  PANDA_LOG_DEBUG << "Picking best candidate from " << groups.size() << " clusters...";
41  std::vector<data::SpCandidate<Cpu, float>> group_cands;
42  for ( auto const& group : groups )
43  {
44  // use the max sigma candidate as the representative of any group
45  // Filter out all candidates with these indices into a separate vector
46  PANDA_LOG_DEBUG << "Size of each cluster: " << group.size();
47  std::size_t max_sigma_index = group[0];
48  typename data::SpCcl<NumRepType>::SpCandidateType::NumericalRep max_sigma = (*cands)[max_sigma_index].sigma();
49  for (std::size_t ii=1; ii < group.size(); ++ii)
50  {
51  auto const& candidate = (*cands)[group[ii]];
52  if( candidate.sigma() > max_sigma ) {
53  max_sigma = candidate.sigma();
54  max_sigma_index = group[ii];
55  }
56  }
57  PANDA_LOG_DEBUG << "Parameters for max S/N candidate";
58  PANDA_LOG_DEBUG << "DM: " << (*cands)[max_sigma_index].dm();
59  PANDA_LOG_DEBUG << "Width: " << (*cands)[max_sigma_index].width();
60  PANDA_LOG_DEBUG << "S/N: " << (*cands)[max_sigma_index].sigma();
61  if ((*cands)[max_sigma_index].dm() >= (*cands).dm_range().first + (1.0 * pss::astrotypes::units::parsecs_per_cube_cm))
62  {
63  merged_cands->push_back((*cands)[max_sigma_index]);
64  }
65  }
66  return merged_cands;
67 }
Here is the call graph for this function:

The documentation for this class was generated from the following files: