{"action":"created","issue":{"url":"https://api.github.com/repos/tomopy/tomopy/issues/183","repository_url":"https://api.github.com/repos/tomopy/tomopy","labels_url":"https://api.github.com/repos/tomopy/tomopy/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/tomopy/tomopy/issues/183/comments","events_url":"https://api.github.com/repos/tomopy/tomopy/issues/183/events","html_url":"https://github.com/tomopy/tomopy/issues/183","id":143489017,"number":183,"title":"Emission=False changes data in place","user":{"login":"dmpelt","id":3531031,"avatar_url":"https://avatars.githubusercontent.com/u/3531031?v=3","gravatar_id":"","url":"https://api.github.com/users/dmpelt","html_url":"https://github.com/dmpelt","followers_url":"https://api.github.com/users/dmpelt/followers","following_url":"https://api.github.com/users/dmpelt/following{/other_user}","gists_url":"https://api.github.com/users/dmpelt/gists{/gist_id}","starred_url":"https://api.github.com/users/dmpelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmpelt/subscriptions","organizations_url":"https://api.github.com/users/dmpelt/orgs","repos_url":"https://api.github.com/users/dmpelt/repos","events_url":"https://api.github.com/users/dmpelt/events{/privacy}","received_events_url":"https://api.github.com/users/dmpelt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-25T12:24:01Z","updated_at":"2016-03-30T15:32:57Z","closed_at":null,"body":"I tried an old reconstruction script with the current master branch, and the results of repeated reconstruction calls were incorrect because the handling of `emission=False` changed (I think after #162).\r\n\r\nAfter #162, using `emission=False` changes the data in place. This is probably a good idea for optimization, and does not affect a single reconstruction call, but it means that a different reconstruction call afterwards reapplies the data change, which results in incorrect reconstructions.\r\n\r\nThis will reproduce the problem:\r\n\r\n```\r\nrec = tomopy.recon(prj, theta, center=best_center, algorithm='gridrec', emission=False)\r\ntomopy.io.writer.write_tiff_stack(rec, fname='./gridrec/rec', start=sino_start)\r\n\r\nrec = tomopy.recon(prj, theta, center=best_center, algorithm='gridrec', emission=False)\r\ntomopy.io.writer.write_tiff_stack(rec, fname='./gridrec2/rec', start=sino_start)\r\n```\r\n\r\nThe first call will have correct reconstructions, the second one will be incorrect. In my case, it caused problems since I wanted to try different reconstruction methods in a single script using multiple calls, and only the first call had a correct reconstruction. If you change the calls _after_ the first one to `emission=True`, the reconstructions are correct, since the emission correction already has been applied.\r\n\r\nI don't know what the best solution for this is, but I think there are at least two possibilities:\r\n\r\n1. Change the `emission=False` handling to create a copy like the previous versions. This might have some negative impact on performance and memory requirements.\r\n2. Move the `emission=False` handling to a separate preprocessing method, so it can be called only once before reconstruction if needed. Something like: `prj = tomopy.linearize(prj)` or something. This can be done inplace, so should not have a negative impact on performance, but it will make the code not backwards compatible.\r\n\r\nWhat do you think?"},"comment":{"url":"https://api.github.com/repos/tomopy/tomopy/issues/comments/203490330","html_url":"https://github.com/tomopy/tomopy/issues/183#issuecomment-203490330","issue_url":"https://api.github.com/repos/tomopy/tomopy/issues/183","id":203490330,"user":{"login":"dgursoy","id":1311208,"avatar_url":"https://avatars.githubusercontent.com/u/1311208?v=3","gravatar_id":"","url":"https://api.github.com/users/dgursoy","html_url":"https://github.com/dgursoy","followers_url":"https://api.github.com/users/dgursoy/followers","following_url":"https://api.github.com/users/dgursoy/following{/other_user}","gists_url":"https://api.github.com/users/dgursoy/gists{/gist_id}","starred_url":"https://api.github.com/users/dgursoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgursoy/subscriptions","organizations_url":"https://api.github.com/users/dgursoy/orgs","repos_url":"https://api.github.com/users/dgursoy/repos","events_url":"https://api.github.com/users/dgursoy/events{/privacy}","received_events_url":"https://api.github.com/users/dgursoy/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T15:32:57Z","updated_at":"2016-03-30T15:32:57Z","body":"Let's have it as a separate function first, and we can afterwards add it as an optional argument in normalization functions. What to call this function? Simply ```tomopy.minus_log```, which is very direct and true?"}}