Hello Guest, Welcome to Apnea Board !
As a guest, you are limited to certain areas of the board and there are some features you can't use.
To post a message, you must create a free account using a valid email address.

or Create an Account


New Posts   Today's Posts

how to edit SPO2 files?
#1
how to edit SPO2 files?
I'm still trying to get my SD card to work a 2nd time in my CPAP. I put it back in and waited a week, now my computer doesn't see the SDCARD.
Anyway, I've got Sleepyhead running and imported SPo2 data for 10 days, but the data is not accurate. I looked in the CSV files and the first 2-10 lines of the first minute are invalid. If I start recording and then put the finger sensor on the first minute is garbage data and if I start recording after it is on then the 1st few readings are garbage. 

I can manually remove these entries in the .csv file using Excel, but it doesn't change what is showing when I open the SPO2 file, so the low O2\pulse readings on the reports are inaccurate.

Is there a way to delete\ignore the erroneous data?
Thank You
John
Post Reply Post Reply
#2
RE: how to edit SPO2 files?
I haven't had that problem; mine either gives me garbage all night (or session – sometimes I've used it while napping) or gives me fairly accurate results.

How are you getting the data?  Perhaps you will get better results if you do it the other way.  e.g., if you're importing the data files SpO2 Assistant creates, maybe importing directly from the oximeter will give better data.  (Serious problem with that, as there would be no way to correct the date/time that the CMS50F mangles.)

It seems that your unit is broken and needs to be fixed or replaced.  Even if you could edit out the garbage, it will be a never-ending chore.  jus' sayin'
Post Reply Post Reply
#3
RE: how to edit SPO2 files?
Thanks for the info. I'm going to try to write a little program to read the 10th (or so) reading and change the 1st 10 readings to match. It appears it might be too much trouble to remove the data from the SPO2 file. I wasn't able to find much info on the Internet last night for the file format, but will look again today.

In case it helps, the CMS-50D+ will not work in sunlight or if your finger shakes.
John
Post Reply Post Reply
#4
RE: how to edit SPO2 files?
You may have already discovered that the data are saved in EDF format.  (I looked into it when my frustration overcame my common sense and looked into writing an app(let) to read data on the CMS50 devices – which I quickly acknowledged was beyond my capability.  However, I was able to convert my frustration into disgust, "so there!", you Chinee [filthyword]) Dont-know
Post Reply Post Reply
#5
RE: how to edit SPO2 files?
I wrote this program to add the date and time to spo2 files. http://www.apneaboard.com/forums/Thread-...-SPO2-file

I'll see if i can dig up the info I referenced for the file format.
Post Reply Post Reply
#6
RE: how to edit SPO2 files?
(06-15-2018, 08:49 AM)adrinef Wrote: I wrote this program to add the date and time to spo2 files. http://www.apneaboard.com/forums/Thread-...-SPO2-file

I'll see if i can dig up the info I referenced for the file format.

I would dearly appreciate a brain-dump of your wisdom as well.
Post Reply Post Reply
#7
RE: how to edit SPO2 files?
This is a breakdown of the spo2 file structure as outlined by Mark Watkins(Jedimark)
https://sourceforge.net/p/sleepyhead/bugs/207/#29d9

Quote:The basic file format for anyone who's interested is as follows..
(This ignores any user specified record fields, just the bits needed to read into sleepyhead)
First two bytes contain starting position of the second header.
Second header starts with 200 (decimal) bytes of cruft 
Followed by a list of 32bit integers containing 
year, month, day, hour, minute, second,
followed by 32bit integer containing number of samples,
followed by a list of 8bit pairs containing SpO2 and pulse rate till the end of file.


This is how I read the binary info from the spo2 file in VB.NET.  I stopped after reading the number of samples.  I don't remember if I even tried reading the spo2 and pulse rate, If I get a chance I'll mess around with it.

Code:
Using file_stream As FileStream = New FileStream(filepath, FileMode.Open, FileAccess.Read)
            Using binary_reader As BinaryReader = New BinaryReader(file_stream)
                dateheaderposition = binary_reader.ReadInt16 + 200  
                binary_reader.BaseStream.Seek(dateheaderposition, SeekOrigin.Begin)
                txtyear.Text = binary_reader.ReadInt32
                txtMonth.Text = binary_reader.ReadInt32
                txtday.Text = binary_reader.ReadInt32
                txthour.Text = binary_reader.ReadInt32
                txtminute.Text = binary_reader.ReadInt32
                txtseconds.Text = binary_reader.ReadInt32
                txtnumofsamples.Text = binary_reader.ReadInt32
            End Using
        End Using


This is how I write the new date and time values back to the spo2 file.


Code:
Using file_stream As FileStream = New FileStream(filepath, FileMode.Open, FileAccess.ReadWrite)
            Using binary_writer As BinaryWriter = New BinaryWriter(file_stream)
                binary_writer.Seek(dateheaderposition, SeekOrigin.Begin)
                binary_writer.Write(yeartowrite)
                binary_writer.Write(monthtowrite)
                binary_writer.Write(daytowrite)
                binary_writer.Write(hourtowrite)
                binary_writer.Write(minutetowrite)
                binary_writer.Write(secondstowrite)
            End Using
        End Using
Post Reply Post Reply
#8
RE: how to edit SPO2 files?
(06-20-2018, 01:53 PM)adrinef Wrote: This is a breakdown of the spo2 file structure as outlined by Mark Watkins(Jedimark)

This is how I write the new date and time values back to the spo2 file.
Aw, yew make it seem so simple! <blush>  Yer a wizzerd, and ah hope ah kin git ta be as smart as yew when ah git ta be as old as yew (~150 yrs)!
Fank yew, fank yew, ah'm berry grapful!
Post Reply Post Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting O2 Insight Pro files to OSCAR? [solution, see post 32] SnoozeBest 31 1,727 Yesterday, 08:29 AM
Last Post: ar3thur
  Oscar program will not open data files raylock1 7 91 12-24-2024, 04:12 PM
Last Post: raylock1
Question Spo2 data format Squid3083 12 3,617 11-27-2024, 06:14 AM
Last Post: aradhana
  Export Wellue SpO2 data herenthere 0 177 11-25-2024, 07:37 PM
Last Post: herenthere
  O2 Insight Files to Oscar channeal 5 322 10-30-2024, 09:31 AM
Last Post: channeal
Question Directly edit Oscar Data dgconder 3 440 10-15-2024, 10:34 PM
Last Post: Crimson Nape
  OSCAR SpO2 CSV import ST Dog 29 6,061 09-11-2024, 05:36 PM
Last Post: Toolworker


New Posts   Today's Posts


About Apnea Board

Apnea Board is an educational web site designed to empower Sleep Apnea patients.