Functions | Variables

unlock/analysis/andres/Code/getUnlockEpochs.m File Reference

Functions

epoch s samples epochDcdTgt (:, iIndx)
window of decoded targets warning ('MUST DOUBLE CHECK SAMPLES ALIGNED') end%Extra data left
window of decoded targets
usefull if problems aligning
data if 
epochIndx (iIndx)< unlockInfo.main.szData(1) leftOvers.eegData

Variables

 function [unlockEpochs, unlockInfo, dcdTgt, epochDcdTgt]
 eegTime = 0:1/unlockInfo.main.Fs:unlockInfo.main.len
 eegEndTri = unlockData.endTrl
 eegDcdTgt = unlockData.dcdTgt
 fspec = specData.fspec
 tspec = specData.tspec
Params Fs = unlockInfo.main.Fs
 nChs = unlockInfo.main.nChs
 nTrials = unlockInfo.main.nTrials
 expTgts = unlockInfo.decoder.stimFreq
 stimLen = unlockInfo.behav.stimLen
 restLen = unlockInfo.behav.restLen
 trialLen = (stimLen + restLen)*Fs
trial length in samples
unlockInfo epoch 
trialSampLen = trialLen
do this here since later is it
changed Extracting all epochs
For triggered epochs if
unlockInfo main triggeredData 
epochIndx = (find(eegEndTri))
 nEpochs = numel(epochIndx)
 eegAllEpochs = nan(trialLen,nChs,nEpochs)
for iIndx
leftOvers dcdTgt = eegDcdTgt(epochIndx(iIndx):end)
else leftOvers eegData = []
end When not all trials have
an end Trigger else if
unlockInfo epoch fromEnd Start
getting epochs from last
trigger Number epochs 
indx = find(eegEndTri)
samples where trial labeled as
ended 
iEpoch = 0

Function Documentation

epoch s samples epochDcdTgt ( ,
iIndx   
)
window of decoded targets usefull if problems aligning data if epochIndx ( iIndx   ) 
window of decoded targets warning ( 'MUST DOUBLE CHECK SAMPLES ALIGNED'   ) 

Variable Documentation

leftOvers dcdTgt = eegDcdTgt(epochIndx(iIndx):end)
end Epoch s Spectrograms if unlockInfo epoch doSpecgram eegData = []
eegDcdTgt = unlockData.dcdTgt
eegEndTri = unlockData.endTrl
do this here since later is it changed Extracting all epochs For triggered epochs if unlockInfo main triggeredData epochIndx = (find(eegEndTri))
expTgts = unlockInfo.decoder.stimFreq
end end Raw time Spectrogram if unlockInfo main doSpecgram Set default spectrogram params SpecInfo Fs = unlockInfo.main.Fs
end Spec analysis transformation factors SpectInfo fspec = specData.fspec
function[unlockEpochs, unlockInfo, dcdTgt, epochDcdTgt]
Initial value:
 getUnlockEpochs(unlockData,unlockInfo)
%
% Gets epochs for unlock based on end of trial flags located in
% unlockData.endTrial vector.
%
%
%
%
%
% Andres v1. 18 Dec 2013 

% Data
eegData     = unlockData.data
samples where trial labeled as ended iEpoch = 0
for iIndx
Initial value:
 1:nEpochs    % moving from the end to the beginning (MUST DOUBLE CHECK SAMPLES ALIGNED)
        eegAllEpochs(:,:,iIndx)     = eegData(epochIndx(iIndx) - trialLen + 1:epochIndx(iIndx),:)
end When not all trials have an end Trigger else if unlockInfo epoch fromEnd Start getting epochs from last trigger Number epochs indx = find(eegEndTri)
SpecInfo nEpochs = numel(epochIndx)
trial length in samples unlockInfo epoch trialSampLen = trialLen
end Spec analysis transformation factors SpecInfo tspec = specData.tspec