Re: [buildcheapeeg] EDF and DDF file formats

From: Jim Peters (jim_at_uazu.net)
Date: 2002-03-13 19:43:03


Sar Saloth wrote:
> >That's interesting -- I hadn't thought of that. You could actually
> >also retro-fit floating-point data streams onto EDF in the same way.
> >Traditional EDF software would just see a channel full of weird noise,
> >whereas your software could recognise the label and take pairs of
> >2-byte integers as 32-bit floats.
>
> I like it! And if we made those channels first in the record, would we
> maintain 4-byte word alignment?

No, because you might have an odd number of 2-byte words following,
making the chunk length (record length, really, in EDF terminology) an
odd multiple of 2, so the next record will be out.

> Looks like a good idea to me. Real EEG must have the ability to
> mark data as bad. The only thing that confuses me is that you say
> it should be as fast as the fastest data stream but then just be 1
> bit per sample. Wouldn't that allow us a minimum data rate of
> fastest sample rate / 16? Or would that make the software too
> complicated?

Let's say you have EEG data at 200Hz, and temperature data at 10Hz.
Obviously you can use 1/10 sec as the record duration. In each record
there are 20 2-byte words for each EEG channel, and 1 2-byte word for
the temperature. If we use error flags at 200Hz, we need 20 of them,
which would take 2 2-byte words, with some bits left over.

That's how I was imagining it. It doesn't seem too hard to me to code
this.

> I agree completely on the practical requirement for CRC except for
> one thing. When going through the FDA (and I would be surprised if
> the European requirements were very different) you have to state
> what you did to ensure the validity of data at ALL points in the
> process ...
>
> Since it could be an extra data channel that wouldn't break any
> current EDF software, I will put it into anything that I do.

Okay, fine. If you are putting CRC and error bits into every file,
you could just have one extra channel that stores the CRC and the
error bits -- i.e. keep all your weird stuff together.

I was starting to wonder if this is all a bit too much of a hack, but
I've just read the EDF FAQ, an they actually suggest using signal
channels to store text annotations as well (at about 10cps, like a
teletype), so I think you are completely fine using a channel for CRC
and error-bit information! In fact, the more hacks the merrier with
this format, it seems.

> Is a chunk the same as a record in EDF?

Yes.

(From the other message:)
> What is the lower limit for data record size in EDF? I haven't been
> able to find that.

I don't think it is mentioned in the spec. However, they recommend
1s, and then suggest 0.01s if that is too large. I think the real
limit is what fraction you can express as an ASCII decimal within 8
characters. The smallest power of 1/2 I reckon you can fit in without
rounding is 1/64 (0.015625), or 1/128 if you miss off the leading 0
(.0078125).

Hmmm ... I seem to be acting like an expert on this format, even
though I only read the spec yesterday or the day before! This is all
very strange. However, I don't mind bouncing ideas around if it
helps.

> ( I haven't programmed anything but assembler for the last 15 years.
> I can't get my head around compilers or anything that needs CHECK
> BOXES or anything else that doesn't show up in a source listing.)

Emacs, bash and a bunch of console apps are my environment for doing
most things. White backgrounds and check boxes are about as far as
you can get from there!

Jim

-- 
Jim Peters (_)/=\~/_(_) jim_at_uazu.net
(_) /=\ ~/_ (_)
Uazú (_) /=\ ~/_ (_) http://
B'ham, UK (_) ____ /=\ ____ ~/_ ____ (_) uazu.net


This archive was generated by hypermail 2.1.4 : 2002-07-27 12:28:40 BST