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)

caco3 2010-06-30 23:56

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by paulkoan (Post 736378)
I tried this last night, but I am not sure of the appropriate trigger level if sharing a bed with someone.
;)

I cant help you on that :)
For the iPhone application they write in the FAQ that it works well when you have it on the outboard side of your bed. I expect it should work similar ond my app as your body stops the movement from your partner.

realsportcars 2010-07-01 00:15

Re: [ANNOUNCE]: SleepAnalyser
 
Really nice app! i always wanted something like this :)

I will try it soon!

ossipena 2010-07-01 04:55

Re: [ANNOUNCE]: SleepAnalyser
 
are you able to open recorded logs?

I get this error when trying:
Code:

Traceback (most recent call last):
  File "/opt/SleepAnalyser/main.py", line 121, in ShowLogWindow
    OpenLogFile()
  File "/opt/SleepAnalyser/myFunctions.py", line 83, in OpenLogFile
    file = open(data.logfilename, 'r')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 55: ordinal not in range(128)


devu 2010-07-01 05:09

Re: [ANNOUNCE]: SleepAnalyser
 
Thanks! ...and good night.. or actually morning here. I definitely need to work out my sleep cycles ;)

gsever 2010-07-01 05:16

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by paulkoan (Post 736378)
I tried this last night, but I am not sure of the appropriate trigger level if sharing a bed with someone.

I realise I may be the only one here doing that.

;)

Like face detection based motion control approach in some games, this tool best works for singles or single sleepers to the very least :P

When I have a better setup I will intra-compare the results from full audio and video recording of my sleep.

erniadeldesktop 2010-07-01 05:59

Re: [ANNOUNCE]: SleepAnalyser
 
1 Attachment(s)
here you go, day 2!
I'm going to update now to the last ver., so those data are still .12;
anyhow, I've found an other bug in this version, that I suppose you've already solved in the new one: the elapsed time counter starts from 1h.
btw for who's interested in batt consumption, today mine dropped from 29% to 10%. Again battery graph shows this strange behaviour where the first hour is consuming more.

last remarks: may you add a "pause" button?

ndi 2010-07-01 09:30

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by lwa (Post 734986)
[links]

...just putting them out there for someone to flag them for moderation/closure then :P

Those are religion related apps, and people discussing application and availability. My reply was discussing beliefs themselves, and that's not allowed. (spirit of the law thing).

--

My graph is wild. At default trigger I get spots of red, no green. Green appears at 31 trigger in player. Also, my graph looks like a forest, all peaks. I'm quite sure my accelerometer works, I've used it before with success.

Also, in the latest version of the viewer modifying trigger level no longer updates the line and green-red bar until "next record" is pressed.

Does the record trigger level work?

I am now recording a baseline with the phone on a concrete surface.

gsever 2010-07-01 10:47

Re: [ANNOUNCE]: SleepAnalyser
 
1 Attachment(s)
A nice scientific study could be conducted using the data from this application.

Here is my two day sleeping results. Last night I went to bed an hour later than the previous night. From the graphs my quietest sleeping time is around 4 am. I am not sure this means I get the best sleep at this time and my brain charge itself best there. We definitely need more data and perform the experiments under same conditions :D Hah also need correlation plots for better statistical interpretation, plus some more physical understanding on the subject.

Any sleeping experts around?

ndi 2010-07-01 11:19

Re: [ANNOUNCE]: SleepAnalyser
 
Oh, enhancement request: Can we have a debugging mode where the app records faster? Instead of 10 seconds, snap every, say, 2 or so so we can see what's wrong?

juise- 2010-07-01 11:37

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by ndi (Post 736811)
My graph is wild. At default trigger I get spots of red, no green. Green appears at 31 trigger in player. Also, my graph looks like a forest, all peaks. I'm quite sure my accelerometer works, I've used it before with success.

Check out you haven't changed the hostname on you N900. The app seems to use hostname to determine whether it is running on real hardware or not, and generates random data if it thinks it's not on the N900.

Edit: Here's the piece of code reponsible for checking the hostname (main.py, line 52 ->)

Code:

    #if not on the N900, a acceleration sensor has to be simulated
    uname=os.uname()
    if(uname[1]=="Nokia-N900"): data.demo=0        #runs on real N900 hardware
    else: data.demo=1        #runs on other hardware/OS

My short fix: add following right after above block:
Code:

    data.demo=0
os.uname()[1] reads 'bulletproof' on my N900. :)

juise- 2010-07-01 11:39

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by ossipena (Post 736597)
are you able to open recorded logs?

I get that too, using the Finnish locale on my N900.

Rename the log file so that the non-ascii character (likely in month name) is removed.

ndi 2010-07-01 11:56

Re: [ANNOUNCE]: SleepAnalyser
 
1 Attachment(s)
Quote:

Originally Posted by juise- (Post 736945)
Check out you haven't changed the hostname on you N900. The app seems to use hostname to determine whether it is running on real hardware or not, and generates random data if it thinks it's not on the N900.

a) host name is "Nokia-N900-42-11"

b)I have power kernel, so uname -a reports

Linux Nokia-N900-42-11 2.6.28.10power37 #1 PREEMPT Wed May 26 00:24:03 EEST 2010 armv7l unknown

How do you get the host name?

Also, attached is the graph of the phone sitting quietly on a firm surface.

codeMonkey 2010-07-01 13:11

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by juise- (Post 736945)
Check out you haven't changed the hostname on you N900. The app seems to use hostname to determine whether it is running on real hardware or not, and generates random data if it thinks it's not on the N900.

Ahh, thank you - that would explain my data too.

caco3 2010-07-01 22:59

Re: [ANNOUNCE]: SleepAnalyser
 
Hi all

Again a new version (1.0.17) :)
Thanks for all the feedback. Some I already implemented.

Change Log:
- Changed format for Log File.
- Improved UI.
- Added test Mode.
- Made algorithm better and improved speed.

Some notes:
The algorith for recording is still the same, so the old log files are still compatible! I only changed the algorith to generate the graph a bit. Now it should look more the same, independent on the zoom level.
Ther eis now a Test Mode. It samples 100 faster than normal (or limited by the CPU). This should help debugging.

And some developer questions:
- Does sombody know how to add icons to buttons?
I tried it with "self.ui.bZoomIn.setPixmap(QtGui.QPixmap(app_path+ "/zoom-in.png"))", but it did not work.
- Also does sombody know how I can redraw just parts of the graph? This might speed it up as well.
- I would like to scroll the graph with moving the graph around with your fingers (like in the browser). Does sombody know how to do that?
I am using Python with PyMaemo

Thank you for your interest

ndi 2010-07-02 08:09

Re: [ANNOUNCE]: SleepAnalyser
 
Hi. I still get random data. With the new test mode, it's easier to see :)

Why can't you use a file in /home to determin test rig, instead of the oddball host thing? touch ~/.testrig

attila77 2010-07-02 08:58

Re: New application: SleepAnalyser
 
Quote:

Originally Posted by windows7 (Post 734602)
on one note, for health & safety reasons I would highly recommend you turn wifi off, turn bluetooth off & set the phone mode to tablet mode...

Even then, I think having eletrical power next to your body might not be very healthy,

While the radio thing is under constant scrutiny for obvious reasons, the 'pure' electrical part is actually known to be nonsense. It usually stems from a few layman presumptions.

1. high tech means high powered.
2. The brain with it's neurons is easily affected by electrical devices
3. Most of the electrical power consumed by a device is radiated into the body

All of these are bogus. Remember, we're talking low voltage DC, no radio, no AC. Do you think wristwatches are dangerous ? For they are in direct contact with your body, often through a metal backplate. What about pacemakers ? Sure, all ungrounded electrical devices generate a certain electrical and magnetic field, but they are super-tiny (as in - the Earth's magnetic field affects you more than that). Hell, most people have ELECTRICAL ALARM CLOCKS (historically, there were AC powered and/or made with discrete components for DECADES) by their beds. That's orders of magnitude more effect (whatever it is) on the human body than your flight mode N900. Not to mention things like magnetically operated headsets in/on your head, neon lights, power lines., etc. It's like saying you should keep quiet in a storm, as, you know, speaking introduces additional air pressure so it only makes things worse.

PS. Yes, I'm an EE

caco3 2010-07-03 00:08

Re: [ANNOUNCE]: SleepAnalyser
 
Hi all

The version from yesterday had some bugs. They are now fixed in 1.0.19.

Changes:
- Bugsfixes
- Now it detects if you have a sensor device file (/sys/class/i2c-adapter/i2c-3/3-001d/coord9 to decide if it should run in demo mode.
- Uses a user name instead of part of the IMEI number to define who the records below to.


The algorithm:
Maybe you want to play with some of the parameters to see if it improves the data.
(As I am living on a moving ship, it is very hard to test)
The parameters can be changed in the file /home/user/.SleepAnalyser/SleepAnalyser.conf
Below the algorithm is described. names in "" are the parameters found in above file.
Make sure the application is closed before you change the parameters!

Every second ("sampling") it takes 10 ("sample_smoothing") samples.
They get added to each other (X and Y accelerations are keept separately).
Then it adds up 10 ("value_smoothing") of them up and saves it in an array.
Now thats the values which get written into the log file.

For the graph, I take the derivation of the data. This gives the CHANGE of the ACCELERATIONS (alias MOVEMENTS).
To do that I substract the value X5 minus X0, X6 minus X1 and so on, same for the Y values.
How big the difference between the idices for the derivation is, is controlled with "derivation" (here 5).
For the graph, the derivation values can be streched with "yscale".
If the values are too high, you might want to lower this value.

Now please keep in mind that the algorithm is not yet perfect. Please play with the parameters and let us know how it is the best for you.
Or maybe you know even a better algorithm?

Some questions for developers:
The builder script for py2deb (build_myapp.py) sais that the package name has to be lower case.
So how do I manage to get a upper case name in the package manager list?
(SleepAnalyser instead of sleepanalyser)
Also, how do I get an icon into the package manager list?

ndi 2010-07-03 14:13

Re: [ANNOUNCE]: SleepAnalyser
 
What I think to be bugs

* When deleting a record and (assumingly) no other record exists, the record says loaded. IMO, it should empty the data storage and null the graph, as well as blanking loaded file name.

* Modifying trigger increases the number, but does not move the line. To redraw, one needs to do to next record or zoom.

* At first app start, if I select to view log but cancel the loading dialog (which happens at least when there are no records), filename is "*.csv". I didn't want to press delete on that.

* When recording, elapsed time shows 00:00:00, followed by 02:00:01, 02:00:02. You might be using a time function that doesn't correctly adjust for timezone, as this is GMT+2.

What I think to be enhancements:

* When recording, a timeout would be nice. Start at -15 seconds or so, allowing one to lock the phone and set it down.

* When recording and the stop button is pressed, state says Records taken: <number> (stopped). In this case, the stop button should become a start button. The start button can either be a resume (pause) or a start over (stop)

Well, you know, in case you are bored :)

caco3 2010-07-03 22:08

Re: [ANNOUNCE]: SleepAnalyser
 
2 Attachment(s)
Thank you for your feedback.

I just made a new version (1.0.20) which corrected some of the bugs you found + some othe rimprovements:
- improved graph
- change of trigger now redraws graph
- log window only gets shown if a file is selected
- added some icons (more will come)

The other bugs/ideas I might fix/include later on.

Please see attached screen shots.
I changed the Xscale to 1 (instead 3).
This makes the real movements in the graph much more clear.
I suggest you to do it as well. Either by editing the config file (see above post) or by deleting it.
The first graph shows my sleep. At 7:40 I got up, but let the SleepAnalyser run for another hour.
Then in the 2nd graph I let it run for several hours on a table.
I am quit happy about the result, as it shows that it now should work properly and only detect real movements.

