This file is indexed.

/usr/share/psychtoolbox-3/PsychRadiometric/PsychAnsiZ136MPE/AnsiZ136MPEComputeExtendedSourceLimit.m is in psychtoolbox-3-common 3.0.11.20140816.dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
function [MPELimitIntegratedRadiance_JoulesPerCm2Sr, ...
    MPELimitRadiance_WattsPerCm2Sr, ...
    MPELimitCornealIrradiance_WattsPerCm2, ...
    MPELimitCornealRadiantExposure_JoulesPerCm2] = ...
    AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm,CONELIMITFLAG)
% [MPELimitIntegratedRadiance_JoulesPerCm2Sr, ...
%  MPELimitRadiance_WattsPerCm2S, ...
%  MPELimitCornealIrradiance_WattsPerCm2, ...
%  MPELimitCornealRadiantExposure_JoulesPerCm2] = ...
%  AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm,[CONELIMITFLAG])
%
% ****************************************************************************
% IMPORTANT: Before using the AnsiZ136 routines, please see the notes on usage
% and responsibility in PsychAnsiZ136MPE/Contents.m (type "help PsychAnsiZ136MPE"
% at the Matlab prompt.
% ****************************************************************************
%
% Compute thermal MPE for an extended source ANSI Z136.1-2007, Table 5b, p. 75
%
% Set CONELIMITFLAG to false (default true) to skip the asterisked 
% alternative computation for the photochemical limit
% desribed in Table 5 (see comments in code).
%
% 2/20/13  dhb  Wrote it.
% 3/2/13   dhb  Make limiting cone angle computation controllable.

%% Default arg 
if (nargin < 4 || isempty(CONELIMITFLAG))
    CONELIMITFLAG = true;
end

%% Convert angle to mrad and get T2
stimulusSizeMrad = DegToMrad(stimulusSizeDeg);
stimulusAreaDeg2 = (pi/4)*stimulusSizeDeg^2;
T2Sec = AnsiZ136MPEComputeT2(stimulusSizeDeg);
Ce = AnsiZ136MPEComputeCe(stimulusSizeDeg);
Ca = AnsiZ136MPEComputeCa(stimulusWavelengthNm);

%% Outer conditional is on wavelength range, inner conditional
% by duration.
if (stimulusWavelengthNm < 400)
    error('MPE not yet implemented for wavelengths less than 400 nm');
    
elseif (stimulusWavelengthNm >= 400 && stimulusWavelengthNm < 700)
    % 400-700 nm.  Now split by time.
    if (stimulusDurationSec < 1e-13)
        error('Limit not yet implemented for exposures less than 1e-13 seconds');
    elseif (stimulusDurationSec >= 1e-13 && stimulusDurationSec < 1e-11)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 1.5*Ce*1e-8;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-11 && stimulusDurationSec < 1e-9)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 2.7*Ce*(stimulusDurationSec^0.75);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-9 && stimulusDurationSec < 18*1e-6)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 5*Ce*1e-7;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 18*1e-6 && stimulusDurationSec < 0.7)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 1.8*Ce*(stimulusDurationSec^0.75)*(1e-3);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec; 
    elseif (stimulusDurationSec >= 0.7 && stimulusDurationSec < T2Sec)
        % In this range, we compute thermal limit, and compare it to the photochemical limit.  We
        % take whichever is smaller.
        MPEThermalCornealRadiantExposure_JoulesPerCm2 = 1.8*Ce*(stimulusDurationSec^0.75)*(1e-3);
        
        [~, ~, ~, MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2] = ...
          AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm,CONELIMITFLAG);
        if (MPEThermalCornealRadiantExposure_JoulesPerCm2 <= MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2)
            MPELimitCornealRadiantExposure_JoulesPerCm2 = MPEThermalCornealRadiantExposure_JoulesPerCm2;
        else
            MPELimitCornealRadiantExposure_JoulesPerCm2 = MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2;
        end
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= T2Sec && stimulusDurationSec < 3e4)
        % In this range, we compute thermal limit, and compare it to the photochemical limit.  We
        % take whichever is smaller.
        MPEThermalCornealIrradiance_WattsPerCm2 = 1.8*Ce*(T2Sec^(-0.25))*(1e-3);
        [~, ~, MPEPhotochemicalCornealIrradiance_WattsPerCm2, ~] = ...
          AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm,CONELIMITFLAG);
        if (MPEThermalCornealIrradiance_WattsPerCm2 <= MPEPhotochemicalCornealIrradiance_WattsPerCm2)
            MPELimitCornealIrradiance_WattsPerCm2 = MPEThermalCornealIrradiance_WattsPerCm2;
        else
            MPELimitCornealIrradiance_WattsPerCm2 = MPEPhotochemicalCornealIrradiance_WattsPerCm2;
        end
        MPELimitCornealRadiantExposure_JoulesPerCm2 = MPELimitCornealIrradiance_WattsPerCm2*stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    else
        error('Limit not yet implemented for exposures greater than 3*10^4 seconds');
    end
    
