sum_likelihood.py 497 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# -*- coding: utf-8 -*-

from likelihood import Likelihood


class SumLikelihood(Likelihood):
    def __init__(self, likelihoods):
        self.likelihoods = []
        for likelihood in likelihoods:
            assert isinstance(likelihood, Likelihood)
            self.likelihoods += [likelihood]

    def __call__(self, observables):
        likelihood = 0
        for current_likelihood in self.likelihoods:
            likelihood += current_likelihood(observables)

        return likelihood