paulkoan 2010-07-04 03:08

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by ndi (Post 739590)
What I think to be bugs
* When recording, elapsed time shows 00:00:00, followed by 02:00:01, 02:00:02. You might be using a time function that doesn't correctly adjust for timezone, as this is GMT+2.

Yeah I get this too - I am in GMT+10 and my elapsed time starts at 10:00:00

(I haven't updated to latest so ignore if this is covered).

caco3 2010-07-04 20:28

Re: [ANNOUNCE]: SleepAnalyser
 
Hi all

I made a new version (1.1.2) with many bugfixes and improvements:
- Timezone bug fixed
- Graphs are drawn faster
- Better user interactions
- It now make a sound when you move in the test mode.
- It ask if ou want to save a file (useful in case you recorded rubbish)


Happy testing :)

attila77 2010-07-05 09:38

Re: [ANNOUNCE]: SleepAnalyser
 
Just a small note - the package uses PyQt but does not specify it as a dependency, which makes it unusable for people who have not installed a PyQt app previously. To fix this, you need to change the control file's depens line to something like:

Code:

Depends: python2.5, python2.5-qt4-gui (>> 4.7.3), python2.5-qt4-core (>> 4.7.3)

ndi 2010-07-05 16:39

Re: [ANNOUNCE]: SleepAnalyser
 
1 Attachment(s)
Finally, data.

Well, with your data and the partial system I implemented (I suspected a sleep disorder) I can safely say I'm as healthy as an ox. It's a miracle! :D

The last red up there was actually a test, I was awake but tried to see how it handled movement (slow, breathing, turning, etc).

Just a tiny observation: The SS says "Ende".

caco3 2010-07-06 21:17

Re: [ANNOUNCE]: SleepAnalyser
 
Hi all

I just made a new version (1.1.9).
This should now be a version we can use for creating lot of records.
I also made a PC version, so you can also have a look on the records on the PC.
If you have linux and python, just execute main.py. If you have windows, you will first have to install the python interpreter.
The PC GUI can be downloaded from https://garage.maemo.org/projects/sleepanalyser/ .

You still can post your records here, or send them to me as PM.
How ever, as I have a a very slow internet connection, I will not be able to have a look at them for the next couple of weeks.
It is easier to send it to me as an email, if you want (caco3 aT ruinelli DoT ch)

caco3 2010-07-10 23:10

Re: [ANNOUNCE]: SleepAnalyser
 
There is a new version (1.2.1) with new functions.
You can now add comments to a record.

caco3 2010-07-11 21:27

Re: [ANNOUNCE]: SleepAnalyser
 
SleepAnalyser finally reached the level to join Extras-Testing.
Please test the newest version and vote for it under http://maemo.org/packages/package_in...sleepanalyser/.

Thank you

ndi 2010-07-20 22:34

Re: [ANNOUNCE]: SleepAnalyser
 
1.4-3 fails install?

chmod: /opt/SleepAnalyser/main.py no such file or directory

ETA: there is no /opt/SleepAnalyser.

ndi 2010-07-21 14:33

Re: [ANNOUNCE]: SleepAnalyser
 
Uninstalling and reinstalling fixed it.

Also, link is bad (it ends in sleepanalyse, instead of ser). Site is odd, too, searching for the package also gives me a link ending in "e". Oh well.

I think the link should be this?

Oh, and, go offline when recording is on by default? IMO, not a good idea, leaving people without a phone/link/whatever.

JonWW 2010-07-21 15:00

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by ndi (Post 759274)
Oh, and, go offline when recording is on by default? IMO, not a good idea, leaving people without a phone/link/whatever.

I agree, only found this out when picking up the phone in the morning and noticed that it was offline. Not good.

jaguilar 2010-07-21 17:08

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by JonWW (Post 759316)
I agree, only found this out when picking up the phone in the morning and noticed that it was offline. Not good.

