24 #include "cheetah/rfim/Rfim.h" 25 #include "cheetah/rfim/ampp/Rfim.h" 26 #include "cheetah/rfim/cuda/Rfim.h" 27 #include "cheetah/rfim/sum_threshold/Rfim.h" 28 #include "cheetah/rfim/iqrmcpu/Rfim.h" 29 #include "panda/Error.h" 30 #include "panda/Log.h" 37 template<
typename Policy>
44 typedef cheetah::Cpu Architecture;
46 template<
typename ResourceType>
47 ReturnType operator()(ResourceType& , std::shared_ptr<
typename std::remove_reference<ArgumentType>::type>
const& data)
49 return _policy.null_op(*data);
54 policy::Policy<Policy> _policy;
57 template<
typename Algo>
58 struct RfimCreateHelper {
59 template<
typename ConfigT,
typename BandpassHandler>
61 Algo create(ConfigT
const& config, BandpassHandler&&)
63 return Algo(config.template config<typename Algo::Config>());
67 template<
typename TraitsT>
68 struct RfimCreateHelper<cuda::Rfim<TraitsT>>
70 template<
typename ConfigT,
typename BandpassHandler>
72 cuda::Rfim<TraitsT> create(ConfigT
const& config, BandpassHandler&&)
74 PANDA_LOG <<
"rfim::cuda algorithm activated";
75 return cuda::Rfim<TraitsT>(config.cuda_algo_config());
79 template<
typename TraitsT>
80 struct RfimCreateHelper<iqrmcpu::Rfim<TraitsT>>
82 template<
typename ConfigT,
typename BandpassHandler>
84 iqrmcpu::Rfim<TraitsT> create(ConfigT
const& config, BandpassHandler&&)
86 PANDA_LOG <<
"rfim::iqrmcpu algorithm activated";
87 return iqrmcpu::Rfim<TraitsT>(config.iqrmcpu_algo_config());
91 template<
typename TraitsT>
92 struct RfimCreateHelper<sum_threshold::Rfim<TraitsT>>
94 template<
typename ConfigT,
typename BandpassHandler>
96 sum_threshold::Rfim<TraitsT> create(ConfigT
const& config, BandpassHandler&&)
98 PANDA_LOG <<
"rfim::sum_threshold algorithm activated";
99 return sum_threshold::Rfim<TraitsT>(config.sum_threshold_algo_config());
103 template<
typename TraitsT>
104 struct RfimCreateHelper<ampp::Rfim<TraitsT>>
106 template<
typename ConfigT,
typename BandpassHandler>
108 ampp::Rfim<TraitsT> create(ConfigT
const& config, BandpassHandler&& handler)
110 PANDA_LOG <<
"rfim::ampp algorithm activated";
111 return ampp::Rfim<TraitsT>(config.ampp_algo_config(), std::forward<BandpassHandler>(handler));
115 template<
typename ConfigType,
typename RfimTraits>
119 RfimFactory(ConfigType
const& config,
typename RfimTraits::BandPassHandler& bp_handler)
121 , _bp_handler(bp_handler)
124 template<
typename Algo>
127 return RfimCreateHelper<Algo>::create(_config, _bp_handler);
130 template<
typename Algo>
131 bool active()
const {
132 return _config.template config<typename Algo::Config>().active();
136 ConfigType
const& _config;
137 typename RfimTraits::BandPassHandler& _bp_handler;
144 template<
typename TimeFrequencyType,
typename RfimTraits,
typename ConfigType>
145 Rfim<TimeFrequencyType, RfimTraits, ConfigType>::Rfim(ConfigType
const& c
146 ,
typename RfimTraits::RfimHandler& handler
147 ,
typename RfimTraits::BandPassHandler& bp_handler
149 : _task(c.pool(), handler)
152 RfimFactory<ConfigType, RfimTraits> factory(c, bp_handler);
153 if(!_task.configure(factory
154 , Select<rfim::sum_threshold::Rfim<RfimTraits>>(c.sum_threshold_algo_config().active())
155 , Select<rfim::cuda::Rfim<RfimTraits>>(c.cuda_algo_config().active())
156 , Select<rfim::ampp::Rfim<RfimTraits>>(c.ampp_algo_config().active())
157 , Select<rfim::iqrmcpu::Rfim<RfimTraits>>(c.iqrmcpu_algo_config().active())
160 _task.template set_algorithms<Null<PolicyType>>(std::move(Null<PolicyType>()));
161 PANDA_LOG_WARN <<
"WARNING: no RFI mitigation algorithm has been specified";
165 template<
typename TimeFrequencyType,
typename RfimTraits,
typename ConfigType>
166 Rfim<TimeFrequencyType, RfimTraits, ConfigType>::~Rfim()
170 template<
typename TimeFrequencyType,
typename RfimTraits,
typename ConfigType>
173 auto ptr = data.shared_from_this();
std::conditional< std::is_same< void, AdapterDataReturnType >::value, DataArgumentType, AdapterDataReturnType >::type ReturnType
the data type the policy will return
Some limits and constants for FLDO.
ReturnType run(data::TimeFrequency< Cpu, NumericalRep > &data)
perform rfi clipping on the data
std::conditional< std::is_member_function_pointer< AdapterFuncType >::value, typename boost::mpl::at_c< boost::function_types::parameter_types< AdapterFuncType >, 1 >::type, typename boost::mpl::at_c< boost::function_types::parameter_types< AdapterFuncType >, 0 >::type >::type DataArgumentType
The argument type that is to be expected to represent the TimeFrequencyData.