snd297 / braintrust

Automatically exported from code.google.com/p/braintrust
0 stars 0 forks source link

Matab does not receive filtered data correctly #237

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create analysis and set filter settings in portal to: band filter: 100-500Hz
2. Run ieeg.m
3. plot returned values of 'getTimeSeries'
4. Compare EEG-subset with EEG in portal viewer

What is the expected output? What do you see instead?
The returned data is the same as the unfiltered data in the portal viewer 
despite the filter settings that were applied. 

Please provide any additional information below.
Timeseries details :
Found request to process snapshot 9391b565-d8b4-48bc-9187-5ee2914ff3ddDetails: 
[<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?><traceinfo><acquisition>Digital 
Lynx</acquisition><comments>not 
entered</comments><name>Grid_01</name><duration>1.1580321746E11</duration><inst>
Mayo Clinic, Rochester, MN, 
USA</inst><channelLabel>Grid1</channelLabel><maxSample>8726</maxSample><minSampl
e>-6179</minSample><revisionId>f783bd4b-056a-4733-b375-b4c135f995d9</revisionId>
<sampleRate>0.0</sampleRate><startTime>0</startTime><subject>9-999-393</subject>
<voltageConversionFactor>1.0</voltageConversionFactor></traceinfo>]
Parameters to 9391b565-d8b4-48bc-9187-5ee2914ff3dd: {numBlocks=5, startTime=0, 
sampleFreq=1000.0, lowFreqStop=0, numPoles=32, highFreqPass=500.0, 
highFreqStop=0, bandStop=false, blockSize=15000000, 
filterType=[Ljava.lang.String;@37e841a5, lowFreqPass=100, 
channelNames=[Ljava.lang.String;@712dd44f}
Requesting 5 blocks from offset 0, each 1000 Hz and 15000000 usec
Processing task f783bd4b-056a-4733-b375-b4c135f995d9

So, filter settings seem to imply a bandpass with 100-500 cutoff.

See attached screenshots for data plotted in Matlab and the unfiltered EEG 
signal in the portal viewer.

Original issue reported on code.google.com by JBWagenaar on 21 Mar 2012 at 4:14

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by JBWagenaar on 21 Mar 2012 at 6:20

Attachments:

GoogleCodeExporter commented 9 years ago
sorry for the bunch of incorrect figures... Trying to get this to work... It 
seems that maybe the values returned to Matlab are correct. Can you double 
check this?

Original comment by JBWagenaar on 21 Mar 2012 at 6:26

Attachments:

GoogleCodeExporter commented 9 years ago
After the QA update of this morning, MATLAB does receive filtered data. 
However, the filtered data does not look  the same in the web portal viewer and 
the matlab figure... I suspect that the Matlab data is correct, but will check 
with a local copy of the raw EEG data.

Original comment by JBWagenaar on 21 Mar 2012 at 6:57

GoogleCodeExporter commented 9 years ago
Non-obvious aspect of an EEG viewer (also as per Matt):  we always do a lowpass 
filter that is at no higher than 1/2 the *screen resolution* in pixels.  This 
prevents aliasing on the screen.

But basically if you specify a higher-pass filter in the portal it will only 
matter if you zoom in to a point where there are enough samples on the screen.

Note that otherwise the downsampling used in the viewer is the same exact code 
as what's used in the web services.

Original comment by zack.i...@gmail.com on 21 Mar 2012 at 8:49

GoogleCodeExporter commented 9 years ago
I don't think the web portal viewer behavior can be explained by downsampling 
and an additional filter. It looks more like it upsampled the downsampled 
filtered signal and padded it with zeros, or something.

The matlab figure is approximately the same number of pixels so in theory, they 
should be fairly similar. (click on screenshots to see original size).

Original comment by JBWagenaar on 21 Mar 2012 at 9:01

GoogleCodeExporter commented 9 years ago
I attached the following figures: All figures are from patient034, channel 2, 
4th order bandpass filter 100-500Hz. First second of data

1) View in EEG portal viewer
2) Get data from server using analysis: set sampling rate to 1000Hz, same 
filter settings as above
3) Get data from server using analysis: set sampling rate to 2713Hz, same 
filter settings as above
4) Use FILTFILT in MATLAB on raw data file with sampling rate of 2713HZ, same 
filter settings as above

Now, aside from initial conditions, the different figures look completely 
different... 

Original comment by JBWagenaar on 21 Mar 2012 at 9:49

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by samd.p...@gmail.com on 23 Mar 2012 at 4:24

GoogleCodeExporter commented 9 years ago

Original comment by zack.i...@gmail.com on 16 Apr 2012 at 4:04

GoogleCodeExporter commented 9 years ago

Original comment by samd.p...@gmail.com on 11 May 2012 at 2:32

GoogleCodeExporter commented 9 years ago
Changed filters to use 1/5 sample rate as opposed to Nyquist frequency.

Original comment by zack.i...@gmail.com on 11 May 2012 at 5:49

GoogleCodeExporter commented 9 years ago
Changed frequency; need some testing to see if it improved things.

Original comment by zack.i...@gmail.com on 15 May 2012 at 8:45

GoogleCodeExporter commented 9 years ago

Original comment by john.fro...@gmail.com on 17 May 2012 at 10:02

GoogleCodeExporter commented 9 years ago

Original comment by JBWagenaar on 24 May 2012 at 6:06