Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Some FFT and bh-HRV questions, hopefully of general interest
Reply to topic
Author Message
snovotill



Joined: Feb 8, 2013
Posts: 80

PostPosted: Jan 16, 2014 6:41 AM    Post subject: Some FFT and bh-HRV questions, hopefully of general interest

Hi Jarek, I'd like to ask a few good questions that should be of general interest to everyone using FFT or the bh-HRV nested design:

ELEMENT: StreamToVector2
(a) If Input Sample Count is less than OutputVectorLength, then does the vector eventually fill up completely anyway as more samples arrive, or does it forever remain padded with zeros?
(b) While Preprocessing is still in progress, do the samples which have already arrived get centered within the vector, or does it fill from left to right or right to left?
(c) I notice vectors of 1024 length are quite common with FFT. I could be totally wrong but this looks to me like roughly to 512 output bins and 9 octaves of frequency coverage. I such a long vector really necessary for HRV? Could it not be done with a vector length 512 or even 256 considering that the span in frequency of interest is only 0.0033Hz through 0.4Hz?
(d) What was the reason for including the HAMMING window and when would you use in instead of HANNING in BioEra?
(e)Is the FRAME window just another name for Boxcar aka no window function is applied?
(f) Is the Triangular window the same in offset and proportion as a standard Bartlett window?

ELEMENT: VectorMixer
(g) Could you please confirm that MAGNITUDE = SQRT(A^2+B^2) as seems to be the case from the context in which it is used?
(h) What algorithm does the PHASE = ? option employ, and which BioEra elements output vector streams that this could be used with?

ELEMENT: TimeIntervalResampler3
(There is another thread on this but no details for below)
(i)What method of interpolation does it use?
(j)Will it downsample reliably too?
(k)Is there also a TimeIntervalResampler2 or TimeIntervalResampler1 available? I have not found any of them in New Element dialog under anything that looked similar by name.

ELEMENT: RRDetector
(l)I see this requires a Pleth signal input. Is there another version available that works well with ECG signal?
(m)The Detector(float) outputs a lot of zeros, sometimes a 1, and sometimes a 999. What exactly do 1 and the 999 mean? What is their phase relationship to the incoming signal? What does each zero represent in the time domain? How come the 1 or 999 are never seen at the start of each burst of output?
(n) I'm also not able to find this element in the New Element dialog. Is there a setting somewhere that makes it accessible?

Thanks much ...Stepan
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jan 16, 2014 8:23 PM    Post subject:

> (a) If Input Sample Count is less than OutputVectorLength, then does the vector eventually fill up completely anyway as more samples arrive, or does it forever remain padded with zeros?

It remains padded with zeros. The purpose of this option is to increase resolution for a shorter time.

> (b) While Preprocessing is still in progress, do the samples which have already arrived get centered within the vector, or does it fill from left to right or right to left?

From left to right.

> (c) I notice vectors of 1024 length are quite common with FFT. I could be totally wrong but this looks to me like roughly to 512 output bins and 9 octaves of frequency coverage. I such a long vector really necessary for HRV? Could it not be done with a vector length 512 or even 256 considering that the span in frequency of interest is only 0.0033Hz through 0.4Hz?

There is nothing special about 1024. It is really about the resolution and granulation you need. And also about performance (the time to calculate FFT increases exponentially for longer vectors).

> (d) What was the reason for including the HAMMING window and when would you use in instead of HANNING in BioEra?

From my experience it matters little what windowing function is applied, as long as there is one. I like Hamming because it worked best in my tests with simulated signals, but I certainly do not claim it is better than Hanning.

> (e)Is the FRAME window just another name for Boxcar aka no window function is applied?

Yes :-).

> (f) Is the Triangular window the same in offset and proportion as a standard Bartlett window?

Yes, I believe so.

> (g) Could you please confirm that MAGNITUDE = SQRT(A^2+B^2) as seems to be the case from the context in which it is used?

Yes.

> (h) What algorithm does the PHASE = ? option employ, and which BioEra elements output vector streams that this could be used with?

Math.atan2, it assumes real and imaginary inputs, for example from a complex FFT output.

> (i)What method of interpolation does it use?

At this moment I would not recommend it. I think TimeIntervalResampler works better.

> (k)Is there also a TimeIntervalResampler2 or TimeIntervalResampler1 available? I have not found any of them in New Element dialog under anything that looked similar by name.

No.

> (l)I see this requires a Pleth signal input. Is there another version available that works well with ECG signal?

There is no other version. And I have no experience with ECG.

> (m)The Detector(float) outputs a lot of zeros, sometimes a 1, and sometimes a 999. What exactly do 1 and the 999 mean? What is their phase relationship to the incoming signal? What does each zero represent in the time domain? How come the 1 or 999 are never seen at the start of each burst of output?

There is only 1 or 0 value sent to that output. Those numbers must be a result of some sort of rounding during rescaling in downstream elements.

> (n) I'm also not able to find this element in the New Element dialog. Is there a setting somewhere that makes it accessible?

It has been hidden, since the HRV design has been hidden as well. I will make it public.
snovotill



Joined: Feb 8, 2013
Posts: 80

PostPosted: Jan 17, 2014 10:02 AM    Post subject:

Thanks Jarek, that leaves almost no stones unturned.

I tried RRDetector with a really dirty ECG signal and it did a good job of detecting the R spike. With a pleth input it triggers on the sharp upward slope for best temporal resolution, as I had hoped it would. I notice that another option for detecting the R spike in ECG work is to find it with TimeRatio set to 1% or 2%.

A couple of farther clarifications on TimeIntervalResampler would be appreciated:
(1) Could you please confirm that it looks at exactly two input intervals at any given time, as is seems evident from it's processing delay?
(2) Can it be used for reliable downsampling too, or is it only recommended for up-sampling?
...would appreciate if you could also add this element to the New Element dialog. I`m going to try it with breathing at some point.

again, thanks for all the good info,
...Stepan

jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jan 17, 2014 7:07 PM    Post subject:

(1) I think it can look at more than 2 samples at a time, or just 1. It depends on values of those samples (which are used also to measure the time) and the output rate.

(2) I am not entirely sure, it was a long time ago when I created it. I think it should, try it. But the 2Hz output rate was the most typical in HRV software I have seen.
Reply to topic