This file is indexed.

/usr/share/psychtoolbox-3/PsychRadiometric/PsychAnsiZ136MPE/AnsiZ136MPEBasicTest.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.

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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
% AnsiZ136MPEBasicTest
%
% ****************************************************************************
% 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.
% ****************************************************************************
%
% Test code for our implementation of ANSI Z136.1-2007. Reproduces many figures from the
% standard.
%
% 2/22/13  dhb  Wrote it.

%% Clear and close
clear; close all;

%% Figure 9b: Test T2 computation
%
% Answer should range between 10 and 100
% as size increases over the specified range.
% See Figure 9b, p. 102.
fprintf('Reproducing Figure 9b, p. 102\n');
theStimulusSizesDeg = linspace(MradToDeg(0),MradToDeg(100+10),100);
theStimulusSizesMrad = DegToMrad(theStimulusSizesDeg);
for i = 1:length(theStimulusSizesDeg)
    T2Sec(i) = AnsiZ136MPEComputeT2(theStimulusSizesDeg(i));
end
figure; clf; hold on
plot(theStimulusSizesMrad,T2Sec,'ro','MarkerSize',8,'MarkerFaceColor','r');
xlabel('Stimulus Size (mrad)');
ylabel('T2 (sec)');
xlim([0 max(theStimulusSizesMrad)]);
ylim([0 100]);
title('Figure 9b: Test of AnsiZ136MPEComputeT2');
grid on

%% Figure 8a: Test Ca computation
%
% Answer should increase between 1 and 5
% with wavelength between 700 and 1050,
% and flatten out on the two sides.
%
% See Figure 8a, p. 98.
fprintf('Reproducing Figure 8a, p. 98\n');
wavelengthsNm = 400:1399;
for i = 1:length(wavelengthsNm)
    Ca(i) = AnsiZ136MPEComputeCa(wavelengthsNm(i));
end
figure; clf; hold on
semilogy(wavelengthsNm,log10(Ca),'ro','MarkerSize',8,'MarkerFaceColor','r');
xlabel('Wavelength (nm)');
ylabel('Log10 Ca');
xlim([min(wavelengthsNm) max(wavelengthsNm)]);
ylim([0 1]);
title('Figure 8a: Test of AnsiZ136MPEComputeCa');
grid on

%% Figure 8c: Test Cb computation
%
% Answer should range between 10 and 100
% as size increases over the specified range.  This
% should look like Figure 8c, p. 100.
fprintf('Reproducing Figure 8c, p. 100\n');
wavelengthsNm = 380:780;
for i = 1:length(wavelengthsNm)
    Cb(i) = AnsiZ136MPEComputeCb(wavelengthsNm(i));
end
figure; clf; hold on
semilogy(wavelengthsNm,log10(Cb),'ro','MarkerSize',8,'MarkerFaceColor','r');
xlabel('Wavelength (nm)');
ylabel('Log 10 Cb');
xlim([min(wavelengthsNm) max(wavelengthsNm)]);
ylim([0 3]);
title('Figure 8c: Test of AnsiZ136MPEComputeCb');
grid on

%% Figure 8b: Test Cc computation
%
% Answer should range between 1 and 8
% with wavelength between 1150 and 1200 nm.
% should look like Figure 8b, p. 99.
fprintf('Reproducing Figure 8b, p. 99\n');
wavelengthsNm = 1050:1399;
for i = 1:length(wavelengthsNm)
    Cc(i) = AnsiZ136MPEComputeCc(wavelengthsNm(i));
end
figure; clf; hold on
semilogy(wavelengthsNm,log10(Cc),'ro','MarkerSize',8,'MarkerFaceColor','r');
xlabel('Wavelength (nm)');
ylabel('Log10 Cc');
xlim([min(wavelengthsNm) max(wavelengthsNm)]);
ylim([0 1]);
title('Figure 8b: Test of AnsiZ136MPEComputeCc');
grid on

%% Figure 3: Test limiting cone angle computation
%
% Answer should range between 11 and 110
% with duration between 100 and 1e4 seconds.
% This should look like Figure 3, p. 93.
fprintf('Reproducing Figure 3, p. 93\n');
durations = logspace(1,4.2);
for i = 1:length(durations)
   limitingConeAngles(i) = AnsiZ136MPEComputeLimitingConeAngle(durations(i));
