changeset 13:9fd4960e743a

bug in testAN sorted
author Ray Meddis <rmeddis@essex.ac.uk>
date Wed, 01 Jun 2011 12:19:48 +0100
parents 4744176aae82
children 51082e08b70b
files Help and reference data/May 20 parameters.doc MAP/MAP1_14.m multithreshold 1.46/expGUI_MT.m multithreshold 1.46/printReport.m multithreshold 1.46/testAN.m parameterStore/MAPparamsNormal.m testPrograms/Test files readme.doc
diffstat 7 files changed, 33 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
Binary file Help and reference data/May 20 parameters.doc has changed
--- a/MAP/MAP1_14.m	Tue May 31 18:38:00 2011 +0100
+++ b/MAP/MAP1_14.m	Wed Jun 01 12:19:48 2011 +0100
@@ -165,8 +165,6 @@
 % Acoustic reflex
 efferentDelayPts=round(OMEParams.ARdelay/dt);
 % smoothing filter
-% Nyquist=(1/ANdt)/2;
-% [ARfilt_b,ARfilt_a] = butter(1, (1/(2*pi*OMEParams.ARtau))/Nyquist, 'low');
 a1=dt/OMEParams.ARtau-1; a0=1;
 b0=1+ a1;
 ARfilt_b=b0; ARfilt_a=[a0 a1];
@@ -195,10 +193,6 @@
 MOCrateThreshold=DRNLParams.MOCrateThreshold;
 
 % smoothing filter for MOC
-% Nyquist=(1/ANdt)/2;
-% [MOCfilt_b,MOCfilt_a] = ...
-%     butter(1, (1/(2*pi*DRNLParams.MOCtau))/Nyquist, 'low');
-% figure(10), freqz(stapesDisp_b, stapesDisp_a)
 a1=dt/DRNLParams.MOCtau-1; a0=1;
 b0=1+ a1;
 MOCfilt_b=b0; MOCfilt_a=[a0 a1];
--- a/multithreshold 1.46/expGUI_MT.m	Tue May 31 18:38:00 2011 +0100
+++ b/multithreshold 1.46/expGUI_MT.m	Wed Jun 01 12:19:48 2011 +0100
@@ -616,6 +616,7 @@
 switch experiment.paradigm
     case 'thr_IFMC'
         %% special option for two successive and linked measurements
+        clc
         experiment.paradigm='threshold_16ms';
         set(handles.editstopCriteriaBox,'string','30') % nTrials
         run (handles)
@@ -637,6 +638,7 @@
 
     case 'thr_TMC'
         %% special option for two successive and linked measurements
+        clc
         experiment.paradigm='threshold_16ms';
         set(handles.edittargetDuration,'string', num2str(0.25))
         set(handles.editstopCriteriaBox,'string','30') % nTrials
--- a/multithreshold 1.46/printReport.m	Tue May 31 18:38:00 2011 +0100
+++ b/multithreshold 1.46/printReport.m	Wed Jun 01 12:19:48 2011 +0100
@@ -45,7 +45,6 @@
     end
 end
 
-clc
 fprintf('******** multithreshold ')
 x=pwd; disp(['version ' x(end-3:end)])
 fprintf('\nName:\t%s ', experiment.name)
--- a/multithreshold 1.46/testAN.m	Tue May 31 18:38:00 2011 +0100
+++ b/multithreshold 1.46/testAN.m	Wed Jun 01 12:19:48 2011 +0100
@@ -5,7 +5,7 @@
 global experiment method stimulusParameters
 global IHC_VResp_VivoParams  IHC_cilia_RPParams IHCpreSynapseParams
 global AN_IHCsynapseParams
-% global saveMembranePotential MacGregorMultiParams
+
 dbstop if error
 
 addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ...
@@ -50,23 +50,28 @@
 set(gcf,'name',[num2str(BFlist), ' Hz']);
 drawnow
 
+%% guarantee that the sample rate is at least 10 times the frequency
+sampleRate=50000;
+while sampleRate< 10* targetFrequency
+    sampleRate=sampleRate+10000;
+end
+
+%% adjust sample rate so that the pure tone stimulus has an integer
+%% numver of epochs in a period
+dt=1/sampleRate;
+period=1/targetFrequency;
+ANspeedUpFactor=5;  %anticipating MAP (needs clearing up)
+ANdt=dt*ANspeedUpFactor;
+ANdt=period/round(period/ANdt);
+dt=ANdt/ANspeedUpFactor;
+sampleRate=1/dt;
+epochsPerPeriod=sampleRate*period;
+
+%% main computational loop (vary level)    
 levelNo=0;
 for leveldB=levels
     levelNo=levelNo+1;
 
-    %% sample rate should be amultiple of the targetFrequency for PSTH below
-    sampleRate=50000;
-    sampleRate=20*targetFrequency;
-    if sampleRate<20000
-    sampleRate=round(40000/targetFrequency)*targetFrequency;
-    end
-    
-     
-    %% ananana
-    dt=1/sampleRate;
-    period=1/targetFrequency;
-    dt=dt*(dt/period)*round(period/dt);
-
     fprintf('%4.0f\t', leveldB)
     amp=28e-6*10^(leveldB/20);
 
@@ -88,7 +93,7 @@
     MAPparamsName=experiment.name;
     showPlotsAndDetails=0;
 
-    global ANoutput CNoutput ICoutput ICmembraneOutput tauCas
+    global ANoutput ANdt CNoutput ICoutput ICmembraneOutput tauCas
     global ARattenuation MOCattenuation
 
     MAP1_14(inputSignal, 1/dt, BFlist, ...
@@ -98,13 +103,12 @@
 
     %LSR (same as HSR if no LSR fibers present)
     [nANFibers nTimePoints]=size(ANoutput);
-    dt=dt* length(inputSignal)/nTimePoints;
 
     numLSRfibers=nANFibers/nTaus;
     numHSRfibers=numLSRfibers;
 
     LSRspikes=ANoutput(1:numLSRfibers,:);
-    PSTH=UTIL_makePSTH(LSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(LSRspikes, ANdt, localPSTHbinwidth);
     PSTHLSR=mean(PSTH,1)/localPSTHbinwidth;  % across fibers rates
     PSTHtime=localPSTHbinwidth:localPSTHbinwidth:...
         localPSTHbinwidth*length(PSTH);
@@ -113,7 +117,7 @@
 
     % HSR
     HSRspikes= ANoutput(end- numHSRfibers+1:end, :);
-    PSTH=UTIL_makePSTH(HSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(HSRspikes, ANdt, localPSTHbinwidth);
     PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
     AN_HSRonset(levelNo)= max(PSTH);
     AN_HSRsaturated(levelNo)= mean(PSTH(round(length(PSTH)/2): end));
@@ -126,12 +130,12 @@
 
     % AN - CV
     %  CV is computed 5 times. Use the middle one (3) as most typical
-    cvANHSR=  UTIL_CV(HSRspikes, dt);
+    cvANHSR=  UTIL_CV(HSRspikes, ANdt);
 
     % AN - vector strength
     PSTH=sum(HSRspikes);
     [PH, binTimes]=UTIL_periodHistogram...
-        (PSTH, dt, targetFrequency);
+        (PSTH, ANdt, targetFrequency);
     VS=UTIL_vectorStrength(PH);
     vectorStrength(levelNo)=VS;
     disp(['sat rate= ' num2str(AN_HSRsaturated(levelNo)) ...
@@ -145,14 +149,14 @@
     [nCNneurons c]=size(CNoutput);
     nLSRneurons=round(nCNneurons/nTaus);
     CNLSRspikes=CNoutput(1:nLSRneurons,:);
-    PSTH=UTIL_makePSTH(CNLSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(CNLSRspikes, ANdt, localPSTHbinwidth);
     PSTH=sum(PSTH)/nLSRneurons;
     CNLSRrate(levelNo)=mean(PSTH(round(length(PSTH)/2):end))/localPSTHbinwidth;
 
     %CN HSR
     MacGregorMultiHSRspikes=...
         CNoutput(end-nLSRneurons:end,:);
-    PSTH=UTIL_makePSTH(MacGregorMultiHSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(MacGregorMultiHSRspikes, ANdt, localPSTHbinwidth);
     PSTH=sum(PSTH)/nLSRneurons;
     PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
 
@@ -162,20 +166,20 @@
     bar(PSTHtime,PSTH)
     ylim([0 1000])
     xlim([0 length(PSTH)*localPSTHbinwidth])
-    cvMMHSR= UTIL_CV(MacGregorMultiHSRspikes, dt);
+    cvMMHSR= UTIL_CV(MacGregorMultiHSRspikes, ANdt);
     title(['CN    CV= ' num2str(cvMMHSR(3),'%5.2f')])
 
     % IC LSR
     [nICneurons c]=size(ICoutput);
     nLSRneurons=round(nICneurons/nTaus);
     ICLSRspikes=ICoutput(1:nLSRneurons,:);
-    PSTH=UTIL_makePSTH(ICLSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(ICLSRspikes, ANdt, localPSTHbinwidth);
     ICLSRsaturated(levelNo)=mean(PSTH(round(length(PSTH)/2):end))/localPSTHbinwidth;
 
     %IC HSR
     MacGregorMultiHSRspikes=...
         ICoutput(end-nLSRneurons:end,:);
-    PSTH=UTIL_makePSTH(MacGregorMultiHSRspikes, dt, localPSTHbinwidth);
+    PSTH=UTIL_makePSTH(MacGregorMultiHSRspikes, ANdt, localPSTHbinwidth);
     PSTH=sum(PSTH)/nLSRneurons;
     PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
 
@@ -184,7 +188,7 @@
     AR(levelNo)=min(ARattenuation);
     MOC(levelNo)=min(MOCattenuation(length(MOCattenuation)/2:end));
 
-    time=dt:dt:dt*size(ICmembraneOutput,2);
+    time=ANdt:ANdt:ANdt*size(ICmembraneOutput,2);
     figure(5), subplot(2,2,4)
     plot(time,ICmembraneOutput(2, 1:end),'k')
     ylim([-0.07 0])
--- a/parameterStore/MAPparamsNormal.m	Tue May 31 18:38:00 2011 +0100
+++ b/parameterStore/MAPparamsNormal.m	Wed Jun 01 12:19:48 2011 +0100
@@ -137,7 +137,7 @@
 IHC_cilia_RPParams.Cab=	4e-012;         % IHC capacitance (F)
 IHC_cilia_RPParams.Cab=	1e-012;         % IHC capacitance (F)
 IHC_cilia_RPParams.Et=	0.100;          % endocochlear potential (V)
-IHC_cilia_RPParams.Et=	0.07;          % endocochlear potential (V)
+% IHC_cilia_RPParams.Et=	0.07;          % endocochlear potential (V)
 
 IHC_cilia_RPParams.Gk=	2e-008;         % 1e-8 potassium conductance (S)
 IHC_cilia_RPParams.Ek=	-0.08;          % -0.084 K equilibrium potential
Binary file testPrograms/Test files readme.doc has changed