changeset 17:8c7a18d89610

changes to multithreshold calibration
author Ray Meddis <rmeddis@essex.ac.uk>
date Tue, 07 Jun 2011 10:53:51 +0100
parents 51082e08b70b
children e9e263e4fcde
files MAP/MAP1_14.m multithreshold 1.46.zip multithreshold 1.46/calibrationFile.mat multithreshold 1.46/nextStimulus.m multithreshold 1.46/savedData/nemo_06-Jun-2011 17_25_10_training.mat multithreshold 1.46/savedData/nemo_06-Jun-2011 17_26_02_training.mat testPrograms/test_MAP1_14.m
diffstat 7 files changed, 35 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MAP/MAP1_14.m	Thu Jun 02 14:30:01 2011 +0100
+++ b/MAP/MAP1_14.m	Tue Jun 07 10:53:51 2011 +0100
@@ -777,6 +777,8 @@
                     (1- smoothedRates* rateToAttenuationFactorProb);
             end
             MOCattenuation(MOCattenuation<0)=0.001;
+plot(MOCattenuation)
+MOCattenuation
 
 
         case 'spikes'
Binary file multithreshold 1.46.zip has changed
Binary file multithreshold 1.46/calibrationFile.mat has changed
--- a/multithreshold 1.46/nextStimulus.m	Thu Jun 02 14:30:01 2011 +0100
+++ b/multithreshold 1.46/nextStimulus.m	Tue Jun 07 10:53:51 2011 +0100
@@ -82,7 +82,7 @@
 end
 
 set(handles.textMSG,'BackgroundColor','w', 'ForegroundColor', 'b')
-            
+
 % Now the serious business of crafting and presenting the stimulus
 errormsg= stimulusMakeAndPlay (handles);
 
@@ -314,6 +314,23 @@
     targetLevel=-100;	% no target
 end
 
+% ----------------------------- calibration of sound output
+calibrationCorrectiondB=stimulusParameters.calibrationdB;
+if calibrationCorrectiondB<-50
+    if maskerFrequency==targetFrequency
+        load 'calibrationFile'  % calibrationFrequency calibrationAttenutation
+        idx=find(calibrationFrequency==targetFrequency);
+        if isempty(idx)
+            error('Calibration bty file; frequency not found')
+        else
+            calibrationCorrectiondB=calibrationAttenutation(idx)
+        end
+    else
+        error('calibration by file requested but masker frequency is not the same as target')
+    end
+end
+
+
 % -------------------------------------- Checks on excessive signal level
 
 % clipping is relevant only for soundcard use (not modelling)
@@ -329,7 +346,7 @@
 switch experiment.ear
     case {'left', 'right', 'diotic',...
             'dichotic', 'dioticLeft', 'dichoticRight'}
-        clippingLevel=91+stimulusParameters.calibrationdB;
+        clippingLevel=91+calibrationCorrectiondB;
         soundCardMinimum=clippingLevel-20*log10(2^24);
     otherwise
         clippingLevel=inf;
@@ -366,7 +383,7 @@
             withinRuns.forceThreshold=NaN;
             return
         end
-                
+        
     case 'targetLevel'
         upperLevel=stimulusParameters.WRVlimits(2);
         lowerLevel=stimulusParameters.WRVlimits(1);
@@ -376,7 +393,7 @@
                     num2str(max(targetLevel, cueTargetLevel)) ...
                     ')  is too high ***'];
                 withinRuns.forceThreshold=upperLevel;
-            withinRuns.forceThreshold=NaN;
+                withinRuns.forceThreshold=NaN;
                 return
             end
             if max(targetLevel, cueTargetLevel)< lowerLevel
@@ -384,7 +401,7 @@
                     num2str(max(targetLevel, cueTargetLevel)) ...
                     ')  is too low ***'];
                 withinRuns.forceThreshold=lowerLevel;
-            withinRuns.forceThreshold=NaN;
+                withinRuns.forceThreshold=NaN;
                 return
             end
             if max(targetLevel, cueTargetLevel)> clippingLevel
@@ -392,10 +409,10 @@
                     num2str(max(targetLevel, cueTargetLevel)) ...
                     ')  is clipping ***'];
                 withinRuns.forceThreshold=upperLevel;
-            withinRuns.forceThreshold=NaN;
+                withinRuns.forceThreshold=NaN;
                 return
             end
-        end    
+        end
     case 'maskerDuration'
         % this is odd! but harmless
         if max(maskerDuration, cueMaskerDuration)> ...
@@ -493,7 +510,7 @@
 backgroundType=stimulusParameters.backgroundType;
 switch stimulusParameters.backgroundType
     case {'noiseDich', 'pinkNoiseDich'}
-%     case 'Dich'
+        %     case 'Dich'
         % dich means put the background in the ear opposite to the target
         backgroundType=backgroundType(1:end-4);
         switch targetEar
@@ -503,7 +520,7 @@
                 backgroundEar=1;
         end
     otherwise
-%             case {'none','noise', 'pinkNoise', 'TEN','babble'}
+        %             case {'none','noise', 'pinkNoise', 'TEN','babble'}
         backgroundEar=targetEar;
 end
 
@@ -515,9 +532,9 @@
 globalStimParams.dt=dt;
 stimulusParameters.dt=dt; % for use later
 
-% calibration of sound output
-correctiondB=stimulusParameters.calibrationdB;
-globalStimParams.audioOutCorrection=10^(correctiondB/20);
+
+
+globalStimParams.audioOutCorrection=10^(calibrationCorrectiondB/20);
 % the output will be reduced by this amount in stimulusCreate
 % i.e.  audio=audio/globalStimParams.audioOutCorrection
 % A 91 dB level will yield a peak amp of 1 for calibration=0
@@ -680,7 +697,7 @@
             'backgrounds and maskers'...
             filesep 'ten.wav'];
         [tenNoise, FS]=wavread(fileName);
-
+        
         tenNoise=resample(tenNoise, globalStimParams.FS, FS);
         stimComponents(backgroundEar,componentNo).type='file';
         stimComponents(backgroundEar,componentNo).stimulus=tenNoise';
@@ -705,8 +722,8 @@
             +stimulusParameters.maskerDuration;
         stimulusParameters.testTargetEnds=...
             stimulusParameters.testTargetBegins+withinRuns.variableValue;
-%     case 'SRT'
-%         set(handles.editdigitInput,'visible','off')
+        %     case 'SRT'
+        %         set(handles.editdigitInput,'visible','off')
     otherwise
         stimulusParameters.testTargetBegins=targetDelay;
         stimulusParameters.testTargetEnds=targetDelay+targetDuration;
Binary file multithreshold 1.46/savedData/nemo_06-Jun-2011 17_25_10_training.mat has changed
Binary file multithreshold 1.46/savedData/nemo_06-Jun-2011 17_26_02_training.mat has changed
--- a/testPrograms/test_MAP1_14.m	Thu Jun 02 14:30:01 2011 +0100
+++ b/testPrograms/test_MAP1_14.m	Tue Jun 07 10:53:51 2011 +0100
@@ -43,7 +43,7 @@
 BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels));
 
 %   or specify your own channel BFs
-% BFlist=toneFrequency;
+BFlist=toneFrequency;
 
 
 %% #6 change model parameters