end
figure; clf; hold on
loglog(log10(durations),log10(limitingConeAngles),'ro','MarkerSize',8,'MarkerFaceColor','r');
xlabel('Log10 Stimulus Duration (sec)');
ylabel('Log10 Limiting Cone Angle (mrad)');
xlim([1 5]);
ylim([0 3]);
title('Figure 3: Test of AnsiZ136MPEComputeLimitingConeAngle');
grid on

%% Figure 7: Test photochemical and thermal limits for extended sources.
%
% This code reproduces Figure 7, p. 97.  Figure 7 is for wavelengths between
% 400 and 700.  The overall limit (but not the photochemical limit) is 
% independent of wavelength over this time interval.
%
% We only compute/plot down to 10-8 seconds, because our code doesn't
% implement the limts for extremely short times.
%
% Our plot also shows the photochemical limit (in red) down to the time
% where that is relevant.  Since it is above the overall limit, it
% would not affect that limit in the regime plotted in this figure.
fprintf('Reproducing Figure 7, p. 97\n');

% Specify what parameters to test
theStimulusWavelengthsNm = 400:20:700;
theStimulusSizesMrad = [1 7.5 25 100];
minLogDuration = -13;
maxLogDuration = 0;
stimulusDurationsSec = logspace(minLogDuration,maxLogDuration,1000);

radiantExposureFig7 = figure; clf; set(gcf,'Position',[770 670 1000 600]);
for s = 1:length(theStimulusSizesMrad)
    fprintf('\tSize %0.1f mRad\n',theStimulusSizesMrad(s));
    stimulusSizeMrad = theStimulusSizesMrad(s);
    stimulusSizeDeg = MradToDeg(stimulusSizeMrad);
    for w = 1:length(theStimulusWavelengthsNm)
        stimulusWavelengthNm = theStimulusWavelengthsNm(w);
        
        for t = 1:length(stimulusDurationsSec)
            stimulusDurationSec = stimulusDurationsSec(t);
            [~, ~, ~, MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2(w,t)] = ...
                AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
            
            [~, ~, ~, MPELimitCornealRadiantExposure_JoulesPerCm2(w,t)] = ...
                AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
        end
    end
    
    % Does the answer depend on wavelength?  Yes for photochemical limit
    % but no for overall limit.  You can explore if you want by enabling this section of code.
    if (0)
        minMPELimitCornealRadiantExposure_JoulesPerCm2 = min(MPELimitCornealRadiantExposure_JoulesPerCm2,[],1);
        minMPEPhotochemicalCornealRadiantExposure_JoulesPerCm2 = min(MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2,[],1);
        for w = 1:length(theStimulusWavelengthsNm)
            if (any(MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2(w,:) ~= minMPEPhotochemicalCornealRadiantExposure_JoulesPerCm2))
                fprintf('\t\tWavelength dependence for photochemical limit, wavelength %d\n',theStimulusWavelengthsNm(w));
            end
            if (any(MPELimitCornealRadiantExposure_JoulesPerCm2(w,:) ~= minMPELimitCornealRadiantExposure_JoulesPerCm2))
                fprintf('\t\tWavelength dependence for overall limit, wavelength %d\n',theStimulusWavelengthsNm(w));
            end
        end
    end
    
    figure(radiantExposureFig7); % subplot(1,length(theStimulusSizesMrad),s);
    hold on
    loglog(log10(stimulusDurationsSec),log10(min(MPELimitCornealRadiantExposure_JoulesPerCm2,[],1)),'bo','MarkerSize',8,'MarkerFaceColor','b');
    loglog(log10(stimulusDurationsSec),log10(min(MPEPhotochemicalCornealRadiantExposure_JoulesPerCm2,[],1)),'ro','MarkerSize',5,'MarkerFaceColor','r');
    drawnow;
