- 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:
@@ -4,7 +4,7 @@
|
|||||||
<key>jay_peak_detect</key>
|
<key>jay_peak_detect</key>
|
||||||
<category>[jay]</category>
|
<category>[jay]</category>
|
||||||
<import>import jay</import>
|
<import>import jay</import>
|
||||||
<make>jay.peak_detect($vlen, $framerate, $bandwidth, $fcenter, $peak_height_min, $peak_width_min, $peak_width_max, $alpha_s, $alpha_m)</make>
|
<make>jay.peak_detect($vlen, $framerate, $bandwidth, $fcenter, $peak_thresh, $peak_hysteresis, $peak_width_min, $peak_width_max, $alpha_s, $alpha_m)</make>
|
||||||
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
|
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
|
||||||
Sub-nodes:
|
Sub-nodes:
|
||||||
* name
|
* name
|
||||||
@@ -36,10 +36,16 @@
|
|||||||
</param>
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<name>Peak Threshold [dB]</name>
|
<name>Peak Threshold [dB]</name>
|
||||||
<key>peak_height_min</key>
|
<key>peak_thresh</key>
|
||||||
<value>20</value>
|
<value>20</value>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
</param>
|
</param>
|
||||||
|
<param>
|
||||||
|
<name>Peak Hysteresis [dB]</name>
|
||||||
|
<key>peak_hysteresis</key>
|
||||||
|
<value>3</value>
|
||||||
|
<type>float</type>
|
||||||
|
</param>
|
||||||
<param>
|
<param>
|
||||||
<name>Peak BW Minimum [Hz]</name>
|
<name>Peak BW Minimum [Hz]</name>
|
||||||
<key>peak_width_min</key>
|
<key>peak_width_min</key>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace gr {
|
|||||||
* class. jay::peak_detect::make is the public interface for
|
* class. jay::peak_detect::make is the public interface for
|
||||||
* creating new instances.
|
* creating new instances.
|
||||||
*/
|
*/
|
||||||
static sptr 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);
|
static sptr 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jay
|
} // namespace jay
|
||||||
|
|||||||
@@ -29,16 +29,16 @@ namespace gr {
|
|||||||
namespace jay {
|
namespace jay {
|
||||||
|
|
||||||
peak_detect::sptr
|
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
|
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
|
* 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::block("peak_detect"
|
||||||
, gr::io_signature::make(1, 1, vlen*sizeof(float))
|
, gr::io_signature::make(1, 1, vlen*sizeof(float))
|
||||||
, gr::io_signature::make(0, 2, vlen*sizeof(float)))
|
, gr::io_signature::make(0, 2, vlen*sizeof(float)))
|
||||||
@@ -46,7 +46,8 @@ namespace gr {
|
|||||||
, m_framerate (framerate)
|
, m_framerate (framerate)
|
||||||
, m_bandwidth (bandwidth)
|
, m_bandwidth (bandwidth)
|
||||||
, m_fcenter (fcenter)
|
, 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_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_peak_width_max (2*(int)((0.5f*m_vlen)/bandwidth*peak_width_max) + 1)
|
||||||
, m_alpha_s (alpha_s)
|
, m_alpha_s (alpha_s)
|
||||||
@@ -213,7 +214,7 @@ namespace gr {
|
|||||||
// Create peak list
|
// Create peak list
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// Find peak candidates by thresholding
|
// 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
|
// Search true maximum peak using hill climbing
|
||||||
@@ -303,7 +304,7 @@ namespace gr {
|
|||||||
peak.heightUpdate_rel(m_pXds, nitems_per_block);
|
peak.heightUpdate_rel(m_pXds, nitems_per_block);
|
||||||
peak.heightUpdate_abs(m_pXs, 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);
|
temp.push_back(peak);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,8 @@ namespace jay {
|
|||||||
float m_framerate;
|
float m_framerate;
|
||||||
float m_bandwidth;
|
float m_bandwidth;
|
||||||
float m_fcenter;
|
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_min;
|
||||||
int m_peak_width_max;
|
int m_peak_width_max;
|
||||||
float m_alpha_s;
|
float m_alpha_s;
|
||||||
@@ -322,7 +323,7 @@ namespace jay {
|
|||||||
pmt::pmt_t m_msg_port_out;
|
pmt::pmt_t m_msg_port_out;
|
||||||
|
|
||||||
public:
|
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();
|
~peak_detect_impl();
|
||||||
|
|
||||||
// Where all the action really happens
|
// Where all the action really happens
|
||||||
|
|||||||
Reference in New Issue
Block a user