{"action":"created","comment":{"url":"https://api.github.com/repos/jdammers/jumeg/pulls/comments/22532614","id":22532614,"diff_hunk":"@@ -81,4 +79,44 @@ def calc_tkeo(signal):\n     tkeo[-1] = 0.\n \n     # return results\n-    return tkeo\n\\ No newline at end of file\n+    return tkeo\n+\n+\n+##################################################\n+#\n+# destroy phase/time info on any data array\n+#\n+##################################################\n+def shuffle_data (data_trials, mode='shuffle'):","path":"jumeg_math.py","position":29,"original_position":29,"commit_id":"968db4c9154f39c9c8825e8e827e92efc93e511b","original_commit_id":"968db4c9154f39c9c8825e8e827e92efc93e511b","user":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"body":"Moving to jumeg_utils and changing the name of the function isfine with me. \r\nI would would avoid naming it something with \"randomize...\" as there are plenty of functions available; all trying to fit a specific distributuion. Instead we could use something with \"desync_trials\".\r\nBut how about defining two separate functions: \"shuffle_data\" and \"shift_data\" in this way we would keep it very intuitive. ","created_at":"2015-01-06T16:34:30Z","updated_at":"2015-01-06T16:34:30Z","html_url":"https://github.com/jdammers/jumeg/pull/65#discussion_r22532614","pull_request_url":"https://api.github.com/repos/jdammers/jumeg/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/comments/22532614"},"html":{"href":"https://github.com/jdammers/jumeg/pull/65#discussion_r22532614"},"pull_request":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/jdammers/jumeg/pulls/65","id":26786389,"html_url":"https://github.com/jdammers/jumeg/pull/65","diff_url":"https://github.com/jdammers/jumeg/pull/65.diff","patch_url":"https://github.com/jdammers/jumeg/pull/65.patch","issue_url":"https://api.github.com/repos/jdammers/jumeg/issues/65","number":65,"state":"open","locked":false,"title":"Surrogates","user":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"body":"added new functions in:\r\njumeg_preprocessing (we may want to move to the new preproc repo later):  apply_ctps_surrogates()\r\n\r\njumeg_utils: make_surrogates_ctps(); also made some minor changes in this module\r\n\r\njumeg_math: shuffle_data()\r\n\r\nBelow you will a test scenario how I applied CTPS surrogate analysis across the CAU subjects/experiments\r\n\r\n# =================================================\r\n#\r\n# perform surrogates on phase trials\r\n#\r\n# =================================================\r\nfrom jumeg import jumeg_preprocessing as jpreproc\r\nimport glob\r\nimport numpy as np\r\n\r\nstage = '/home/jdammers/data/projects/CTPS_evoked/'\r\nsubject = ['101611', '108815','109925','110061','201394','202825']\r\nfnout = subject\r\nnsubject = len(subject)\r\nfnctps = []\r\npattern = '*ica,ctpsbr*.npy'\r\n\r\n# search and collect all CTPS files of all subjects and experiments\r\nfor isubj in range(nsubject):\r\n    path = stage + subject[isubj]+'/'\r\n    fnctps.append(sorted(glob.glob(path+pattern)))  # search & sort files\r\n\r\n# for each subject apply surrogate analysis (on all CTPS files)\r\nfor isubj in range(nsubject):\r\n    fnout = stage + subject[isubj]+'/' + subject[isubj] + '_ctps-surrogates.txt'\r\n    info = jpreproc.apply_ctps_surrogates(fnctps[isubj], fnout, nrepeat=1000)\r\n\r\n\r\n","created_at":"2015-01-03T20:01:03Z","updated_at":"2015-01-06T16:34:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfa045d65e0a53519ea49130f469fd4c4e69da38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jdammers/jumeg/pulls/65/commits","review_comments_url":"https://api.github.com/repos/jdammers/jumeg/pulls/65/comments","review_comment_url":"https://api.github.com/repos/jdammers/jumeg/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jdammers/jumeg/issues/65/comments","statuses_url":"https://api.github.com/repos/jdammers/jumeg/statuses/968db4c9154f39c9c8825e8e827e92efc93e511b","head":{"label":"jdammers:surrogates","ref":"surrogates","sha":"968db4c9154f39c9c8825e8e827e92efc93e511b","user":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"repo":{"id":18292012,"name":"jumeg","full_name":"jdammers/jumeg","owner":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdammers/jumeg","description":"MEG Data Analysis at FZJ","fork":false,"url":"https://api.github.com/repos/jdammers/jumeg","forks_url":"https://api.github.com/repos/jdammers/jumeg/forks","keys_url":"https://api.github.com/repos/jdammers/jumeg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdammers/jumeg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdammers/jumeg/teams","hooks_url":"https://api.github.com/repos/jdammers/jumeg/hooks","issue_events_url":"https://api.github.com/repos/jdammers/jumeg/issues/events{/number}","events_url":"https://api.github.com/repos/jdammers/jumeg/events","assignees_url":"https://api.github.com/repos/jdammers/jumeg/assignees{/user}","branches_url":"https://api.github.com/repos/jdammers/jumeg/branches{/branch}","tags_url":"https://api.github.com/repos/jdammers/jumeg/tags","blobs_url":"https://api.github.com/repos/jdammers/jumeg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdammers/jumeg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdammers/jumeg/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdammers/jumeg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdammers/jumeg/statuses/{sha}","languages_url":"https://api.github.com/repos/jdammers/jumeg/languages","stargazers_url":"https://api.github.com/repos/jdammers/jumeg/stargazers","contributors_url":"https://api.github.com/repos/jdammers/jumeg/contributors","subscribers_url":"https://api.github.com/repos/jdammers/jumeg/subscribers","subscription_url":"https://api.github.com/repos/jdammers/jumeg/subscription","commits_url":"https://api.github.com/repos/jdammers/jumeg/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdammers/jumeg/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdammers/jumeg/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdammers/jumeg/issues/comments/{number}","contents_url":"https://api.github.com/repos/jdammers/jumeg/contents/{+path}","compare_url":"https://api.github.com/repos/jdammers/jumeg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdammers/jumeg/merges","archive_url":"https://api.github.com/repos/jdammers/jumeg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdammers/jumeg/downloads","issues_url":"https://api.github.com/repos/jdammers/jumeg/issues{/number}","pulls_url":"https://api.github.com/repos/jdammers/jumeg/pulls{/number}","milestones_url":"https://api.github.com/repos/jdammers/jumeg/milestones{/number}","notifications_url":"https://api.github.com/repos/jdammers/jumeg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdammers/jumeg/labels{/name}","releases_url":"https://api.github.com/repos/jdammers/jumeg/releases{/id}","created_at":"2014-03-31T12:18:00Z","updated_at":"2014-12-17T13:35:19Z","pushed_at":"2015-01-03T19:50:34Z","git_url":"git://github.com/jdammers/jumeg.git","ssh_url":"git@github.com:jdammers/jumeg.git","clone_url":"https://github.com/jdammers/jumeg.git","svn_url":"https://github.com/jdammers/jumeg","homepage":null,"size":876,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":9,"forks":5,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"jdammers:master","ref":"master","sha":"8f1258a230013d9f73535076bbd9f42f48e4a419","user":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"repo":{"id":18292012,"name":"jumeg","full_name":"jdammers/jumeg","owner":{"login":"jdammers","id":3457954,"avatar_url":"https://avatars.githubusercontent.com/u/3457954?v=3","gravatar_id":"","url":"https://api.github.com/users/jdammers","html_url":"https://github.com/jdammers","followers_url":"https://api.github.com/users/jdammers/followers","following_url":"https://api.github.com/users/jdammers/following{/other_user}","gists_url":"https://api.github.com/users/jdammers/gists{/gist_id}","starred_url":"https://api.github.com/users/jdammers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdammers/subscriptions","organizations_url":"https://api.github.com/users/jdammers/orgs","repos_url":"https://api.github.com/users/jdammers/repos","events_url":"https://api.github.com/users/jdammers/events{/privacy}","received_events_url":"https://api.github.com/users/jdammers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdammers/jumeg","description":"MEG Data Analysis at FZJ","fork":false,"url":"https://api.github.com/repos/jdammers/jumeg","forks_url":"https://api.github.com/repos/jdammers/jumeg/forks","keys_url":"https://api.github.com/repos/jdammers/jumeg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdammers/jumeg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdammers/jumeg/teams","hooks_url":"https://api.github.com/repos/jdammers/jumeg/hooks","issue_events_url":"https://api.github.com/repos/jdammers/jumeg/issues/events{/number}","events_url":"https://api.github.com/repos/jdammers/jumeg/events","assignees_url":"https://api.github.com/repos/jdammers/jumeg/assignees{/user}","branches_url":"https://api.github.com/repos/jdammers/jumeg/branches{/branch}","tags_url":"https://api.github.com/repos/jdammers/jumeg/tags","blobs_url":"https://api.github.com/repos/jdammers/jumeg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdammers/jumeg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdammers/jumeg/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdammers/jumeg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdammers/jumeg/statuses/{sha}","languages_url":"https://api.github.com/repos/jdammers/jumeg/languages","stargazers_url":"https://api.github.com/repos/jdammers/jumeg/stargazers","contributors_url":"https://api.github.com/repos/jdammers/jumeg/contributors","subscribers_url":"https://api.github.com/repos/jdammers/jumeg/subscribers","subscription_url":"https://api.github.com/repos/jdammers/jumeg/subscription","commits_url":"https://api.github.com/repos/jdammers/jumeg/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdammers/jumeg/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdammers/jumeg/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdammers/jumeg/issues/comments/{number}","contents_url":"https://api.github.com/repos/jdammers/jumeg/contents/{+path}","compare_url":"https://api.github.com/repos/jdammers/jumeg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdammers/jumeg/merges","archive_url":"https://api.github.com/repos/jdammers/jumeg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdammers/jumeg/downloads","issues_url":"https://api.github.com/repos/jdammers/jumeg/issues{/number}","pulls_url":"https://api.github.com/repos/jdammers/jumeg/pulls{/number}","milestones_url":"https://api.github.com/repos/jdammers/jumeg/milestones{/number}","notifications_url":"https://api.github.com/repos/jdammers/jumeg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdammers/jumeg/labels{/name}","releases_url":"https://api.github.com/repos/jdammers/jumeg/releases{/id}","created_at":"2014-03-31T12:18:00Z","updated_at":"2014-12-17T13:35:19Z","pushed_at":"2015-01-03T19:50:34Z","git_url":"git://github.com/jdammers/jumeg.git","ssh_url":"git@github.com:jdammers/jumeg.git","clone_url":"https://github.com/jdammers/jumeg.git","svn_url":"https://github.com/jdammers/jumeg","homepage":null,"size":876,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":9,"forks":5,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/65"},"html":{"href":"https://github.com/jdammers/jumeg/pull/65"},"issue":{"href":"https://api.github.com/repos/jdammers/jumeg/issues/65"},"comments":{"href":"https://api.github.com/repos/jdammers/jumeg/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jdammers/jumeg/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/jdammers/jumeg/statuses/968db4c9154f39c9c8825e8e827e92efc93e511b"}}}}