end
xlabel('Log10 Stimulus Duration (sec)');
ylabel('Log10 Corneal Radiant Exposure (J/cm2)');
xlim([minLogDuration maxLogDuration]);
ylim([-8 0]);
title({'Figure 7: Test of AnsiZ136MPE Exposure Limits' ; 'Blue: Limit, Red: Photochemical Limit' ; sprintf('Size %0.1f mrad',stimulusSizeMrad) ; 'Wavelengths 400-700 nm'});
grid on

%% Figure 10: Test photochemical and thermal limits for extended sources.
%
% This code reproduces Figure 10, pp. 103-107.  Each version is for a
% different stimulus size, and shows the dependence of the limit on
% duration for different wavelengths.
%
% The agreement between what's produced here and the graphs in the
% standard is good for sizes <= 11 mrad, but diverges for larger
% sizes in terms of the photochemical limit.  The figures in the
% standard have a temporal break that depends on stimulus size
% for the photochemical limit, and there is no such dependence
% in the main formula in the table.

% Specify what parameters to test
theStimulusSizesMrad = [1 3 11 25 50];
theFigureNames = {'Figure 10a' 'Figure 10b' 'Figure 10c' 'Figure 10d' 'Figure 10e'};

for s = 1:length(theStimulusSizesMrad)
    fprintf('Reproducing %s\n',theFigureNames{s});
    stimulusSizeMrad = theStimulusSizesMrad(s);
    stimulusSizeDeg = MradToDeg(stimulusSizeMrad);
    switch (stimulusSizeMrad)
        case 1
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -4.1; maxLogY = -1;
            theStimulusWavelengthsNm = [400 450 475 490 700 1050 1200];
        case 3
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -4.1; maxLogY = 0;
            theStimulusWavelengthsNm = [400 450 475 500 700 1050 1200];
        case 11
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -4.1; maxLogY = 0;
            theStimulusWavelengthsNm = [400 450 475 500 514.5 700 1050 1200];
        case 25
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -4.1; maxLogY = 1;
            theStimulusWavelengthsNm = [400 450 475 500 532 700 1050 1200];
        case 50
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -4.1; maxLogY = 1;
            theStimulusWavelengthsNm = [400 450 475 500 532 550 700 1050 1200];
        otherwise
            error('Unexpected stimulus size specified');
    end
    stimulusDurationsSec = logspace(minLogDuration,maxLogDuration,1000);
    radiantExposureFig10 = figure; clf; set(gcf,'Position',[770 670 1000 600]);

    for w = 1:length(theStimulusWavelengthsNm)
        stimulusWavelengthNm = theStimulusWavelengthsNm(w);
        
        for t = 1:length(stimulusDurationsSec)
            stimulusDurationSec = stimulusDurationsSec(t);
            [~, ~, MPEPhotochemicalCornealIrradiance_WattsPerCm2(w,t), ~] = ...
                AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
            
            [~, ~, MPELimitCornealIrradiance_WattsPerCm2(w,t), ~] = ...
                AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
        end
        
        figure(radiantExposureFig10);
        hold on
        loglog(log10(stimulusDurationsSec),log10(MPELimitCornealIrradiance_WattsPerCm2(w,:)),'bo','MarkerSize',8,'MarkerFaceColor','b');
        index = find(MPEPhotochemicalCornealIrradiance_WattsPerCm2(w,:) ==  MPELimitCornealIrradiance_WattsPerCm2(w,:));
        loglog(log10(stimulusDurationsSec(index)),log10(MPEPhotochemicalCornealIrradiance_WattsPerCm2(w,(index))),'ro','MarkerSize',5,'MarkerFaceColor','r');
        drawnow;
    end
    
    xlabel('Log10 Stimulus Duration (sec)');
    ylabel('Log10 Corneal Irradiance (W/cm2)');
    xlim([minLogDuration maxLogDuration]);
    ylim([minLogY maxLogY]);
    title({'Test of AnsiZ136MPE Exposure Limits' ; 'Blue: Limit, Red Dashed: Photochemical Limit' ; sprintf('Size %0.1f mrad. %0.1f deg',theStimulusSizesMrad(s),stimulusSizeDeg) ; sprintf('Ansi Z136%s',theFigureNames{s})});
    grid on
end


%% Figure 11: Test photochemical and thermal limits for extended sources.
%
% This code reproduces Figure 11, pp. 108.  Each is for a a
% different stimulus size, and shows the dependence of the limit on
% duration for different wavelengths.
%
% This is close to the Figure 12 in the standard, although there
% are slight differences visible by eye, where the limits produced
% here are a bit lower than drawn in the document.
%
% The Mod1 version of the figure is for a smaller size, and is
% for comparison to Figure 10e.

% Specify what parameters to test
theStimulusSizesMrad = [110 50];
theFigureNames = {'Figure 11' 'Figure11Mod1'};

for s = 1:length(theStimulusSizesMrad)
    fprintf('Reproducing %s\n',theFigureNames{s});
    stimulusSizeMrad = theStimulusSizesMrad(s);
    stimulusSizeDeg = MradToDeg(stimulusSizeMrad);
    switch (stimulusSizeMrad)
        case 50
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -2; maxLogY = 3;
            theStimulusWavelengthsNm = [400 450 475 500 532 550 700 1050 1200];
        case 110
            minLogDuration = -1; maxLogDuration = 4.2;
            minLogY = -2; maxLogY = 3;
            theStimulusWavelengthsNm = [400 450 475 500 532 550 700 1050 1200];
        otherwise
            error('Unexpected stimulus size specified');
    end
    stimulusDurationsSec = logspace(minLogDuration,maxLogDuration,1000);
    radiantExposureFig11 = figure; clf; set(gcf,'Position',[770 670 1000 600]);

    for w = 1:length(theStimulusWavelengthsNm)
        stimulusWavelengthNm = theStimulusWavelengthsNm(w);
        
        for t = 1:length(stimulusDurationsSec)
            stimulusDurationSec = stimulusDurationsSec(t);
            [~, MPEPhotochemicalRadiance_WattsPerCm2Sr(w,t), ~, ~] = ...
                AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
            
            [~, MPELimitRadiance_WattsPerCm2Sr(w,t), ~, ~] = ...
                AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
        end
        
        figure(radiantExposureFig11);
        hold on
        loglog(log10(stimulusDurationsSec),log10(MPELimitRadiance_WattsPerCm2Sr(w,:)),'bo','MarkerSize',8,'MarkerFaceColor','b');
        index = find(abs(MPEPhotochemicalRadiance_WattsPerCm2Sr(w,:) - MPELimitRadiance_WattsPerCm2Sr(w,:)) < 1e-6);
        loglog(log10(stimulusDurationsSec(index)),log10(MPEPhotochemicalRadiance_WattsPerCm2Sr(w,(index))),'ro','MarkerSize',5,'MarkerFaceColor','r');
        drawnow;
    end
    
    xlabel('Log10 Stimulus Duration (sec)');
    ylabel('Log10 Radiance (W/[cm2-sr])');
    xlim([minLogDuration maxLogDuration]);
    ylim([minLogY maxLogY]);
    title({'Test of AnsiZ136MPE Exposure Limits' ; 'Blue: Limit, Red Dashed: Photochemical Limit' ; sprintf('Size %0.1f mrad. %0.1f deg',theStimulusSizesMrad(s),stimulusSizeDeg) ; sprintf('Ansi Z136%s',theFigureNames{s})});
    grid on
end


%% Figure 12: Test photochemical and thermal limits for extended sources.
%
% This code reproduces Figure 12, pp. 109.  Each is for a a
% different stimulus size, and shows the dependence of the limit on
% duration for different wavelengths.
%
% This is close to the Figure 12 in the standard, although there
% are slight differences visible by eye, where the limits produced
% here are a bit lower than drawn in the document.

% Specify what parameters to test
theStimulusSizesMrad = [110];
theFigureNames = {'Figure 12'};

for s = 1:length(theStimulusSizesMrad)
    fprintf('Reproducing %s\n',theFigureNames{s});
    stimulusSizeMrad = theStimulusSizesMrad(s);
    stimulusSizeDeg = MradToDeg(stimulusSizeMrad);
    switch (stimulusSizeMrad)
        case 110
            minLogDuration = -13; maxLogDuration = 0;
            minLogY = -4.1; maxLogY = 3;
            theStimulusWavelengthsNm = [400 700 1050 1200];
        otherwise
            error('Unexpected stimulus size specified');
    end
    stimulusDurationsSec = logspace(minLogDuration,maxLogDuration,1000);
    radiantExposureFig12 = figure; clf; set(gcf,'Position',[770 670 1000 600]);

    for w = 1:length(theStimulusWavelengthsNm)
        stimulusWavelengthNm = theStimulusWavelengthsNm(w);
        
        for t = 1:length(stimulusDurationsSec)
            stimulusDurationSec = stimulusDurationsSec(t);
            [MPEPhotochemicalIntegratedRadiance_JoulesPerCm2Sr(w,t), ~, ~, ~] = ...
                AnsiZ136MPEComputeExtendedSourcePhotochemicalLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
            
            [MPELimitIntegratedRadiance_JoulesPerCm2Sr(w,t), ~, ~, ~] = ...
                AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
        end
        
        figure(radiantExposureFig12);
        hold on
        loglog(log10(stimulusDurationsSec),log10(MPELimitIntegratedRadiance_JoulesPerCm2Sr(w,:)),'bo','MarkerSize',8,'MarkerFaceColor','b');
        index = find(abs(MPEPhotochemicalIntegratedRadiance_JoulesPerCm2Sr(w,:) - MPELimitIntegratedRadiance_JoulesPerCm2Sr(w,:)) < 1e-8);
        loglog(log10(stimulusDurationsSec(index)),log10(MPEPhotochemicalIntegratedRadiance_JoulesPerCm2Sr(w,(index))),'ro','MarkerSize',5,'MarkerFaceColor','r');
        drawnow;
    end
    
    xlabel('Log10 Stimulus Duration (sec)');
    ylabel('Log10 Integrated Radiance (J/[cm2-sr])');
    xlim([minLogDuration maxLogDuration]);
    ylim([minLogY maxLogY]);
    title({'Test of AnsiZ136MPE Exposure Limits' ; 'Blue: Limit, Red Dashed: Photochemical Limit' ; sprintf('Size %0.1f mrad. %0.1f deg',theStimulusSizesMrad(s),stimulusSizeDeg) ; sprintf('Ansi Z136%s',theFigureNames{s})});
    grid on
end


%% Make a plot of how limit varies with stimulus size, for specified
% duration and wavelength.  Take minimum over vectors specified for
% each.

% Specify what parameters to test
minLogSize = -1; maxLogSize = 2;
minLogYRad = -3; maxLogYRad = 2;
minLogYIrrad = -5; maxLogYIrrad = 0;
minLogYIntRad = 0; maxLogYIntRad = 3;
minLogYRadExp = -4; maxLogYRadExp = -1;
stimulusSizesDeg = logspace(minLogSize,maxLogSize,100);
stimulusWavelengthsNm = 400:20:1390;
stimulusDurationsSec = logspace(-1,4,100);
fprintf('Computing over stimulus sizes from %0.1f to %0.1f deg\n',min(stimulusSizesDeg),max(stimulusSizesDeg));
clear MPELimitIntegratedRadiance_JoulesPerCm2Sr MPELimitRadiance_WattsPerCm2Sr MPELimitCornealIrradiance_WattsPerCm2 MPELimitCornealRadiantExposure_JoulesPerCm2
for s = 1:length(stimulusSizesDeg)
    stimulusSizeDeg = theStimulusSizesDeg(s);
    stimulusSizeMrad = DegToMrad(stimulusSizeDeg);
    MPELimitIntegratedRadiance_JoulesPerCm2Sr(s) = Inf;
    MPELimitRadiance_WattsPerCm2Sr(s) = Inf;
    MPELimitCornealIrradiance_WattsPerCm2(s) = Inf;
    MPELimitCornealRadiantExposure_JoulesPerCm2(s) = Inf;
    for w = 1:length(stimulusWavelengthsNm)
        stimulusWavelengthNm = stimulusWavelengthsNm(w);  
        for t = 1:length(stimulusDurationsSec)
            stimulusDurationSec = stimulusDurationsSec(t);
             [temp1, temp2, temp3, temp4] = ...
                AnsiZ136MPEComputeExtendedSourceLimit(stimulusDurationSec,stimulusSizeDeg,stimulusWavelengthNm);
            if (temp1 < MPELimitIntegratedRadiance_JoulesPerCm2Sr(s))
                MPELimitIntegratedRadiance_JoulesPerCm2Sr(s) = temp1;
            end 
            if (temp2 < MPELimitRadiance_WattsPerCm2Sr(s))
                MPELimitRadiance_WattsPerCm2Sr(s) = temp2;
            end 
            if (temp3 < MPELimitCornealIrradiance_WattsPerCm2(s))
                MPELimitCornealIrradiance_WattsPerCm2(s) = temp3;
            end
             if (temp4 < MPELimitCornealRadiantExposure_JoulesPerCm2(s))
                MPELimitCornealRadiantExposure_JoulesPerCm2(s) = temp4;
            end
        end  
    end   
