{"action":"created","comment":{"url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/comments/30332307","id":30332307,"diff_hunk":"@@ -151,15 +153,28 @@ def setup_provenance(script, results_dir, config=None, use_agg=True):\n     - sets log file for sterr output\n     - writes log file with runtime information\n     \"\"\"\n+    import inspect\n+    if script is None:\n+        script = inspect.stack()[1][1]\n+        if script[0] == '<':\n+            script = '__main__'","path":"meeg_preprocessing/utils.py","position":31,"original_position":31,"commit_id":"771f6a9363b4d6dd3132d044be24963722f18ffb","original_commit_id":"771f6a9363b4d6dd3132d044be24963722f18ffb","user":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"body":"```\r\nIOError: [Errno 2] No such file or directory: '/home/jrking/meeg-preprocessing/meeg_preprocessing/tests/data/test-eve.fif'\r\n```\r\n\r\nI only have test_raw.fif there","created_at":"2015-05-14T15:47:30Z","updated_at":"2015-05-14T15:47:30Z","html_url":"https://github.com/dengemann/meeg-preprocessing/pull/15#discussion_r30332307","pull_request_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/comments/30332307"},"html":{"href":"https://github.com/dengemann/meeg-preprocessing/pull/15#discussion_r30332307"},"pull_request":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15","id":35387569,"html_url":"https://github.com/dengemann/meeg-preprocessing/pull/15","diff_url":"https://github.com/dengemann/meeg-preprocessing/pull/15.diff","patch_url":"https://github.com/dengemann/meeg-preprocessing/pull/15.patch","issue_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/15","number":15,"state":"open","locked":false,"title":"EHN: default script and results_dir param","user":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"body":"This is an attempt to set the ```script``` and ```results_dir``` parameters by default. \r\n\r\nThe motivation is to facilitate and simplify the API. In particular 1) most codes use ```script=__file__``` and 2) ```__file__``` cannot be evaluated when run 'manually'; So for debugging one needs to change the ```script``` param before copy and paste it to the console.\r\n\r\nWhat it does:\r\n* the module inherits ```scripts``` from the script that calls it; if it is run from the console it gives a default value '__main__' whose content is 'setup_provenance()'.\r\n* if ```results_dir``` is not passed, it is put in a ```results``` folder. If the folder doesn't exist, it creates it.\r\n\r\nHere is an example to use it:\r\n\r\n```\r\nimport matplotlib.pyplot as plt\r\nfrom meeg_preprocessing.utils import setup_provenance\r\nreport, run_id, results_dir, logger = setup_provenance()\r\nfig, ax = plt.subplots(1)\r\nax.plot(range(10))\r\nreport.add_figs_to_section(fig, 'foo', 'bar')\r\nreport.save()\r\n```","created_at":"2015-05-14T01:47:09Z","updated_at":"2015-05-14T15:47:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ed51822a9c15ea1130ce58e64a9961ce28ffdf6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15/commits","review_comments_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15/comments","review_comment_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/15/comments","statuses_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/statuses/771f6a9363b4d6dd3132d044be24963722f18ffb","head":{"label":"kingjr:default_report_params","ref":"default_report_params","sha":"771f6a9363b4d6dd3132d044be24963722f18ffb","user":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"repo":{"id":31887711,"name":"meeg-preprocessing","full_name":"kingjr/meeg-preprocessing","owner":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kingjr/meeg-preprocessing","description":"Preprocessing tools for MEG/EEG","fork":true,"url":"https://api.github.com/repos/kingjr/meeg-preprocessing","forks_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/forks","keys_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/teams","hooks_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/hooks","issue_events_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/issues/events{/number}","events_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/events","assignees_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/assignees{/user}","branches_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/branches{/branch}","tags_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/tags","blobs_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/git/refs{/sha}","trees_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/statuses/{sha}","languages_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/languages","stargazers_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/stargazers","contributors_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/contributors","subscribers_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/subscribers","subscription_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/subscription","commits_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/commits{/sha}","git_commits_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/git/commits{/sha}","comments_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/comments{/number}","issue_comment_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/issues/comments{/number}","contents_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/contents/{+path}","compare_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/merges","archive_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/downloads","issues_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/issues{/number}","pulls_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/pulls{/number}","milestones_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/milestones{/number}","notifications_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/labels{/name}","releases_url":"https://api.github.com/repos/kingjr/meeg-preprocessing/releases{/id}","created_at":"2015-03-09T08:54:56Z","updated_at":"2015-03-09T08:54:57Z","pushed_at":"2015-05-14T10:49:09Z","git_url":"git://github.com/kingjr/meeg-preprocessing.git","ssh_url":"git@github.com:kingjr/meeg-preprocessing.git","clone_url":"https://github.com/kingjr/meeg-preprocessing.git","svn_url":"https://github.com/kingjr/meeg-preprocessing","homepage":null,"size":11536,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dengemann:master","ref":"master","sha":"e2fadc2ba4a87400b00cefc1d64944b1639ec56c","user":{"login":"dengemann","id":1908618,"avatar_url":"https://avatars.githubusercontent.com/u/1908618?v=3","gravatar_id":"","url":"https://api.github.com/users/dengemann","html_url":"https://github.com/dengemann","followers_url":"https://api.github.com/users/dengemann/followers","following_url":"https://api.github.com/users/dengemann/following{/other_user}","gists_url":"https://api.github.com/users/dengemann/gists{/gist_id}","starred_url":"https://api.github.com/users/dengemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengemann/subscriptions","organizations_url":"https://api.github.com/users/dengemann/orgs","repos_url":"https://api.github.com/users/dengemann/repos","events_url":"https://api.github.com/users/dengemann/events{/privacy}","received_events_url":"https://api.github.com/users/dengemann/received_events","type":"User","site_admin":false},"repo":{"id":27304710,"name":"meeg-preprocessing","full_name":"dengemann/meeg-preprocessing","owner":{"login":"dengemann","id":1908618,"avatar_url":"https://avatars.githubusercontent.com/u/1908618?v=3","gravatar_id":"","url":"https://api.github.com/users/dengemann","html_url":"https://github.com/dengemann","followers_url":"https://api.github.com/users/dengemann/followers","following_url":"https://api.github.com/users/dengemann/following{/other_user}","gists_url":"https://api.github.com/users/dengemann/gists{/gist_id}","starred_url":"https://api.github.com/users/dengemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dengemann/subscriptions","organizations_url":"https://api.github.com/users/dengemann/orgs","repos_url":"https://api.github.com/users/dengemann/repos","events_url":"https://api.github.com/users/dengemann/events{/privacy}","received_events_url":"https://api.github.com/users/dengemann/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dengemann/meeg-preprocessing","description":"Preprocessing tools for MEG/EEG","fork":false,"url":"https://api.github.com/repos/dengemann/meeg-preprocessing","forks_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/forks","keys_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/teams","hooks_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/hooks","issue_events_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/events{/number}","events_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/events","assignees_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/assignees{/user}","branches_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/branches{/branch}","tags_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/tags","blobs_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/git/refs{/sha}","trees_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/statuses/{sha}","languages_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/languages","stargazers_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/stargazers","contributors_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/contributors","subscribers_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/subscribers","subscription_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/subscription","commits_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/commits{/sha}","git_commits_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/git/commits{/sha}","comments_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/comments{/number}","issue_comment_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/comments{/number}","contents_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/contents/{+path}","compare_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/merges","archive_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/downloads","issues_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues{/number}","pulls_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls{/number}","milestones_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/milestones{/number}","notifications_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/labels{/name}","releases_url":"https://api.github.com/repos/dengemann/meeg-preprocessing/releases{/id}","created_at":"2014-11-29T14:37:30Z","updated_at":"2015-04-29T13:54:19Z","pushed_at":"2015-05-14T10:49:09Z","git_url":"git://github.com/dengemann/meeg-preprocessing.git","ssh_url":"git@github.com:dengemann/meeg-preprocessing.git","clone_url":"https://github.com/dengemann/meeg-preprocessing.git","svn_url":"https://github.com/dengemann/meeg-preprocessing","homepage":null,"size":11825,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15"},"html":{"href":"https://github.com/dengemann/meeg-preprocessing/pull/15"},"issue":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/15"},"comments":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/dengemann/meeg-preprocessing/statuses/771f6a9363b4d6dd3132d044be24963722f18ffb"}}}}