I have a very simple algorithm that implements the Iterative Bayesian Unfolding algorithms and that deals with lists. Here is the code:
def IBU(m,t0,Rin,n): """ this is the implementation of IBU. args: m (list): the measured distribution. t0 (list): the prior truth spectrum often chosen as a uniform distribution. Rin (ndarray): the response matrix. n (int): number of iterations. Returns: returns a list representing the approximate true distribution. """ tn = t0 for i in range(n): Rjitni = [np.array(Rin[:][i])*tn[i] for i in range(len(tn))] Pm_given_t = Rjitni / np.matmul(Rin,tn) tn = np.dot(Pm_given_t,m) pass return tn
So I wonder if such a Tufold implementation is possible.
(i.e. you give it the list representing the measured distribution and the algorithm corrects it via Tufold and gives you the corrected distribution).
Thaks for helping