some projects

Zooming In: How to Look at a Specific Range of Time on the EEG Graph

leave a comment »

Quick into to loooking at a particular bit of the dataset using gnuplot… Let’s consider a particular point of interest. (say, someone turning on a light while the subject was sleeping)
The point of interest in this case starts 19655000 msec into the recording, more or less.

Here’s how to calculate that, by the way, if it had happened, say, 3 hours 45 minutes 7 seconds into the recording:

(3 hours * 60min/hr * 60sec/min * 1000msec/sec) + (45 minutes * 60 sec/min * 1000msec/sec) + (7 seconds * 1000msec/sec)

What’s the duration of the point of interest? About 19min, in my case.

That’s a length of (19min * 60 sec/min * 1000 msec/sec) = 1140000 msec

So the ending offset is 19655000 msec + 1140000 msec = 20795000 msec

Ok, what options does gnuplot give us for finding those offsets?

Try xrange… add

set xrange [19655000:20795000]

to the gpl file and call it ‘eeg-demo-xrange-test.gpl’

fire up gnuplot…

gnuplot -e “file=’LOGGER00.CSV'” eeg-demo-xrange-test.gpl

Hey neat! clear change in delta… but this sucks, having to hand-edit xrange every time… try editing the gpl to make it take xstart= and xend= on the command line

<gpl file start>

set datafile separator “,”
set key autotitle columnhead
set autoscale x
set yrange [0:1500000]
set xrange [xstart:xend]
set y2range [0:100]
set parametric

plot for [i=6:13] file using 1:i with lines smooth bezier, file using 1:3 with lines axis x1y2 smooth csplines #, for [i=4:5] file using 1:i with lines lw 2 axis x1y2 smooth bezier

<gpl file ends>

try that…

gnuplot -e “file=’LOGGER00.CSV’; xstart=19655000; xend=20795000” eeg-demo-xrange-test.gpl


But what I really want is to look at the point of interest in context, with say 19 minutes before and after as well… so subtract 19 minutes from the beginning and add 19 minutes to the ending offset:
19655000 msec – 1140000 msec = 18515000
20795000 msec + 1140000 msec = 21935000

so feed it the new offsets on the command line

gnuplot -e “file=’LOGGER00.CSV’; xstart=18515000; xend=21935000” /Volumes/DOCS/00-Working-Text-Files/eeg/eeg-demo-xrange-test.gpl

There we go!
I wish there was a smoothing algorithm in between bezier (too smooth) and csplines (not smooth enough).


Written by 333dan

June 7, 2012 at 9:35 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: