To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / testPrograms / testSynapse.m @ 38:c2204b18f4a2
History | View | Annotate | Download (2.75 KB)
| 1 | 38:c2204b18f4a2 | rmeddis | function testSynapse(BF,paramsName, AN_spikesOrProbability, paramChanges) |
|---|---|---|---|
| 2 | 29:b51bf546ca3f | rmeddis | % testSynapse tracks the quantity of available transmitter vesicles |
| 3 | % the computations are single channel using the first frequency |
||
| 4 | % in the targetFrequency box of the expGUI. |
||
| 5 | 38:c2204b18f4a2 | rmeddis | % This function uses only probability and HSR fibers. |
| 6 | % testSynapse(1000,'Normal',[]) |
||
| 7 | 29:b51bf546ca3f | rmeddis | |
| 8 | 38:c2204b18f4a2 | rmeddis | global experiment IHCpreSynapseParams |
| 9 | 29:b51bf546ca3f | rmeddis | global AN_IHCsynapseParams stimulusParameters |
| 10 | 38:c2204b18f4a2 | rmeddis | global savePavailable saveNavailable |
| 11 | |||
| 12 | 29:b51bf546ca3f | rmeddis | savePath=path; |
| 13 | addpath (['..' filesep 'utilities'],['..' filesep 'MAP']) |
||
| 14 | |||
| 15 | if nargin<3 |
||
| 16 | paramChanges=[]; |
||
| 17 | end |
||
| 18 | |||
| 19 | 38:c2204b18f4a2 | rmeddis | if length(BF)>1 |
| 20 | error('Only one value allowed for BF')
|
||
| 21 | end |
||
| 22 | % AN_spikesOrProbability='probability'; |
||
| 23 | % AN_spikesOrProbability='spikes'; |
||
| 24 | % showPlotsAndDetails=0; |
||
| 25 | |||
| 26 | 29:b51bf546ca3f | rmeddis | figure(6),clf |
| 27 | plotColors='rbgkrbgkrbgkrbgkrbgkrbgk'; |
||
| 28 | set(gcf,'position',[5 32 264 243]) |
||
| 29 | |||
| 30 | sampleRate=5e4; dt=1/sampleRate; |
||
| 31 | |||
| 32 | 38:c2204b18f4a2 | rmeddis | switch AN_spikesOrProbability |
| 33 | case 'probability' |
||
| 34 | maskerLevels=-0:20:100; |
||
| 35 | case 'spikes' |
||
| 36 | maskerLevels=80; |
||
| 37 | end |
||
| 38 | 29:b51bf546ca3f | rmeddis | |
| 39 | 38:c2204b18f4a2 | rmeddis | targetFrequency=BF; |
| 40 | 29:b51bf546ca3f | rmeddis | |
| 41 | silenceDuration=0.015; |
||
| 42 | maskerDuration=0.1; |
||
| 43 | recoveryDuration=0.15; |
||
| 44 | rampDuration=0.004; |
||
| 45 | |||
| 46 | maskerTime=dt:dt:maskerDuration; |
||
| 47 | |||
| 48 | rampTime=dt:dt:rampDuration; |
||
| 49 | ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... |
||
| 50 | ones(1,length(maskerTime)-length(rampTime))]; |
||
| 51 | ramp=ramp.*fliplr(ramp); |
||
| 52 | |||
| 53 | initialSilence=zeros(1,round(silenceDuration/dt)); |
||
| 54 | recoverySilence=zeros(1,round(recoveryDuration/dt)); |
||
| 55 | |||
| 56 | signal=sin(2*pi*targetFrequency'*maskerTime); |
||
| 57 | signal= ramp.*signal; |
||
| 58 | signal=[initialSilence signal recoverySilence]; |
||
| 59 | |||
| 60 | levelCount=0; |
||
| 61 | qtMatrix=[]; |
||
| 62 | for leveldB=maskerLevels |
||
| 63 | levelCount=levelCount+1; |
||
| 64 | |||
| 65 | amp=28e-6*10^(leveldB/20); |
||
| 66 | inputSignal=amp*signal; |
||
| 67 | |||
| 68 | 38:c2204b18f4a2 | rmeddis | MAP1_14(inputSignal, 1/dt, targetFrequency, ... |
| 69 | paramsName, AN_spikesOrProbability, paramChanges); |
||
| 70 | 29:b51bf546ca3f | rmeddis | |
| 71 | % ignore LSR channels (if any) at the top of the matrix |
||
| 72 | 38:c2204b18f4a2 | rmeddis | switch AN_spikesOrProbability |
| 73 | case 'probability' |
||
| 74 | qt=savePavailable(end, :); |
||
| 75 | case 'spikes' |
||
| 76 | qt=saveNavailable; |
||
| 77 | end |
||
| 78 | 29:b51bf546ca3f | rmeddis | synapsedt=dt; |
| 79 | time=synapsedt:synapsedt:synapsedt*length(qt); |
||
| 80 | |||
| 81 | figure(6) |
||
| 82 | qtMatrix=[qtMatrix; qt]; |
||
| 83 | plot(time,qt, plotColors(levelCount)) |
||
| 84 | hold on |
||
| 85 | xlim([0 max(time)]) |
||
| 86 | ylim([0 AN_IHCsynapseParams.M]) |
||
| 87 | 38:c2204b18f4a2 | rmeddis | xlabel ('time')
|
| 88 | 29:b51bf546ca3f | rmeddis | end |
| 89 | |||
| 90 | set(gcf,'name','pre-synaptic available transmitter') |
||
| 91 | 38:c2204b18f4a2 | rmeddis | title(['pre-synaptic transmitter:' num2str(BF) ' Hz']) |
| 92 | ylabel(['q - available vesicles']) |
||
| 93 | 29:b51bf546ca3f | rmeddis | legend(strvcat(num2str(maskerLevels')),'location','southeast') |
| 94 | legend boxoff |
||
| 95 | grid on |
||
| 96 | |||
| 97 | 38:c2204b18f4a2 | rmeddis | switch AN_spikesOrProbability |
| 98 | case 'probability' |
||
| 99 | figure(88), [c,H]=contour(time, maskerLevels,qtMatrix,1:12); clabel(c, H); |
||
| 100 | set(gcf,'position',[ 276 31 328 246]) |
||
| 101 | xlabel('time'), ylabel('maskerLevels')
|
||
| 102 | title('contour plot of available transmitter')
|
||
| 103 | grid on |
||
| 104 | end |
||
| 105 | 29:b51bf546ca3f | rmeddis | path(savePath); |