end

stimulusSizeFig = figure; clf; set(gcf,'Position',[770 670 1000 1000]);
figure(stimulusSizeFig);
subplot(2,2,1); hold on
loglog(log10(stimulusSizesDeg),log10(MPELimitRadiance_WattsPerCm2Sr),'bo','MarkerSize',8,'MarkerFaceColor','b');
xlabel('Log10 Stimulus Size (deg)');
ylabel('Log10 Radiance (W/[cm2-sr])');
xlim([minLogSize maxLogSize]);
ylim([minLogYRad maxLogYRad]);
title({'Test of AnsiZ136MPE Exposure Limits' ; sprintf('Durations %g to %g sec',min(stimulusDurationsSec),max(stimulusDurationsSec)) ; ...
    sprintf('Wavelengths %d to %d nm',min(stimulusWavelengthsNm),max(stimulusWavelengthsNm))});
grid on

subplot(2,2,2); hold on
loglog(log10(stimulusSizesDeg),log10(MPELimitCornealIrradiance_WattsPerCm2),'bo','MarkerSize',8,'MarkerFaceColor','b');
xlabel('Log10 Stimulus Size (deg)');
ylabel('Log10 Corneal Irradiance (W/cm2)');
xlim([minLogSize maxLogSize]);
ylim([minLogYIrrad maxLogYIrrad]);
title({'Test of AnsiZ136MPE Exposure Limits' ; sprintf('Durations %g to %g sec',min(stimulusDurationsSec),max(stimulusDurationsSec)) ; ...
    sprintf('Wavelengths %d to %d nm',min(stimulusWavelengthsNm),max(stimulusWavelengthsNm))});
grid on

subplot(2,2,3); hold on
loglog(log10(stimulusSizesDeg),log10(MPELimitIntegratedRadiance_JoulesPerCm2Sr),'bo','MarkerSize',8,'MarkerFaceColor','b');
xlabel('Log10 Stimulus Size (deg)');
ylabel('Log10 Integrated Radiance (J/[cm2-sr])');
xlim([minLogSize maxLogSize]);
ylim([minLogYIntRad maxLogYIntRad]);
title({'Test of AnsiZ136MPE Exposure Limits' ; sprintf('Durations %g to %g sec',min(stimulusDurationsSec),max(stimulusDurationsSec)) ; ...
    sprintf('Wavelengths %d to %d nm',min(stimulusWavelengthsNm),max(stimulusWavelengthsNm))});
grid on

subplot(2,2,4); hold on
loglog(log10(stimulusSizesDeg),log10(MPELimitCornealRadiantExposure_JoulesPerCm2),'bo','MarkerSize',8,'MarkerFaceColor','b');
xlabel('Log10 Stimulus Size (deg)');
ylabel('Log10 Corneal Radiant Exposure (J/cm2)');
xlim([minLogSize maxLogSize]);
ylim([minLogYRadExp maxLogYRadExp]);
title({'Test of AnsiZ136MPE Exposure Limits' ; sprintf('Durations %g to %g sec',min(stimulusDurationsSec),max(stimulusDurationsSec)) ; ...
    sprintf('Wavelengths %d to %d nm',min(stimulusWavelengthsNm),max(stimulusWavelengthsNm))});
grid on