- Peak detector delivers frequency instead of bin
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@492 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -29,20 +29,23 @@ namespace gr {
|
||||
namespace jay {
|
||||
|
||||
peak_detect::sptr
|
||||
peak_detect::make(int vlen, float framerate, float peak_height_min, int peak_width_min, int peak_width_max, float alpha_s, float alpha_m)
|
||||
peak_detect::make(int vlen, float framerate, float bandwidth, float fcenter, float peak_height_min, int peak_width_min, int peak_width_max, float alpha_s, float alpha_m)
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new peak_detect_impl(vlen, framerate, peak_height_min, peak_width_min, peak_width_max, alpha_s, alpha_m));
|
||||
(new peak_detect_impl(vlen, framerate, bandwidth, fcenter, peak_height_min, peak_width_min, peak_width_max, alpha_s, alpha_m));
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
peak_detect_impl::peak_detect_impl(int vlen, float framerate, float peak_height_min, int peak_width_min, int 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_height_min, int peak_width_min, int peak_width_max, float alpha_s, float alpha_m)
|
||||
: gr::sync_block("peak_detect"
|
||||
, gr::io_signature::make(1, 1, vlen*sizeof(float))
|
||||
, gr::io_signature::make(2, 2, vlen*sizeof(float)))
|
||||
, m_vlen(vlen)
|
||||
, m_framerate (framerate)
|
||||
, m_bandwidth (bandwidth)
|
||||
, m_fcenter (fcenter)
|
||||
, m_peak_height_min (peak_height_min)
|
||||
, m_peak_width_min (peak_width_min)
|
||||
, m_peak_width_max (peak_width_max)
|
||||
@@ -230,7 +233,12 @@ namespace gr {
|
||||
}
|
||||
else
|
||||
{
|
||||
Peak peak(m_peak_id++, pos);
|
||||
// pos = float(peak['pos'] - self.nfft / 2)
|
||||
// freq_Hz = self.fcenter + 1.0 / self.nfft * self.bandwidth * pos
|
||||
|
||||
float pos_shifted = (float)(pos-m_vlen/2);
|
||||
float freq_Hz = m_fcenter + m_bandwidth*pos_shifted/m_vlen;
|
||||
Peak peak(m_peak_id++, pos, freq_Hz);
|
||||
peak.height_rel = m_pXds[pos];
|
||||
addToListByPos(peaks, peak);
|
||||
numPeaksClimbed++;
|
||||
|
||||
Reference in New Issue
Block a user