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
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'
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
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])
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.
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.
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
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!