Revision 26:b03ef38fe497 MAP/MAP1_14.m

View differences:

MAP/MAP1_14.m
52 52
% AR is computed using across channel activity
53 53
% MOC is computed on a within-channel basis.
54 54

  
55
if nargin<1
56
    error(' MAP1_14 is not a script but a function that must be called')
57
end
58

  
59
if nargin<6
60
    paramChanges=[];
61
end
62
% Read parameters from MAPparams<***> file in 'parameterStore' folder
63
cmd=['method=MAPparams' MAPparamsName ...
64
    '(BFlist, sampleRate, 0, paramChanges);'];
65
eval(cmd);
66
% Beware, 'BFlist=-1' is a legitimate argument for MAPparams<>
67
%  if the calling program allows MAPparams to specify the list
68
BFlist=DRNLParams.nonlinCFs;
55 69

  
56 70
% save as global for later plotting if required
57 71
savedBFlist=BFlist;
58 72
saveAN_spikesOrProbability=AN_spikesOrProbability;
59 73
saveMAPparamsName=MAPparamsName;
60 74

  
61
% Read parameters from MAPparams<***> file in 'parameterStore' folder
62
cmd=['method=MAPparams' MAPparamsName ...
63
    '(BFlist, sampleRate, 0);'];
64
eval(cmd);
65

  
66
% Beware, 'BFlist=-1' is a legitimate argument for MAPparams<>
67
%  if the calling program allows MAPparams to specify the list
68
BFlist=DRNLParams.nonlinCFs;
69

  
70
% now accept last mintue parameter changes required by the calling program
71
if nargin>5 && ~isempty(paramChanges)
72
    nChanges=length(paramChanges);
73
    for idx=1:nChanges
74
        eval(paramChanges{idx})
75
    end
76
end
77

  
78 75
dt=1/sampleRate;
79 76
duration=length(inputSignal)/sampleRate;
80 77
% segmentDuration is specified in parameter file (must be >efferent delay)
......
190 187

  
191 188
MOCrateToAttenuationFactor=DRNLParams.rateToAttenuationFactor;
192 189
rateToAttenuationFactorProb=DRNLParams.rateToAttenuationFactorProb;
193
MOCrateThreshold=DRNLParams.MOCrateThreshold;
190
MOCrateThresholdProb=DRNLParams.MOCrateThresholdProb;
194 191

  
195 192
% smoothing filter for MOC
196 193
a1=dt/DRNLParams.MOCtau-1; a0=1;
......
355 352
% Spikes are necessary if CN and IC are to be computed
356 353
nFibersPerChannel= AN_IHCsynapseParams.numFibers;
357 354
nANfibers= nChannels*nFibersPerChannel;
355
AN_refractory_period= AN_IHCsynapseParams.refractory_period;
358 356

  
359 357
y=AN_IHCsynapseParams.y;
360 358
l=AN_IHCsynapseParams.l;
......
377 375

  
378 376
ANprobability=zeros(nChannels,segmentLength);
379 377
ANprobRateOutput=zeros(nChannels,signalLength);
378
lengthAbsRefractoryP= round(AN_refractory_period/dt);
380 379
% special variables for monitoring synaptic cleft (specialists only)
381 380
savePavailableSeg=zeros(nChannels,segmentLength);
382 381
savePavailable=zeros(nChannels,signalLength);
383 382

  
384 383
% spikes     % !  !  !    ! !        !   !  !
385
AN_refractory_period= AN_IHCsynapseParams.refractory_period;
386 384
lengthAbsRefractory= round(AN_refractory_period/ANdt);
387 385

  
388 386
AN_ydt= repmat(AN_IHCsynapseParams.y*ANdt, nANfibers,1);
......
777 775
                [smoothedRates, MOCprobBoundary{idx}] = ...
778 776
                    filter(MOCfilt_b, MOCfilt_a, rates(idx,:), ...
779 777
                    MOCprobBoundary{idx});
780
                smoothedRates=smoothedRates-MOCrateThreshold;
778
                smoothedRates=smoothedRates-MOCrateThresholdProb;
781 779
                smoothedRates(smoothedRates<0)=0;
782 780
                MOCattenuation(idx,segmentStartPTR:segmentEndPTR)= ...
783 781
                    (1- smoothedRates* rateToAttenuationFactorProb);
......
1131 1129

  
1132 1130
end  % segment
1133 1131

  
1132
%% apply refractory correction to spike probabilities
1133

  
1134
% switch AN_spikesOrProbability
1135
%     case 'probability'
1136
%         ANprobOutput=ANprobRateOutput*dt;
1137
%         [r c]=size(ANprobOutput);
1138
%         % find probability of no spikes in refractory period
1139
%         pNoSpikesInRefrac=ones(size(ANprobOutput));
1140
%         pSpike=zeros(size(ANprobOutput));
1141
%         for epochNo=lengthAbsRefractoryP+2:c
1142
%             pNoSpikesInRefrac(:,epochNo)=...
1143
%                 pNoSpikesInRefrac(:,epochNo-2)...
1144
%                 .*(1-pSpike(:,epochNo-1))...
1145
%                 ./(1-pSpike(:,epochNo-lengthAbsRefractoryP-1));
1146
%             pSpike(:,epochNo)= ANprobOutput(:,epochNo)...
1147
%                 .*pNoSpikesInRefrac(:,epochNo);
1148
%         end
1149
%         ANprobRateOutput=pSpike/dt;
1150
% end
1151

  
1134 1152
path(restorePath)

Also available in: Unified diff