I would like to produce a random data of baby sleep time, but I want the random data to behave similar (not have to be exact match) as the following graph: (This is just an imaginary data, please don't conclude anything from this, specially not when your baby should sleep :) )
The output that I want to produce is something like:
Baby name Sleep start Sleep end
Noah 2016/03/21 08:38 2016/03/21 09:28
Liam 2016/03/21 12:43 2016/03/21 15:00
Emma 2016/03/21 19:45 2016/03/22 06:03
So I thought I will create a weights table of time of day and weight (for the chance that a baby will sleep). The question is how would I generate from this weights table a random data of a range of time to sleep?
(Think about if a baby start to sleep at around 8am, most likely he/she will wake in the next two hours and not continue to sleep more, and almost certainly won't sleep till 7am).
Is there another way you would build this (without the weights table)?
I prefer to build this in python(3), but I would appreciate the general algorithm or lead to the solution.
Aucun commentaire:
Enregistrer un commentaire