maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   All about SleepAnalyser (https://talk.maemo.org/showthread.php?t=57419)

mmlado 2010-08-21 07:15

Re: [ANNOUNCE]: SleepAnalyser
 
Could you add a new option, checkbox, which when checked the application stops recording movement when the alarm is started.
As it is now I always get a big spike at the end, probably because I'm lifting up the N900 to hit the button to turn off the alarm.

It has the duration of the whole sleep. It would be nice to know the duration of REM sleep to.

kamil365 2010-08-21 08:55

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by convulted (Post 793591)
This is a bug in data.py, and happens when the config file is not found. "Sample_smoothing = ..." in data.py needs to change to "sample_smoothing = ...". (Or, "sample_smoothing" in main.py needs to change to "Sample_smoothing". Not sure.)

I've had the same problem. I've changed "Sample_smoothing = ..." into "sample_smoothing = ..." and now it's working like a charm:) thx

mirakels 2010-08-21 11:16

Re: [ANNOUNCE]: SleepAnalyser
 
I played with Yscale a bit and noticed that triger levels are influenced by it. To fix this I made the following change:
Code:

--- functions_record.py.org    2010-08-21 12:07:17.000000000 +0200
+++ functions_record.py 2010-08-21 13:07:09.000000000 +0200
@@ -103,7 +103,8 @@
            Xder=0
            Yder=0
            XYder=0
-        records.arrData[3][i]=min(XYder*data.Yscale,  data.Ysize-17) #cut off if higher than graph border
+#        records.arrData[3][i]=min(XYder*data.Yscale,  data.Ysize-17) #cut off if higher than graph border
+        records.arrData[3][i]=XYder
        records.arrData[4][i]=lastindexovertrigger
 #        if(records.arrData[3][i]>data.Trigger): #over trigger
 #            lastindexovertrigger=i
@@ -304,7 +305,8 @@
            if(records.arrData[3][p+j]>peak): peak=records.arrData[3][p+j]
        x=i/Xscale
 #        x=i/Xscale+1
-        paint.drawLine(x, data.Ysize-peak-1-15, x, data.Ysize-1-15)  #draw yellow movement bar
+        h=min(peak*data.Yscale,  data.Ysize-17) #cut off if higher than graph border
+        paint.drawLine(x, data.Ysize-h-1-15, x, data.Ysize-1-15)  #draw yellow movement bar
       
       
        if(peak>data.Trigger):

the changes just applies the scaling at drawing time and does not change the actual measurements data!

With this change you can savely change the yscale parameter in the SleepAnalyser.conf file.

My 'movements' are inte order of 10 to 20. With a yscale of 1 the graph is quite difficult to read. Using yscale=4 gives me a much nicer view of the record.

mirakels 2010-08-21 11:20

Re: [ANNOUNCE]: SleepAnalyser
 
The durations are still printed using AM/PM format. The follwong change fixes that:

Code:

--- main.py.org 2010-08-21 12:07:23.000000000 +0200
+++ main.py    2010-08-21 13:18:25.000000000 +0200
@@ -725,7 +725,7 @@                                                                                                                         
 #        diff_tuple=Seconds2Tuple(diff_sec)                                                                                                 
 #        print diff_tuple,  records.StartTime_tuple,  EndTime_tuple                                                                         
 #        diff=strftime("%H:%M:%S", diff_tuple)                                                                                             
-        diff=time.strftime("%X", time.gmtime(diff_sec))                                                                                     
+        diff=time.strftime("%H:%M:%S", time.gmtime(diff_sec))                                                                               
        if(diff_sec>86400): d="1 day, " #longer than 24h                                                                                   
        else: d=""                                                                                                                         
        self.ui.lblTimes.setText(str(d0)+"  -  "+str(d1)+"  (Duration: "+d+str(diff)+")")                                                   
@@ -1157,7 +1157,7 @@                                                                         
            d1=strftime("%a. %d.%m.%Y  %H:%M:%S", EndTime_tuple)                       
                                                                                         
        diff_sec=records.Index*records.Sampling_interval*records.Value_smoothing/1000   
-        diff=time.strftime("%X", time.gmtime(diff_sec))                                 
+        diff=time.strftime("%H:%M:%S", time.gmtime(diff_sec))                           
                                                                                         
        if(diff_sec>86400): diff="1 day, "+diff #longer than 24h


rm42 2010-08-21 12:27

Re: [ANNOUNCE]: SleepAnalyser
 
Just installed from devel (never installed before) and the app won't start.

convulted 2010-08-21 13:54

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by rm42 (Post 793903)
Just installed from devel (never installed before) and the app won't start.

This seems to be a known issue. See post #107 and post #109. It would be best to let the developer fix this problem if you don't understand how to apply the fix in post #109.

caco3 2010-08-21 21:28

Re: [ANNOUNCE]: SleepAnalyser
 
Wow, what a great response :)

Thank you all for the ideas and the bug fixes.
I fixed the config bug, added the stop function (mmlado's request) and corrected the displayed duration time (thanks to mirakels).
I also included mirakels change for Yscale, how ever I do not suggest to increase Yscale. If I have it bigger than 1, I mainly see noise.
Maybe you can show us some screenshots?

@mmlados:
I do not see a way to properly detect when you are in the REM. Because of that i also do not know how to measure its time.
Maybe in a later version, when we have more expirience with the data.

Please check the latest version and report any bugs.

mirakels 2010-08-22 09:26

Re: [ANNOUNCE]: SleepAnalyser
 
2 Attachment(s)
I guess it all depends on what th trigger level will be (e.g. how soft your matras is and how wild youre movements are during the night :)

Anyway here are two screenshots. One with Yscale=1 and one with Yscale=4.

I thing the one with yscale=4 shows a much better picture...

caco3 2010-08-22 12:12

Re: [ANNOUNCE]: SleepAnalyser
 
Hmm, I see, your graphs are indeed much smaller. Either you have a much harder matress, put your phone further away or have a very smooth sleep :)

I guess I should add Yscale to the config screen.
How ever as it is already full, I first have to figure out how to make it scrollable.

eitama 2010-08-22 12:26

Re: [ANNOUNCE]: SleepAnalyser
 
Hey Hey!

The last 3 versions before this one, did not start on my device.
Today I updated, fired it up, and it's now running!

Gonna try it tonight!!! Woohoo!

Cheers mate!


All times are GMT. The time now is 12:09.

vBulletin® Version 3.8.8