elseif (stimulusWavelengthNm >= 700 && stimulusWavelengthNm < 1050)
    % 700-1050.  Now split by time.
    if (stimulusDurationSec < 1e-13)
        error('Limit not yet implemented for exposures less than 1e-13 seconds');
    elseif (stimulusDurationSec >= 1e-13 && stimulusDurationSec < 1e-11)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 1.5*Ca*Ce*1e-8;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-11 && stimulusDurationSec < 1e-9)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 2.7*Ca*Ce*(stimulusDurationSec^0.75);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-9 && stimulusDurationSec < 18*1e-6)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 5*Ca*Ce*1e-7;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 18*1e-6 && stimulusDurationSec < T2Sec)
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 1.8*Ca*Ce*(stimulusDurationSec^0.75)*(1e-3);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= T2Sec && stimulusDurationSec < 3e4)
        MPELimitCornealIrradiance_WattsPerCm2 = 1.8*Ca*Ce*(T2Sec^(-0.25))*(1e-3);
        MPELimitCornealRadiantExposure_JoulesPerCm2 = MPELimitCornealIrradiance_WattsPerCm2*stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    else
        error('Limit not yet implemented for exposures greater than 3*10^4 seconds');
    end
    
elseif (stimulusWavelengthNm >= 1050 && stimulusWavelengthNm < 1400)
    % 1050-1400.  Now split by time.
    Cc = AnsiZ136MPEComputeCc(stimulusWavelengthNm);
    if (stimulusDurationSec < 1e-13)
        error('Limit not yet implemented for exposures less than 1e-13 seconds');
    elseif (stimulusDurationSec >= 1e-13 && stimulusDurationSec < 1e-11)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 1.5*Cc*Ce*1e-7;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-11 && stimulusDurationSec < 1e-9)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 27*Cc*Ce*(stimulusDurationSec^0.75);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= 1e-9 && stimulusDurationSec < 50*1e-6)
        % At this duration, limit s directly specified
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 5*Cc*Ce*1e-6;
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;

    elseif (stimulusDurationSec >= 50*1e-6 && stimulusDurationSec < T2Sec)
        MPELimitCornealRadiantExposure_JoulesPerCm2 = 9*Cc*Ce*(stimulusDurationSec^0.75)*(1e-3);
        MPELimitCornealIrradiance_WattsPerCm2 = MPELimitCornealRadiantExposure_JoulesPerCm2/stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    elseif (stimulusDurationSec >= T2Sec && stimulusDurationSec < 3e4)
        MPELimitCornealIrradiance_WattsPerCm2 = 9*Cc*Ce*(T2Sec^(-0.25))*(1e-3);
        MPELimitCornealRadiantExposure_JoulesPerCm2 = MPELimitCornealIrradiance_WattsPerCm2*stimulusDurationSec;
        MPELimitRadiance_WattsPerCm2Sr = CornIrradianceAndDegrees2ToRadiance(MPELimitCornealIrradiance_WattsPerCm2,stimulusAreaDeg2);
        MPELimitIntegratedRadiance_JoulesPerCm2Sr = MPELimitRadiance_WattsPerCm2Sr*stimulusDurationSec;
    else
        error('Limit not yet implemented for exposures greater than 3*10^4 seconds');
    end
    
else
    % Off the long wavelength end
    error('MPE not yet implemented for wavelengths greater than 1400 nm');
end


end