I want to create a function such that it when I enter a list as an argument, it'll take each individual item from that list, pass it through the function, and then return a list as the result.
In the end I want to display the results as a table where it displays the values of the input list and the output list so that you can see the data you entered and the results.
sigmas = [0.01,0.1,1,5,10,25,50]
def reconstruct (sigma=[]):
nx = 400
ny = 400
theta = np.linspace(0.,180,nx)
image = shepp_logan_phantom()
sgram = radon(image, theta=theta)
sgram_noisy[i] = sgram + sigma[i] * np.random.randn(nx, ny)
reconstruction[i] = iradon (sgram_noisy[i], theta=theta)
error[i] = np.linalg.norm(image-reconstruction[i])/np.linalg.norm(image)
header = [r'$\sigma$','Error']
tb = zip(sigma, error)
table = print (tabulate(tb,headers=header))
return table
test = reconstruct(sigmas)
How do I modify the code so it can do this?