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

Re words: positional motion accelerometer Somnopose Excel spreadsheet CSV GMT emulate
#1
Smile 
Re words: positional motion accelerometer Somnopose Excel spreadsheet CSV GMT emulate
This post shows limited progress toward use of OSCAR's Somnopose import "tool" to display a general purpose accelerometer's data from a CSV file. An accelerometer along with an Autoset and a Vauto and the help received here at AB squelched my OSA, a huge help from all.

The key words in my Thread Subject are dealt with below. They reflect matters grappled with to get to the point where I hope to help some other OSA apneic who may be searching as I did for a way to determine and portray what positions were best for sleep, what moves are made in sleep, and what are the results of corrective measures. To many apneics, especially the tech types, all of this very long post is (and may be) much adieu about nothing. Thinking-about


Yes, there is the video alternative which may now have a fast and OSCAR-synchronous way to (somewhat definitively and numerically) review and document such positional and movement habits in sleep. My earliest searches, probably faulty, found little available before finding the website of fellow apneic, "basementdwellingeek", and his posts of accelerometer work. I bought the general purpose device (manufacturer Gulf Data Concepts) he studied, a device neither jailed inside proprietary software nor wrist worn. I was happy then and now to find and benefit from the X-2-2 (Li ion) and cheaper X16 (alkaline) models. 


But it has been tedious though rewarding work to present those Xs' data graphically and synchronously integrated with OSCAR's graphics. The OSCAR graphic had to be pasted into an Excel spreadsheet where the X's data had been charted/graphed (see graphic "3" below). Then, to synchronize all data, the time scales had to be adjusted to match as well as the start times--those finicky tasks to be done with a shaky hand on a mouse. 


Now, as shown below, I am more than half way to direct and accurate OSCAR importation, integration and display of position and motion intensity data along with OSCAR's graphed sleep data. I simply paste the X's data table (from X's output CSV file) into a spreadsheet that converts it for Somnopose. Presently, I copy and paste that converted data into a CSV blank spreadsheet and then have OSCAR import that CSV file data and display the graphic. The converter has provision to enter and remove clock differences (Vauto vs X).

Many thanks to AB members pholynyk and sawinglogz who gave me a boost in my earlier Software Support forum thread by suggesting that I might emulate the OSCAR-compatible Somnopose software for the Somnopose motion sensing device (which I am doing). I have the adaptation of the Somnopose feature, Orientation (the left-right angular rotation from supine), worked out, but am asking for suggestions how to better utilize the other Somnopose feature, Inclination. (The latter displays the angle of the body's head-to-toes axis to the vertical: not an interesting angle for most persons who sleep at 90 degrees, but could easily be used for sleepers who must elevate their head). The Somnopose manufacturer's data table structure and a sample of my adaptation are shown in that earlier thread and post asking for help (which the two members gave me). 

Explanation and discussion of the graphics

The graphs overall:
Graphs 1-1, 1-2 and 2 display X2-2 accelerometer data as converted by an Excel spreadsheet that has been imported from a CSV spreadsheet directly into OSCAR with its Somnopose data import feature. Graph 1-1, of Orientation data, mirrors the blue colored trace of graph 3 as was generated by and in Excel from the same data.

Graphs 1-2 and 2: These are attempts to display bodily acceleration data in a manner similar to how that "suddenness-of-motion" information is conveyed in the green trace of Excel graph 3. (Note that the green trace has obscured all parts of the red and blue traces in graph 3 that the green trace overlies.)

Graph 1-2: The acceleration data may be too fine vs more granular data accepted by the Somnopose software for Inclination. It is structured to hold values from 0 to plus and minus 180 degrees. My body-part accelerations relative to 1 g ( gravitational acceleration 32 ft/per sec per sec) typically have a range >0.90 to <1.10--about 20lb difference either way--both of which graphic 1-2 seems to indicate Somnopose rounds down to 0.0 or to 1.0 as is shown by the small purple rectangles where acceleration has varied more (see that in 3, the green trace  from Excel).

Graph 2: This is one of several different attempts to more closely approximate the acceleration display of the green colored trace in 3. In this case acceleration was added to 10.00 and the result squared. It is a bit more reflective of the green in 3. Adding acceleration to some number from 1.0 upward and raising the result to various powers helped get more pleasing but hard to interpret dispersion or zoom effect. At least small moves not obvious in the Somnopose Orientation window become noticeable that way.

For now, showing z-coordinate data plotted in the Somnopose Inclination window has more value to me than the inferior Somnopose indications of accelerations no matter how magnified they may be shown at this time. 

(A deep in the weeds rambling explanation is offered here: In my on-side-only sleep, greater movement is often observed more in the z-coordinate than in the x-coordinate which yields the Somnopose Orientation and my Excel (L-R rotation) angles. Not understanding at first I could not see how an axis passing straight through me, through spinal column and navel, both at my navel height (in a standing position), could contribute as much to total acceleration as it often does--my thinking was the x-coordinate "says" all there is to say about significant angular rotations in the x-y plane. But not so. It is a matter of there being two parallel axes: one, the most important and analytically tractable one, of rotation around a body-central axis, that axis that passes from between ankles, through the "tween" and neck axis, and out the apex of the skull; the other being one half body width away and along the line of body length, shoulder to hip, which is in a  fixed, non-translating, but hinging contact with the mattress while lying on one side. Another way of looking at it is to remember a little math, that the rate of change of sine curve amplitude to the rate of change of angle is slowest at the maximum of the accelerometer's sine curve (when I am at 90 degrees from supine) and that the simultaneously measured rate is fastest at 90 degrees farther away, either way (at 180 or 270 degrees, as applies to the z-axis when I am turned 90 degrees from supine.

So rocking back and forth on my side, but not actually rotating around my central body axis can be very significant motion, associated or not, with leg or other body-part movements. I wonder, but am guessing that few commercial sleep-motion detecting devices measure such movements. Somnopose data is for only the two angles: one from standing through lying down to standing on hands inverted; the other from rotation about the central body axis when lying down. Possibly the other special motion sensing and reporting devices do measure overall spatial accelerations along x, y and z axes, which I still hope to have Somnopose present, given the overall view it gives of all gathered information. 


Graph 3: First, it omits only the y-coordinate data display which could be used by a sleeper who was concerned about sleeping with head elevated (whole body tilted) or one who is concerned about accelerations of the head along all three x, y, and z axes. Typically, for my side sleep at 90 degrees to the vertical with accelerometer against my lower back, the y- values only slightly reinforce motions reflected in x and z coordinates and they are always included in computing accelerations shown by the green trace.

Explanation of the boxed A through E parts of the graphs that mark the most noiticeable distinctives for May 13

A. There is Zero disturbance indicated there vs. motion shown in all other traces. 

B. Both Somnopose Orientation and Excel's blue trace portrayal of the same angular rotation understate the greater significance of the z-acceleration that shows in the green trace: this is due to acceleration picking up (primarily) the z-component of motion along with whatever contribution the y-component made.

C. The motions were not picked up in the "1-2" and "2" graphs and only slightly in the "1" graph. Comment at B applies here too, though the blue Excel trace irregularity is slightly more noticeable than the same-area portrayed by Somnopose in "1-1"(they are scaled alike).

D. and E. It seems clear in all of B, C, D, and E the comments at B and C apply. The Orientation graphic in Somnopose and the nearly identical blue trace of Excel capture most all of the gross motion and position data, but tend to be silent about suddenness of the more accelerated motions that the z-axis captures.

   

Seeing an overall acceleration stand-in in the z-axis motion component
Until some advance can be worked out--suggested I hope by others or possibly by suitably adding a figure to acceleration and raising that value to some exponential power--it seems worthwhile to use the Somnopose Inclination window for portrayal of the z-axis' contribution to acceleration from the "hinge" like rocking action. That will suggest the understatements of moves in the Somnopose and Excel rotation graphics.

Other matters that have come up in others' threads or in my work with accelerometers
 
Where to wear accelerometer
Two accelerometers, which can be affixed at most any point of interest (restless legs or PLM?) are better than one. One mounted on the more mobile and active head and another at the small of my back show a lot more and different motions to ponder. When my second one came with the rechargeable Li ion battery I wore both a couple of nights to see if it seemed worthwhile. No, not for me.

Somnopose time shift, if any
One member was concerned about a time shift by Somnopose. The answer lies in whether the intent is for Somnopose or Oscar or the users's data conversion spreadsheet (Excel or One Office in my case) is to handle the local vs GMT time difference, including the effect of the Daylight Time changes. The OSCAR-Somnopose team work fine for me in the -8 hr GMT zone which is now on Daylight time. My spreadsheet deducts 3600 seconds (1 hour) from the local time in my X2 to compensate for PDT. Regarding time: Masked up, auto-start on and ready to lie down, I start the Vauto, the X2 and my CMS50i oximeter all within one second and adjust later as necessary to have all agree with Vauto time wherever it drifts. Otherwise, synchronization is a hassle.


(No, my OCD has not reached the point of trying to determine the individual devices' time lags at their start ups. The problem is being an analytical type and fascinated  with OSA, pulmonological, cardio and blood matters. I see so many struggle with difficult, less treatable health matters than mine and I want to help where I might by sharing what has helped me a great lot.)

CSV files and spreadsheets
For those unfamiliar as I was with a quirk of comma delimited data as handled by Excel and CSV files it can drive you mad. Somonopose, I do believe, demands that all data elements other than date and indications of local clock time must be presented to the Somonopose program (inhabiting, for us, the OSCAR and SleepyHead programs) to two decimal places. Fine. But little did I know or take the right approach to find out that CSV files used by Excel will not show leading or trailing zeroes when opened up after a Save that did show the (my case) trailing zeroes when saved. 

For example, values of 60.00 and 5.10--complying with Somonopose's 2-decimal form when I Saved would come back to me as 60 and 5.1 no matter what I did to avoid that. Unknown to me, in most if not in all cases, the saved CSV file would still carry the two decimal form I saved when it was imported by Somnopose into OSCAR. Hours and hours were wasted! With the aid of a text editor I finally came to understand the CSV quirk. 

Accuracy of data and its presentation
The data is very useful but there are questions (minor ones I believe) that arise from anisotropic measures of forces. For example, the positive x-axis may have a limit of 6554 (the gravitational constant value for the low speed and sensitivity setting of the X2-2) and the negative axis a limit of -6400; the differences are within the instrument itself (and might have been caused by a careless drop of the instrument on a tile floor). The result is that the zero neutral axis is shifted parallel to but away from or toward the central horizontal axis of the graphs at the 0-degree supine position. Similarly the charted 1.0 central acceleration base (the horizontal green trace above) typically shows equal small offsets away from the intended central axis at 1.0. there is a jog in the horizontal trace when one rolls over to his opposite side. All said, absolute values have some error, but relative values that are presented are entirely adequate for my use.


Closing comment and request for constructive comment and corrections
Please help me correct errors above and suggest any ways you might see to show the acceleration values in the approximate range 0.9 to 1.1 g. Those do not show how much body mass is moving at the indicated acceleration from a 1.0 baseline. But some sense of what mass is moving can be gained when one considers where and how well the accelerometer is affixed to a body part.

I don't duplicate the sample X2-2 data and analysis of it that is in another Software Support Forum post I made. That post shows a starting analysis/data-conversion spreadsheet in a red colored font. There is a typo. The first column of time data in red colored font is in hours not seconds. Anyone who might wish to see the converter spreadsheet as it is now with fully converted data should PM me. Another post in that same thread has a Somnopose data structure table that is a "must read and comply" item.

Sleep well,

2SB
Post Reply Post Reply






Donate to Apnea Board  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Might an accelerometer masquerade as an oximeter and be put into OSCAR? 2SleepBetta 5 225 04-20-2020, 12:34 AM
Last Post: 2SleepBetta
  Somnopose data in OSCAR (time shift) georgelewisray 1 336 08-30-2019, 09:09 AM
Last Post: pholynyk
  Getting Sleepyhead data to Excel PhoebeAnn 6 496 04-22-2019, 03:44 PM
Last Post: PhoebeAnn
  CPAP Supply Replacement Schedule - Excel Sheet SleepFoo 2 640 01-19-2019, 09:03 PM
Last Post: herbm
  Can ResScan export DATA to Excel (or csv) file JimN262 2 1,243 01-03-2017, 11:13 AM
Last Post: JimN262


New Posts   Today's Posts






About Apnea Board

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