Matching data sent over TCP to saved BDF data

Post Reply
agruver
Posts: 2
Joined: Mon Jun 26, 2023 6:18 am

Matching data sent over TCP to saved BDF data

Post by agruver »

Hi all,

I'm having trouble testing my code for receiving ActiveTwo data over the TCP connection and making sure it matches the saved BDF data.

I've seen the forum threads on how to convert the three bytes of data sent over TCP into an unsigned int, and then converting that unsigned into into a signed int with twos complement.

What's unclear to me is what this integer actually represents in terms of the raw data, and what manipulations need to be done on this signed int to get it to match the data saved for that timestamp in the BDF file.

If anyone has experience with this or advice, let me know!

Alex

agruver
Posts: 2
Joined: Mon Jun 26, 2023 6:18 am

Re: Matching data sent over TCP to saved BDF data

Post by agruver »

I thought about this a bit more and wanted to share my latest thinking in case it's helpful. It seems like there are a few different forum posts on this.

My pseudocode for converting TCP/IP to exactly match the data saved in the BDF file would be as follows
- 1) there are a few different forum posts on the right way to get the individual 24 bit samples for each channel and time point. Let's assume that you're able to store the 24 bits
- 2) Unpack those bits into a signed int using twos complement (using https://stackoverflow.com/questions/378 ... 79#3783679 for example)
- 3) Mean signal correction -- it seems to me that this is happening automatically in the saved BDF files, and we should be subtracting the average of the data points for each channel in each TCP packet if we want the values to match
- 4) convert to nV using a scaling of lsb == 31.25 nV

I'm not completely sure if this is the right, so would appreciate any feedback

Post Reply