{"action":"created","comment":{"url":"https://api.github.com/repos/atlab/sessions/pulls/comments/102205971","pull_request_review_id":22954146,"id":102205971,"diff_hunk":"@@ -0,0 +1,91 @@\n+\n+function [x,y,z,t] = trackMotion3D(fn, analysischan) \n+\n+%% test function computeshifts\n+% requires z:\\libraries\\matlab in path\n+run(getLocalPath('/lab/libraries/hdf5matlab/setPath.m')) ;\n+\n+analyzenthframe = 1 ; % skip frames if > 1\n+numframestoaverageforref = 10 ; % frames to average to determine the reference frame against which motion is computed\n+usemulticore = true ;\n+postrefstartframetime = 0 ; % N secs to skip before analyzing motion signals, in many cases, right after starting the point scan, there is a slight drift\n+\n+br = aodReader(fn, 'Motion') ;\n+br1 = AodMotionCorrectionReader(fn) ; % if motion was corrected by using aod offsets, this is where they would be read\n+\n+dat = br(:,:,:) ;\n+numsamples = br1.sz ;\n+duration = numsamples(:,1)/br1.Fs ; % sec\n+\n+%numframes = size(dat,1) ;\n+%numchans = size(dat,3) ;\n+% motion_fs = br.Fs ;\n+motion_fs = size(dat,1)/duration ; % this is based on the temporal sampling rate\n+delta_t = analyzenthframe/motion_fs ;\n+\n+numplanes = br.planes ;\n+coordinates = br.motionCoordinates ;\n+\n+% get pmt chan data\n+dat2 = squeeze(dat(:,:,analysischan)) ;\n+clearvars dat ;\n+gridsize = sqrt(size(dat2,2)/numplanes) ;\n+\n+% frame number to start from\n+postrefstartframe = max(round(postrefstartframetime*motion_fs),1) ;\n+\n+% chop off the first N secs\n+dat2 = dat2(postrefstartframe:end, :) ;\n+\n+needreference = true ; % first get a reference frame\n+refparams = [] ;\n+calibparams = [0 1; 0 1; 0 1] ; % dont apply any calibration\n+shifts = zeros(size(dat2,1),3); % store motion vectors here\n+dat2(1,:) = mean(dat2(1:numframestoaverageforref,:)) ; % average frames for computing reference\n+[shifts(1,:), refparams] = computeshifts(dat2(1,:)',coordinates,gridsize,calibparams,refparams,needreference) ; % this position of the fitted sphere is treated as the reference\n+\n+% setup for parallel processing\n+if (usemulticore)\n+    try\n+        mypool = parpool ; % use max processors\n+    catch\n+        fprintf('Unable to start parallel pool, single processor will be used') ;\n+        usemulticore = false ;\n+    end\n+end \n+\n+% take into account frames to skip, i.e. sampling rate of motion,\n+% downsample with averaging\n+adat = zeros(size(dat2)) ;","path":"schemas/+aod/trackMotion3D.m","position":59,"original_position":59,"commit_id":"4ac02b1c165c23d3daa3a52b0623d30881b65b19","original_commit_id":"4ac02b1c165c23d3daa3a52b0623d30881b65b19","user":{"login":"dimitri-yatsenko","id":1096169,"avatar_url":"https://avatars.githubusercontent.com/u/1096169?v=3","gravatar_id":"","url":"https://api.github.com/users/dimitri-yatsenko","html_url":"https://github.com/dimitri-yatsenko","followers_url":"https://api.github.com/users/dimitri-yatsenko/followers","following_url":"https://api.github.com/users/dimitri-yatsenko/following{/other_user}","gists_url":"https://api.github.com/users/dimitri-yatsenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dimitri-yatsenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimitri-yatsenko/subscriptions","organizations_url":"https://api.github.com/users/dimitri-yatsenko/orgs","repos_url":"https://api.github.com/users/dimitri-yatsenko/repos","events_url":"https://api.github.com/users/dimitri-yatsenko/events{/privacy}","received_events_url":"https://api.github.com/users/dimitri-yatsenko/received_events","type":"User","site_admin":false},"body":"replace these loops with matlab's implementation of downsampling. ","created_at":"2017-02-21T13:28:47Z","updated_at":"2017-02-21T13:43:50Z","html_url":"https://github.com/atlab/sessions/pull/16#discussion_r102205971","pull_request_url":"https://api.github.com/repos/atlab/sessions/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/atlab/sessions/pulls/comments/102205971"},"html":{"href":"https://github.com/atlab/sessions/pull/16#discussion_r102205971"},"pull_request":{"href":"https://api.github.com/repos/atlab/sessions/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/atlab/sessions/pulls/16","id":107092728,"html_url":"https://github.com/atlab/sessions/pull/16","diff_url":"https://github.com/atlab/sessions/pull/16.diff","patch_url":"https://github.com/atlab/sessions/pull/16.patch","issue_url":"https://api.github.com/repos/atlab/sessions/issues/16","number":16,"state":"open","locked":false,"title":"Code to select the aod motion computation method based on file versio…","user":{"login":"saumilpatel","id":2379811,"avatar_url":"https://avatars.githubusercontent.com/u/2379811?v=3","gravatar_id":"","url":"https://api.github.com/users/saumilpatel","html_url":"https://github.com/saumilpatel","followers_url":"https://api.github.com/users/saumilpatel/followers","following_url":"https://api.github.com/users/saumilpatel/following{/other_user}","gists_url":"https://api.github.com/users/saumilpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/saumilpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saumilpatel/subscriptions","organizations_url":"https://api.github.com/users/saumilpatel/orgs","repos_url":"https://api.github.com/users/saumilpatel/repos","events_url":"https://api.github.com/users/saumilpatel/events{/privacy}","received_events_url":"https://api.github.com/users/saumilpatel/received_events","type":"User","site_admin":false},"body":"…n. Supports file version in which motion data are 3D","created_at":"2017-02-20T23:48:08Z","updated_at":"2017-02-21T13:43:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0c41e40f48bdd885d3dcf17bdf2b1ce2494b86c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/atlab/sessions/pulls/16/commits","review_comments_url":"https://api.github.com/repos/atlab/sessions/pulls/16/comments","review_comment_url":"https://api.github.com/repos/atlab/sessions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atlab/sessions/issues/16/comments","statuses_url":"https://api.github.com/repos/atlab/sessions/statuses/4ac02b1c165c23d3daa3a52b0623d30881b65b19","head":{"label":"saumilpatel:master","ref":"master","sha":"4ac02b1c165c23d3daa3a52b0623d30881b65b19","user":{"login":"saumilpatel","id":2379811,"avatar_url":"https://avatars.githubusercontent.com/u/2379811?v=3","gravatar_id":"","url":"https://api.github.com/users/saumilpatel","html_url":"https://github.com/saumilpatel","followers_url":"https://api.github.com/users/saumilpatel/followers","following_url":"https://api.github.com/users/saumilpatel/following{/other_user}","gists_url":"https://api.github.com/users/saumilpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/saumilpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saumilpatel/subscriptions","organizations_url":"https://api.github.com/users/saumilpatel/orgs","repos_url":"https://api.github.com/users/saumilpatel/repos","events_url":"https://api.github.com/users/saumilpatel/events{/privacy}","received_events_url":"https://api.github.com/users/saumilpatel/received_events","type":"User","site_admin":false},"repo":{"id":81254558,"name":"sessions","full_name":"saumilpatel/sessions","owner":{"login":"saumilpatel","id":2379811,"avatar_url":"https://avatars.githubusercontent.com/u/2379811?v=3","gravatar_id":"","url":"https://api.github.com/users/saumilpatel","html_url":"https://github.com/saumilpatel","followers_url":"https://api.github.com/users/saumilpatel/followers","following_url":"https://api.github.com/users/saumilpatel/following{/other_user}","gists_url":"https://api.github.com/users/saumilpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/saumilpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saumilpatel/subscriptions","organizations_url":"https://api.github.com/users/saumilpatel/orgs","repos_url":"https://api.github.com/users/saumilpatel/repos","events_url":"https://api.github.com/users/saumilpatel/events{/privacy}","received_events_url":"https://api.github.com/users/saumilpatel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/saumilpatel/sessions","description":"Core DataJoint schemas for experimental sessions","fork":true,"url":"https://api.github.com/repos/saumilpatel/sessions","forks_url":"https://api.github.com/repos/saumilpatel/sessions/forks","keys_url":"https://api.github.com/repos/saumilpatel/sessions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saumilpatel/sessions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saumilpatel/sessions/teams","hooks_url":"https://api.github.com/repos/saumilpatel/sessions/hooks","issue_events_url":"https://api.github.com/repos/saumilpatel/sessions/issues/events{/number}","events_url":"https://api.github.com/repos/saumilpatel/sessions/events","assignees_url":"https://api.github.com/repos/saumilpatel/sessions/assignees{/user}","branches_url":"https://api.github.com/repos/saumilpatel/sessions/branches{/branch}","tags_url":"https://api.github.com/repos/saumilpatel/sessions/tags","blobs_url":"https://api.github.com/repos/saumilpatel/sessions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saumilpatel/sessions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saumilpatel/sessions/git/refs{/sha}","trees_url":"https://api.github.com/repos/saumilpatel/sessions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saumilpatel/sessions/statuses/{sha}","languages_url":"https://api.github.com/repos/saumilpatel/sessions/languages","stargazers_url":"https://api.github.com/repos/saumilpatel/sessions/stargazers","contributors_url":"https://api.github.com/repos/saumilpatel/sessions/contributors","subscribers_url":"https://api.github.com/repos/saumilpatel/sessions/subscribers","subscription_url":"https://api.github.com/repos/saumilpatel/sessions/subscription","commits_url":"https://api.github.com/repos/saumilpatel/sessions/commits{/sha}","git_commits_url":"https://api.github.com/repos/saumilpatel/sessions/git/commits{/sha}","comments_url":"https://api.github.com/repos/saumilpatel/sessions/comments{/number}","issue_comment_url":"https://api.github.com/repos/saumilpatel/sessions/issues/comments{/number}","contents_url":"https://api.github.com/repos/saumilpatel/sessions/contents/{+path}","compare_url":"https://api.github.com/repos/saumilpatel/sessions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saumilpatel/sessions/merges","archive_url":"https://api.github.com/repos/saumilpatel/sessions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saumilpatel/sessions/downloads","issues_url":"https://api.github.com/repos/saumilpatel/sessions/issues{/number}","pulls_url":"https://api.github.com/repos/saumilpatel/sessions/pulls{/number}","milestones_url":"https://api.github.com/repos/saumilpatel/sessions/milestones{/number}","notifications_url":"https://api.github.com/repos/saumilpatel/sessions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saumilpatel/sessions/labels{/name}","releases_url":"https://api.github.com/repos/saumilpatel/sessions/releases{/id}","deployments_url":"https://api.github.com/repos/saumilpatel/sessions/deployments","created_at":"2017-02-07T21:10:03Z","updated_at":"2017-02-07T21:10:06Z","pushed_at":"2017-02-20T23:45:14Z","git_url":"git://github.com/saumilpatel/sessions.git","ssh_url":"git@github.com:saumilpatel/sessions.git","clone_url":"https://github.com/saumilpatel/sessions.git","svn_url":"https://github.com/saumilpatel/sessions","homepage":null,"size":627,"stargazers_count":0,"watchers_count":0,"language":"Matlab","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":"atlab:master","ref":"master","sha":"820220cef4acfe48b7602d0209f22a37d9079fbd","user":{"login":"atlab","id":2198969,"avatar_url":"https://avatars.githubusercontent.com/u/2198969?v=3","gravatar_id":"","url":"https://api.github.com/users/atlab","html_url":"https://github.com/atlab","followers_url":"https://api.github.com/users/atlab/followers","following_url":"https://api.github.com/users/atlab/following{/other_user}","gists_url":"https://api.github.com/users/atlab/gists{/gist_id}","starred_url":"https://api.github.com/users/atlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlab/subscriptions","organizations_url":"https://api.github.com/users/atlab/orgs","repos_url":"https://api.github.com/users/atlab/repos","events_url":"https://api.github.com/users/atlab/events{/privacy}","received_events_url":"https://api.github.com/users/atlab/received_events","type":"Organization","site_admin":false},"repo":{"id":10349151,"name":"sessions","full_name":"atlab/sessions","owner":{"login":"atlab","id":2198969,"avatar_url":"https://avatars.githubusercontent.com/u/2198969?v=3","gravatar_id":"","url":"https://api.github.com/users/atlab","html_url":"https://github.com/atlab","followers_url":"https://api.github.com/users/atlab/followers","following_url":"https://api.github.com/users/atlab/following{/other_user}","gists_url":"https://api.github.com/users/atlab/gists{/gist_id}","starred_url":"https://api.github.com/users/atlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atlab/subscriptions","organizations_url":"https://api.github.com/users/atlab/orgs","repos_url":"https://api.github.com/users/atlab/repos","events_url":"https://api.github.com/users/atlab/events{/privacy}","received_events_url":"https://api.github.com/users/atlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atlab/sessions","description":"Core DataJoint schemas for experimental sessions","fork":false,"url":"https://api.github.com/repos/atlab/sessions","forks_url":"https://api.github.com/repos/atlab/sessions/forks","keys_url":"https://api.github.com/repos/atlab/sessions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atlab/sessions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atlab/sessions/teams","hooks_url":"https://api.github.com/repos/atlab/sessions/hooks","issue_events_url":"https://api.github.com/repos/atlab/sessions/issues/events{/number}","events_url":"https://api.github.com/repos/atlab/sessions/events","assignees_url":"https://api.github.com/repos/atlab/sessions/assignees{/user}","branches_url":"https://api.github.com/repos/atlab/sessions/branches{/branch}","tags_url":"https://api.github.com/repos/atlab/sessions/tags","blobs_url":"https://api.github.com/repos/atlab/sessions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atlab/sessions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atlab/sessions/git/refs{/sha}","trees_url":"https://api.github.com/repos/atlab/sessions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atlab/sessions/statuses/{sha}","languages_url":"https://api.github.com/repos/atlab/sessions/languages","stargazers_url":"https://api.github.com/repos/atlab/sessions/stargazers","contributors_url":"https://api.github.com/repos/atlab/sessions/contributors","subscribers_url":"https://api.github.com/repos/atlab/sessions/subscribers","subscription_url":"https://api.github.com/repos/atlab/sessions/subscription","commits_url":"https://api.github.com/repos/atlab/sessions/commits{/sha}","git_commits_url":"https://api.github.com/repos/atlab/sessions/git/commits{/sha}","comments_url":"https://api.github.com/repos/atlab/sessions/comments{/number}","issue_comment_url":"https://api.github.com/repos/atlab/sessions/issues/comments{/number}","contents_url":"https://api.github.com/repos/atlab/sessions/contents/{+path}","compare_url":"https://api.github.com/repos/atlab/sessions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atlab/sessions/merges","archive_url":"https://api.github.com/repos/atlab/sessions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atlab/sessions/downloads","issues_url":"https://api.github.com/repos/atlab/sessions/issues{/number}","pulls_url":"https://api.github.com/repos/atlab/sessions/pulls{/number}","milestones_url":"https://api.github.com/repos/atlab/sessions/milestones{/number}","notifications_url":"https://api.github.com/repos/atlab/sessions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atlab/sessions/labels{/name}","releases_url":"https://api.github.com/repos/atlab/sessions/releases{/id}","deployments_url":"https://api.github.com/repos/atlab/sessions/deployments","created_at":"2013-05-29T01:16:36Z","updated_at":"2015-07-02T18:33:06Z","pushed_at":"2017-02-20T23:48:09Z","git_url":"git://github.com/atlab/sessions.git","ssh_url":"git@github.com:atlab/sessions.git","clone_url":"https://github.com/atlab/sessions.git","svn_url":"https://github.com/atlab/sessions","homepage":null,"size":628,"stargazers_count":0,"watchers_count":0,"language":"Matlab","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atlab/sessions/pulls/16"},"html":{"href":"https://github.com/atlab/sessions/pull/16"},"issue":{"href":"https://api.github.com/repos/atlab/sessions/issues/16"},"comments":{"href":"https://api.github.com/repos/atlab/sessions/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/atlab/sessions/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/atlab/sessions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atlab/sessions/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/atlab/sessions/statuses/4ac02b1c165c23d3daa3a52b0623d30881b65b19"}}}}
{"actor":{"display_login":"dimitri-yatsenko"}}