Go to settings and disable the feature.

caco3 2010-07-21 18:09

Re: [ANNOUNCE]: SleepAnalyser
 
Hi all thank you for the feedback.
The link of course should be http://maemo.org/packages/view/sleepanalyser/.

@ ndi & JonWW:
My phone tells me that it goes into Offline mode, so you can not really blame me to have not informed you :)
Anyway, you are right, it is not good to have it per default actvated. I changed now the default behaviour to not go into Offline Mode.

@ ndi:
I also had a missing folder /opt/SleepAnalyser when I upgraded to 1.4-3. However the package manager told me that the upgrade was not successful. I have no idea why it went wrong. I repeated it several times with different versions of SleepAnalyser, and it seems that the post install process made errors. I hope it works again in the next version, as I did not change anything on the build script.

Please test the new version.

ndi 2010-07-21 20:40

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 759680)
Hi all thank you for the feedback.
The link of course should be [...]

I still get a 404. Maybe it's a developer only link?

Quote:

Originally Posted by caco3 (Post 759680)
@ ndi:
Please test the new version.

No relief. Installed, errored, uninstall-reinstall. (1.4-5)

Same issue, error setting chmod because the folder isn't there. And, it really isn't. I thought upgrading meant basically uninstalling previous version and installing the next. In which case, why does install only work?

Does the package do something special on reinstall, maybe a cleanup that executes too late or has a space in it?

caco3 2010-07-21 22:08

Re: [ANNOUNCE]: SleepAnalyser
 
Hi ndi
Please wait for one of the next versions.
In the post install, I chmode the start file.
I do not understand why chmod gets executed but the file is not (yet) there.
As I anyway do not need this chmod,I will remove it from the post install.

And I guess I am getting too tiered. The link should be http://maemo.org/packages/view/sleepanalyser/.
No clue from where I had the old link :(

caco3 2010-07-22 01:03

Re: [ANNOUNCE]: SleepAnalyser
 
some builds of version 1.4 had broken packages.
Version 1.4-9 should now be ok.
It might be that you still get an error during the installation.
This is because the broken uninstall routine of the previouse package.

ssjtoma 2010-07-23 01:03

Re: [ANNOUNCE]: SleepAnalyser
 
1.4-12 won't start on my phone. I got the app last night and it was working fine. Got the update today, now its broken :/

EDIT: uninstall/reinstall solved the problem. pretty odd nevertheless

caco3 2010-07-23 21:15

Re: [ANNOUNCE]: SleepAnalyser
 
Quote:

Originally Posted by caco3 (Post 760101)
This is because the broken uninstall routine of the previouse package.

As you figured out, uninstalling the old version helps.
This should be fixed after you installed version 1.4-12 or newer once.

te37v 2010-07-23 21:25

Re: [ANNOUNCE]: SleepAnalyser
 
im guessing this wouldnt work with a memory foam matress? :p

ndi 2010-07-23 21:59

Re: [ANNOUNCE]: SleepAnalyser
 
Why not? It detects sudden changes.

caco3 2010-07-29 23:41

Re: [ANNOUNCE]: SleepAnalyser
 
Dear all

The current version in testing (1.4-15) seems to be quite bug free :)
It would be great if you could test it and then vote on http://maemo.org/packages/package_in...alyser/1.4-15/ , so we can get it into Extras soon.

Thanks a lot

rexii23 2010-08-03 09:34

Re: [ANNOUNCE]: SleepAnalyser
 
Thanks for this awesome program caco3!

I have a request, its probably is quite a long shot though.

I would like a function where I can trigger a mp3 file after the app detects that the person has been asleep for just over 1hr and will be entering REM sleep. This would be really cool for lucid dreaming where a mp3 will be triggered during REM sleep that hints to the user that he/she is dreaming. Hence increasing the chance of having a lucid dream!


All times are GMT. The time now is 15:39.

vBulletin® Version 3.8.8