def __init__(self, low_loss, high_loss, min_freq, max_freq, most_likely_freq, kurtosis=4): self.frequency_model = pert_frequency.PERTFrequency( min_freq, max_freq, most_likely_freq, kurtosis) self.magnitude_model = lognormal_magnitude.LognormalMagnitude( low_loss, high_loss) super(PERTLoss, self).__init__(self.frequency_model, self.magnitude_model)
def setUp(self): min_freq = 0 max_freq = 10 most_likely = 5 kurtosis = 1 self.s = pert_frequency.PERTFrequency(min_freq, max_freq, most_likely, kurtosis=kurtosis)
def test_draw_small(self): num_values = 100000 s = pert_frequency.PERTFrequency(0, 0.01, 0.005, kurtosis=1) total = sum(s.draw(num_values)) self.assertTrue(0.0040 < float(total) / float(num_values) < 0.006)