Exemplo n.º 1
0
def mytest_continuous_time(times, observations):
    # define a continuous-time statistics
    continuous_stat = Stat.ContinuousTimeStat(
        'Test continuous-time statistics', 0)

    for obs in range(0, len(times)):
        # find the increment
        inc = 0
        if obs == 0:
            inc = observations[obs]
        else:
            inc = observations[obs] - observations[obs - 1]
        continuous_stat.record(times[obs], inc)

    print('Testing continuous-time statistics:')
    print_results(continuous_stat)
Exemplo n.º 2
0
    def __init__(self, name, initial_size, sim_rep=0, collect_stat=True):
        """
        :param name: name of this sample path
        :param initial_size: (int) value of the sample path at simulation time 0
        :param sim_rep: (int) simulation replication of this sample path
        :param collect_stat: set to True to collect statistics on average, max, min, stDev, etc for this sample path
        """

        self.name = name
        self.simRep = sim_rep
        self.currentSize = initial_size     # current size of the sample path
        self._times = [0]                   # times at which changes occur
        self._values = [initial_size]       # size of this sample path over time
        # statistics on this prevalence sample path
        self.ifCollectStat = collect_stat
        if collect_stat:
            self.stat = Stat.ContinuousTimeStat(name=name, initial_time=0)