Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timpermcluster class method to take baseline that was already included in the initial extractHGDataWithROI.m call #31

Open
Aaronearlerichardson opened this issue Oct 27, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Aaronearlerichardson
Copy link
Collaborator

class method:

function chanSig = extractTimePermCluster(obj1,obj2)
% Input
% obj1 - active IEEG structure
% obj2 - passive IEEG structure
% Output
% chanSig - cluster correction output
chanSig = {};
baseData = obj2.data;
targetData = obj1.data;
time2pad = size(targetData,3)/size(baseData,3);
parfor iChan = 1:size(baseData,1)
% Assumption - target data window is longer than base data
% Correction - Random sampling & padding base window trials
% to account for time difference
baseDataChan = squeeze(baseData(iChan,:,:));
targetDataChan = squeeze(targetData(iChan,:,:));
baseDataChanPad = zeros(size(targetDataChan));
for iTrial = 1:size(baseDataChan,1)
randTrials = datasample(1:size(baseDataChan,1),time2pad-1,'Replace',false);
trials2join = baseDataChan(randTrials,:);
baseDataChanPad(iTrial,:) = [baseDataChan(iTrial,:) trials2join(:)'];
end
[zValsRawAct, pValsRaw, actClust]=timePermCluster(targetDataChan,baseDataChanPad,1000,1,1.645);
chanSig{iChan}.zValsRawAct=zValsRawAct;
chanSig{iChan}.pValsRaw=pValsRaw;
chanSig{iChan}.actClust=actClust;
disp(iChan)
end
end % Time Series permutation cluster

while obj1 accepts self as input, the baseline data is not saved in the extractHGDataWithROI.m output. Moreover the obj1 data is already z scored against the baseline, so using this method requires saving both of the original inputs from the extractHGDataWithROI.m call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants