Ejemplo n.º 1
0
    def set_sleep_params(self, start_mean, start_std, end_mean, end_std):

        """
        This function sets the biological sleep parameters themselves and the sleep parameter distribution functions.

        :param int start_mean: the mean sleep start time [minutes]
        :param int start_std: the standard deviation of start time [minutes]

        :param int end_mean: the mean sleep end time [minutes]
        :param int end_std: the standard deviation of end time [minutes]
        :return: None
        """

        DAY_2_MIN = temporal.DAY_2_MIN

        # set the standard deviation of the sleep duration
        self.sleep_start_mean, self.sleep_start_std     = start_mean, start_std
        self.sleep_end_mean, self.sleep_end_std         = end_mean, end_std

        self.sleep_start    = self.sleep_start_mean
        self.sleep_end      = self.sleep_end_mean
        self.sleep_dt       = (self.sleep_end - self.sleep_start) % DAY_2_MIN

        self.f_sleep_start  = mg.set_distribution(-self.start_trunc, self.start_trunc, self.sleep_start_mean, \
                                                   self.sleep_start_std)

        self.f_sleep_end    = mg.set_distribution(-self.end_trunc, self.end_trunc, self.sleep_end_mean, \
                                                    self.sleep_end_std)

        return
Ejemplo n.º 2
0
    def __init__(self):

        DAY_2_MIN = temporal.DAY_2_MIN

        # the gender
        self.gender = FEMALE

        # the age [years]
        self.age    = AGE

        # biology related to sleeping
        self.sleep_start_mean   = SLEEP_START_MEAN
        self.sleep_start_std    = SLEEP_START_STD
        self.sleep_start        = self.sleep_start_mean
        self.sleep_start_univ   = 0

        self.sleep_end_mean     = SLEEP_END_MEAN
        self.sleep_end_std      = SLEEP_END_STD
        self.sleep_end          = self.sleep_end_mean
        self.sleep_end_univ     = 0

        self.sleep_dt           = (self.sleep_end - self.sleep_start + 1) % DAY_2_MIN

        self.start_trunc        = SLEEP_START_TRUNC
        self.end_trunc          = SLEEP_END_TRUNC

        # these are the probability distributions for sampling start and end times
        self.f_sleep_start  = mg.set_distribution(-self.start_trunc, self.start_trunc, self.sleep_start_mean, \
                                                    self.sleep_start_std)

        self.f_sleep_end    = mg.set_distribution(-self.end_trunc, self.end_trunc, self.sleep_end_mean, \
                                                    self.sleep_end_std)

        return
Ejemplo n.º 3
0
    def __init__(self, id=BREAKFAST, start_mean=BREAKFAST_START_MEAN, start_std=BREAKFAST_START_STD, \
                 start_trunc=BREAKFAST_START_TRUNC, dt_mean=BREAKFAST_DT_MEAN, dt_std=BREAKFAST_DT_STD, \
                 dt_trunc=BREAKFAST_DT_TRUNC):

        self.id = id

        self.start_mean = start_mean
        self.start_std = start_std
        self.start_trunc = start_trunc

        self.dt_mean = dt_mean
        self.dt_std = dt_std
        self.dt_trunc = dt_trunc

        self.t_start = self.start_mean
        self.dt = self.dt_mean

        self.f_start = mg.set_distribution(-self.start_trunc, self.start_trunc,
                                           self.start_mean, self.start_std)
        self.f_dt = mg.set_distribution(-self.dt_trunc, self.dt_trunc,
                                        self.dt_mean, self.dt_std)

        self.t_start_univ = 0
        self.day = 0

        return
Ejemplo n.º 4
0
    def set_work_distribution(self):
        """
        This function sets the following distributions for work:
        
        * work start time distribution
        * work end time distribution
        
        :return: None 
        """

        self.f_work_start   = mg.set_distribution(-self.work_start_trunc, self.work_start_trunc, \
                                                  self.t_start_mean, self.t_start_std)

        self.f_work_end     = mg.set_distribution(-self.work_end_trunc, self.work_end_trunc, \
                                                  self.t_end_mean, self.t_end_std)
        return
Ejemplo n.º 5
0
    def set_meal(self, id, start_mean, start_std, start_trunc, dt_mean, dt_std,
                 dt_trunc):
        """
        This function sets the values associated with the Meal object.

        :param int id: the meal type (breakfast, lunch, or dinner)
        :param int start_mean: the mean start time of the meal [minutes, time of day] 
        :param int start_std: the standard deviation of start time [minutes]
        :param int start_turnc: the number of standard deviations in the start time distribution        
        :param int dt_mean: the mean duration of a meal [minutes]
        :param int dt_std: the standard deviation of meal duration [minutes]
        :param int dt_trunc: the number of standard deviations in the duration distribution
                
        :return: None
        """

        self.id = id

        self.start_mean = start_mean
        self.start_std = start_std
        self.start_trunc = start_trunc

        self.dt_mean = dt_mean
        self.dt_std = dt_std
        self.dt_trunc = dt_trunc

        self.t_start = self.start_mean
        self.dt = self.dt_mean

        self.f_start            = mg.set_distribution(-self.start_trunc, self.start_trunc, self.start_mean, \
                                                      self.start_std)
        self.f_dt, self.dt_std  = mg.set_distribution_dt(-self.dt_trunc, self.dt_trunc, self.dt_mean, self.dt_std, \
                                                         x_min=DT_MIN)

        return