- added peak off hysteresis

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@521 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-30 16:51:52 +00:00
parent a589d6477a
commit ee9f15f1a6
4 changed files with 20 additions and 12 deletions
+7 -6
View File
@@ -29,16 +29,16 @@ namespace gr {
namespace jay {
peak_detect::sptr
peak_detect::make(int vlen, float framerate, float bandwidth, float fcenter, float peak_height_min, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m)
peak_detect::make(int vlen, float framerate, float bandwidth, float fcenter, float peak_thresh, float peak_hysteresis, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m)
{
return gnuradio::get_initial_sptr
(new peak_detect_impl(vlen, framerate, bandwidth, fcenter, peak_height_min, peak_width_min, peak_width_max, alpha_s, alpha_m));
(new peak_detect_impl(vlen, framerate, bandwidth, fcenter, peak_thresh, peak_hysteresis, peak_width_min, peak_width_max, alpha_s, alpha_m));
}
/*
* The private constructor
*/
peak_detect_impl::peak_detect_impl(int vlen, float framerate, float bandwidth, float fcenter, float peak_height_min, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m)
peak_detect_impl::peak_detect_impl(int vlen, float framerate, float bandwidth, float fcenter, float peak_thresh, float peak_hysteresis, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m)
: gr::block("peak_detect"
, gr::io_signature::make(1, 1, vlen*sizeof(float))
, gr::io_signature::make(0, 2, vlen*sizeof(float)))
@@ -46,7 +46,8 @@ namespace gr {
, m_framerate (framerate)
, m_bandwidth (bandwidth)
, m_fcenter (fcenter)
, m_peak_height_min (peak_height_min)
, m_peak_thresh (peak_thresh)
, m_peak_hysteresis (peak_hysteresis)
, m_peak_width_min (2*(int)((0.5f*m_vlen)/bandwidth*peak_width_min) + 1)
, m_peak_width_max (2*(int)((0.5f*m_vlen)/bandwidth*peak_width_max) + 1)
, m_alpha_s (alpha_s)
@@ -213,7 +214,7 @@ namespace gr {
// Create peak list
// -----------------------------------------------------------------
// Find peak candidates by thresholding
std::vector<int> peakPos = findPeakPos(m_pXds, nitems_per_block, m_peak_height_min);
std::vector<int> peakPos = findPeakPos(m_pXds, nitems_per_block, m_peak_thresh);
// -----------------------------------------------------------------
// Search true maximum peak using hill climbing
@@ -303,7 +304,7 @@ namespace gr {
peak.heightUpdate_rel(m_pXds, nitems_per_block);
peak.heightUpdate_abs(m_pXs, nitems_per_block);
if (peak.height_rel >= (m_peak_height_min-10.f))
if (peak.height_rel >= (m_peak_thresh-m_peak_hysteresis))
{
temp.push_back(peak);
}
+3 -2
View File
@@ -300,7 +300,8 @@ namespace jay {
float m_framerate;
float m_bandwidth;
float m_fcenter;
float m_peak_height_min;
float m_peak_thresh;
float m_peak_hysteresis;
int m_peak_width_min;
int m_peak_width_max;
float m_alpha_s;
@@ -322,7 +323,7 @@ namespace jay {
pmt::pmt_t m_msg_port_out;
public:
peak_detect_impl(int vlen, float framerate, float bandwidth, float fcenter, float peak_height_min, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m);
peak_detect_impl(int vlen, float framerate, float bandwidth, float fcenter, float peak_thresh, float peak_hysteresis, float peak_width_min, float peak_width_max, float alpha_s, float alpha_m);
~peak_detect_impl();
// Where all the action really happens