Donnerstag, 14. Januar 2010

how to read the database of sleep cycle and how to generate the same plots

1) copy the file /var/mobile/Applications/sleep cycle/Documents/eventlog.sqlite
to your pc.
2) use sqlitebrowser to open the file and to extract the data:
ZINTENSITY contains the data
ZTIME contains the time
ZSLEEPSESSION contains the session number (number of night)
-> the time is given in seconds since 1.1.1970
-> example: array=dblarr(2,200)
array(0,*)=ZTIME
array(1,*)=ZINTENSITY
3) for plotting:
->subtract the time of the first element from all times (remove the time offset)
array(0,*)=array(0,0)
->generate an empty array with the same number of elements as you have seconds
arind=fltarr(max(array(0,*)))
->put your data to that positions where the time was recorded.
arind(array(0,*))=array(1,*)
-> plot the data with plot,smooth(smooth(smooth(at,1001),1001),1001)

Keine Kommentare: