changeset 21:c489ebada16e

pre Oldenburg changes
author Ray Meddis <rmeddis@essex.ac.uk>
date Mon, 13 Jun 2011 18:13:29 +0100
parents 37a379b27cff
children 45f28c49461e
files MAP/MAP1_14.m multithreshold 1.46/testBM.m parameterStore/MAPparamsNormal.m testPrograms/showMAP.m testPrograms/test_MAP1_14.m utilities/UTIL_PSTHmakerb.m
diffstat 6 files changed, 73 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/MAP/MAP1_14.m	Tue Jun 07 09:53:50 2011 +0100
+++ b/MAP/MAP1_14.m	Mon Jun 13 18:13:29 2011 +0100
@@ -623,10 +623,10 @@
         y= nonlinOutput.*(MOC* DRNLa);  % linear section.
         % compress those parts of the signal above the compression
         % threshold
-        abs_x = abs(nonlinOutput);
+        abs_x = abs(y);
         idx=find(abs_x>DRNLcompressionThreshold);
         if ~isempty(idx)>0
-            y(idx)=sign(nonlinOutput(idx)).*...
+            y(idx)=sign(y(idx)).*...
                 (DRNLb*abs_x(idx).^DRNLc);
         end
         nonlinOutput=y;
--- a/multithreshold 1.46/testBM.m	Tue Jun 07 09:53:50 2011 +0100
+++ b/multithreshold 1.46/testBM.m	Mon Jun 13 18:13:29 2011 +0100
@@ -19,7 +19,7 @@
 % levels= 50;   nLevels=length(levels);
 
 relativeFrequencies=[0.25    .5   .75  1  1.25 1.5    2];
-% relativeFrequencies=1;
+relativeFrequencies=1;
 
 % refBMdisplacement is the displacement of the BM at threshold
 % 1 nm disp at  threshold (9 kHz, Ruggero)
--- a/parameterStore/MAPparamsNormal.m	Tue Jun 07 09:53:50 2011 +0100
+++ b/parameterStore/MAPparamsNormal.m	Mon Jun 13 18:13:29 2011 +0100
@@ -76,7 +76,7 @@
 
 % DRNL nonlinear path
 DRNLParams.a=3e4;     % nonlinear path gain (below compression threshold)
-% DRNLParams.a=3e2;     % DRNL.a=0 means no OHCs (no nonlinear path)
+DRNLParams.a=3e2;     % DRNL.a=0 means no OHCs (no nonlinear path)
 
 DRNLParams.b=8e-6;    % *compression threshold raised compression
 % DRNLParams.b=1;    % b=1 means no compression
@@ -102,12 +102,13 @@
 DRNLParams.MOCdelay = efferentDelay;            % must be < segment length!
 % 'spikes' model: MOC based on brainstem spiking activity (HSR)
 DRNLParams.rateToAttenuationFactor = .009;  % strength of MOC
-DRNLParams.rateToAttenuationFactor = .009;  % strength of MOC
+DRNLParams.rateToAttenuationFactor = .004;  % strength of MOC
 %      DRNLParams.rateToAttenuationFactor = 0;  % strength of MOC
 
 % 'probability' model: MOC based on AN spiking activity (HSR)
 DRNLParams.rateToAttenuationFactorProb = .007;  % strength of MOC
-DRNLParams.rateToAttenuationFactorProb = .0;  % strength of MOC
+DRNLParams.rateToAttenuationFactorProb = .002;  % strength of MOC
+% DRNLParams.rateToAttenuationFactorProb = .0;  % strength of MOC
 DRNLParams.MOCtau =.03;                         % smoothing for MOC
 DRNLParams.MOCrateThreshold =50;                % set to AN rate threshold
 
--- a/testPrograms/showMAP.m	Tue Jun 07 09:53:50 2011 +0100
+++ b/testPrograms/showMAP.m	Mon Jun 13 18:13:29 2011 +0100
@@ -1,4 +1,4 @@
-function showMAP (options)
+function showMAP ()
 % defaults
 % options.showModelParameters=1;
 % options.showModelOutput=1;
@@ -17,6 +17,7 @@
     CNoutput  ICoutput ICmembraneOutput ICfiberTypeRates MOCattenuation
 global OMEParams DRNLParams IHC_cilia_RPParams IHCpreSynapseParams
 global AN_IHCsynapseParams MacGregorParams MacGregorMultiParams
+global showMapOptions
 
 
 restorePath=path;
@@ -172,21 +173,28 @@
     colorbar
 end
 
+if options.surfProbability
 %% surface plot of probability
-if options.surfProbability
     figure(97), clf
     % select only HSR fibers at the bottom of the matrix
     ANprobRateOutput= ANprobRateOutput(end-length(savedBFlist)+1:end,:);
-    [nY nX]=size(ANprobRateOutput);
-    time=dt*(1:nX);
-    surf(time, savedBFlist, ANprobRateOutput)
+    PSTHbinWidth=0.001;
+    PSTH=UTIL_PSTHmakerb(ANprobRateOutput, ANdt, PSTHbinWidth);
+    [nY nX]=size(PSTH);
+    PSTH=PSTH(:,200:end);
+    [nY nX]=size(PSTH);
+    time=PSTHbinWidth*(1:nX);
+    surf(time, savedBFlist, PSTH)
     shading interp
     set(gca, 'yScale','log')
-    xlim([0 max(time)]), ylim([0 max(savedBFlist)]), zlim([0 1000])
+    xlim([0 max(time)])
+    ylim([0 max(savedBFlist)])
+    zlim([0 1000])
     xlabel('time (s)')
     ylabel('best frequency (Hz)')
     zlabel('spike rate')
     view([-20 60])
+%     view([0 90])
     title ([options.fileName ':   ' num2str(signalRMSdb,'% 3.0f') ' dB'])
 end
 
--- a/testPrograms/test_MAP1_14.m	Tue Jun 07 09:53:50 2011 +0100
+++ b/testPrograms/test_MAP1_14.m	Mon Jun 13 18:13:29 2011 +0100
@@ -47,22 +47,22 @@
 signalType= 'tones';
 duration=0.100;                 % seconds
 % duration=0.020;                 % seconds
-sampleRate= 64000;
+sampleRate= 100000;
 % toneFrequency= 250:250:8000;    % harmonic sequence (Hz)
 toneFrequency= 2000;            % or a pure tone (Hz8
 
 rampDuration=.005;              % seconds
 
-% or
-signalType= 'file';
-fileName='twister_44kHz';
-% fileName='new-da-44khz';
+% % or
+% signalType= 'file';
+% fileName='twister_44kHz';
+% % fileName='new-da-44khz';
 
 % mix with an optional second file?
 mixerFile=[];
 %or
-mixerFile='babble';
-leveldBSPL2=-60;
+% mixerFile='babble';
+% leveldBSPL2=30;
 
 %% #4 rms level
 % signal details
@@ -93,7 +93,7 @@
 %     'DRNLParams.rateToAttenuationFactorProb = 0;'};
 
 %% delare showMap options
-showMapOptions=[];  % use defaults
+global showMapOptions
 
 % or (example: show everything including an smoothed SACF output
 showMapOptions.showModelParameters=1;
@@ -103,9 +103,13 @@
 showMapOptions.showEfferent=1;
 if strcmp(AN_spikesOrProbability, 'probability')
     showMapOptions.surfProbability=1;
+else
+    showMapOptions.surfProbability=0;
 end
 if strcmp(signalType, 'file')
     showMapOptions.fileName=fileName;
+else
+    showMapOptions.fileName=[];
 end
 
 %% Generate stimuli
@@ -126,6 +130,8 @@
         rms=(mean(inputSignal.^2))^0.5;
         amp=targetRMS/rms;
         inputSignal=inputSignal*amp;
+        silence=zeros(10000,1);
+        inputSignal=[silence; inputSignal];
         if ~isempty(mixerFile)
             [inputSignal2 sampleRate]=wavread(mixerFile);
             inputSignal2=inputSignal2(:,1);
@@ -157,7 +163,7 @@
 toc
 
 % the model run is now complete. Now display the results
-showMAP(showMapOptions)
+showMAP
 for i=1:length(paramChanges)
 disp(paramChanges{i})
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utilities/UTIL_PSTHmakerb.m	Mon Jun 13 18:13:29 2011 +0100
@@ -0,0 +1,37 @@
+function [PSTH ]=UTIL_PSTHmakerb(inputData, dt, PSTHbinWidth)
+% UTIL_PSTHmakerb averages mean values into bins.
+% No corrections are applied
+% usage:
+%	PSTH=UTIL_PSTHmaker(inputData, method)
+%
+% arguments
+%	inputData is a channel x time matrix
+%	PSTH is the reduced matrix, the sum of all elements in the bin
+%
+
+[numChannels numDataPoints]= size(inputData);
+
+% Multiple fibers is the same as repeat trials
+% Consolidate data into a histogram 
+dataPointsPerBin=round(PSTHbinWidth/dt);
+if dataPointsPerBin<=1;
+% 	Too few data points
+	PSTH=inputData;
+	return
+end
+
+numBins=floor(numDataPoints/dataPointsPerBin);
+PSTH=zeros(numChannels,numBins);
+
+% take care that signal length is an integer multiple of bin size
+%  by dropping the last unuseable values
+useableDataLength=numBins*dataPointsPerBin;
+inputData=inputData(:,1:useableDataLength);
+
+for ch=1:numChannels
+	% Convert each channel into a matrix where each column represents 
+	% the content of a single PSTH bin
+	PSTH2D=reshape (inputData(ch,:), dataPointsPerBin, numBins );
+	% and sum within each bin (across the rows
+	PSTH(ch,:)=mean (PSTH2D,1);
+end