24 #ifndef SKA_CHEETAH_DATA_SPCCL_H 25 #define SKA_CHEETAH_DATA_SPCCL_H 27 #include "cheetah/data/SpCandidate.h" 28 #include "cheetah/data/CandidateWindow.h" 29 #include "cheetah/data/VectorLike.h" 30 #include "cheetah/data/TimeFrequency.h" 31 #include "pss/astrotypes/units/TimeUnits.h" 32 #include "cheetah/utils/Architectures.h" 33 #include "panda/DataChunk.h" 51 template<
typename NumericalRep>
53 :
public ska::panda::DataChunk<SpCcl<NumericalRep>>
54 ,
public VectorLike<std::vector<SpCandidate<Cpu, float>>>
58 typedef SpCandidateType::Dm Dm;
61 typedef std::vector<SpCandidateType> InnerType;
66 typedef typename TimeFrequencyType::FrequencyType FrequencyType;
67 typedef std::vector<std::shared_ptr<const TimeFrequencyType>> BlocksType;
68 typedef typename BaseT::Iterator CandidateIterator;
69 typedef typename BaseT::ConstIterator ConstCandidateIterator;
72 class ConstDataIterator :
public std::iterator<std::forward_iterator_tag, typename TimeFrequencyType::SliceType>
75 typedef typename BaseT::ConstIterator ConstCandidateIterator;
76 typedef typename TimeFrequencyType::ConstIterator ConstIterator;
77 typedef typename TimeFrequencyType::SliceType Slice;
78 typedef typename TimeFrequencyType::ConstSliceType ConstSlice;
81 typedef Slice value_type;
82 typedef value_type& reference;
83 typedef ConstSlice& const_reference;
87 , ConstCandidateIterator
begin 88 , ConstCandidateIterator
const&
end 90 , utils::ModifiedJulianClock::time_point
const& epoch);
98 utils::ModifiedJulianClock::time_point
const&
start_time()
const;
109 ConstCandidateIterator
const& candidate_end()
const;
121 const_reference operator*()
const;
125 void next_candidate();
128 struct CandidateData {
129 friend class SpCcl<NumericalRep>;
130 CandidateData(ConstSlice
const& slice,
bool is_last=
false)
132 , _last_block(is_last) {}
134 ConstSlice& slice() {
return _slice; }
135 bool last_block()
const {
return _last_block; };
144 ConstCandidateIterator _cand_it;
145 ConstCandidateIterator
const _cand_it_end;
146 mutable std::deque<CandidateData> _slices;
147 typename BlocksType::const_iterator _tf_it;
148 typename BlocksType::const_iterator _tf_end;
149 typename BlocksType::const_iterator _tf_start_it;
150 utils::ModifiedJulianClock::time_point
const _epoch;
151 typename boost::units::quantity<MilliSeconds, double> _duration;
152 typename boost::units::quantity<MilliSeconds, double> _span;
153 utils::ModifiedJulianClock::time_point _start_time;
154 std::deque<std::pair<ConstCandidateIterator, ConstCandidateIterator>> _cands;
159 SpCcl(BlocksType
const&, data::DimensionIndex<data::Time> start_offset=data::DimensionIndex<data::Time>(0));
175 void push_back(SpCandidateType
const& cand);
189 void emplace(SpCandidateType && cand);
190 void emplace_calculate_duration(SpCandidateType && cand);
195 void emplace(
typename SpCandidateType::Dm,
196 boost::units::quantity<MilliSeconds, double>
start_time,
197 boost::units::quantity<MilliSeconds, double> pulse_width,
199 std::size_t ident = 0
214 boost::units::quantity<MilliSeconds, double> start_time,
215 boost::units::quantity<MilliSeconds, double> pulse_width,
217 std::size_t ident = 0
231 utils::ModifiedJulianClock::time_point
const&
start_time()
const;
236 boost::units::quantity<data::MilliSeconds,double>
offset_time()
const;
241 std::pair<Dm, Dm>
const&
dm_range()
const;
246 utils::ModifiedJulianClock::time_point
start_time(SpCandidateType
const&)
const;
251 template<
typename PredicateT>
258 std::pair<Dm, Dm> _dm_range;
260 utils::ModifiedJulianClock::time_point _start_time;
261 boost::units::quantity<data::MilliSeconds,double> _offset_time;
262 typedef decltype(1.0/(FrequencyType() * FrequencyType())) DmFactorType;
263 DmFactorType _dm_delay_factor;
270 #include "detail/SpCcl.cpp" 272 #endif // SKA_CHEETAH_DATA_SPCCL_H ConstDataIterator data_begin(CandidateWindow const &window) const
Extract data corresponding to the candidates start and end times.
A simple record to hold 'candidate' proprerties.
void push_back(SpCandidateType const &cand)
Push back method for inserting Single pulse Candidates but without calculating tend They will be ins...
void push_back_calculate_duration(SpCandidateType const &cand)
Push back method for inserting Single pulse Candidates calculating temd based on dispersion and freq ...
std::pair< Dm, Dm > const & dm_range() const
the max and minimum Dispersion Measure values of the candidates
BlocksType const & tf_blocks() const
Access the TimeFrequency blocks associated with the single pulse candidtes.
void emplace(SpCandidateType &&cand)
Emplace back method for inserting Single pulse Candidates, ensuring ordering by start_time. They will be inserted in a sorted order with respect to the start time of each candidate instead of insert to the end.
bool end_block() const
retunrs true is the current block is the end of contiguous series
void emplace_back(SpCandidateType &&cand)
Add a Single pulse Candidate to the end of the cand list, without calculating the duration Checking ...
Class that wraps objects that export the std::vector interface.
Some limits and constants for FLDO.
ConstCandidateIterator candidate_begin() const
retunrs true is the current block is the end of contiguous series
ConstDataIterator & operator++()
pre-increment operator
define a window of data surrounding a single pulse candidate
Iterator end()
An iterator pointing to the end of the vector.
boost::units::quantity< data::MilliSeconds, double > offset_time() const
the time duration from the beginning of the first block to start_time()
void remove_if(PredicateT const &)
remove candidates that meet the specified condition
utils::ModifiedJulianClock::time_point const & start_time() const
: Get the start time
Iterator begin()
An iterator pointing to the start of the vector.