{"action":"created","issue":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/775","labels_url":"https://api.github.com/repos/nilearn/nilearn/issues/775/labels{/name}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/775/comments","events_url":"https://api.github.com/repos/nilearn/nilearn/issues/775/events","html_url":"https://github.com/nilearn/nilearn/pull/775","id":104884707,"number":775,"title":"Nilearn masker cache bugfix","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-04T12:48:59Z","updated_at":"2015-09-04T13:27:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/775","html_url":"https://github.com/nilearn/nilearn/pull/775","diff_url":"https://github.com/nilearn/nilearn/pull/775.diff","patch_url":"https://github.com/nilearn/nilearn/pull/775.patch"},"body":"Should fix nilearn/nilearn#771"},"comment":{"url":"https://api.github.com/repos/nilearn/nilearn/issues/comments/137737887","html_url":"https://github.com/nilearn/nilearn/pull/775#issuecomment-137737887","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/775","id":137737887,"user":{"login":"AlexandreAbraham","id":1647301,"avatar_url":"https://avatars.githubusercontent.com/u/1647301?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreAbraham","html_url":"https://github.com/AlexandreAbraham","followers_url":"https://api.github.com/users/AlexandreAbraham/followers","following_url":"https://api.github.com/users/AlexandreAbraham/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreAbraham/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreAbraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreAbraham/subscriptions","organizations_url":"https://api.github.com/users/AlexandreAbraham/orgs","repos_url":"https://api.github.com/users/AlexandreAbraham/repos","events_url":"https://api.github.com/users/AlexandreAbraham/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreAbraham/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T13:27:16Z","updated_at":"2015-09-04T13:27:16Z","body":"If I get it correctly:\r\n\r\n  * you change the default behavior of always loading data by not loading data\r\n  * you memmaped some cached results\r\n\r\nI think that we are trying to fight a losing battle. Nifti1Image is not stateless and hashing them is not reliable. Data can be memmapped, or not. Headers can be different with no difference whatsoever on the data.\r\n\r\nSmall example:\r\n```python\r\nimport joblib\r\nimport nibabel\r\n\r\n\r\ndef f(x):\r\n    print('Not cached')\r\n\r\n\r\nmem = joblib.Memory(cachedir='cache')\r\nimg1 = nibabel.load('file.nii')\r\nimg2 = nibabel.load('./file.nii')\r\nmem.cache(f)(img1)\r\nmem.cache(f)(img2)\r\n```\r\n\r\nResult:\r\n```\r\nNot cached\r\nNot cached\r\n```\r\n\r\nMy suggestion: writing a reliable hashing function for Nifti1Image once and for all. Plus, it can be clever by using filepaths when needed and by caching the data hash in the Nifti1Image header.\r\n\r\nBut I reckon by looking at the tests that this PR improves the default behavior."}}