~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychRadiometric/PsychISO2007MPE/ISO2007MPEComputeType1ContinuousRadianceTHWeightedValue.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [val_UWattsPerSrCm2,limit_UWattsPerSrCm2] = ISO2007MPEComputeType1ContinuousRadianceTHWeightedValue(...
 
2
    S,radiance_WattsPerSrM2,weightingR,stimulusDurationSecs)
 
3
%[val_UWattsPerSrCm2,limit_UWattsPerSrCm2] = ISO2007MPEComputeType1ContinuousRadianceTHWeightedValue(...
 
4
%    S,radiance_WattsPerSrM2,weightingR,stimulusDurationSecs)
 
5
%
 
6
% Compute the weighted thermal radiance for Type 1 instruments as given on page 9, Table 2, 
 
7
% 5.4.1.6.b.  Note.  The limit specified there is 6 W/[sr-cm2].  I reduced to 5.88 because
 
8
% this is the worst-case Type 2 limit (largest retinal diameter spot, see Table 4, 5.5.1.5b),
 
9
% and it seemed more conservative to do so.
 
10
%
 
11
% Input spectrum is radiance in units of Watts/[sr-m2-wlinterval].
 
12
%
 
13
% Also return the exposure limit for this quantity.
 
14
%
 
15
% See page 6 for a definition of a Type 1 instrument.  As far as I can tell, the key
 
16
% criterion is that it doesn't put out more light that exceeds the Type 1 limits.
 
17
 
18
% If the exposure time is longer than 2 hours the specified limits should be reduced by
 
19
% 1/exposureDuration in hours.  This routine implements that adjustment for its returned
 
20
% limit value.  It does not implement a further reduction of of the limit (by a factor of 2)
 
21
% specifed for microscopes and endoilluminators.
 
22
%
 
23
% The standard specifies that the passed radiance should be the highest averaged over
 
24
% an aperture of a specified size, where the size depends on the instrument.  This
 
25
% routine does not worry about that aspect.  The most conservative thing to do is
 
26
% to pass the highest localized power that will be presented.
 
27
%
 
28
% The indicates that radiance should be measured through a 7 mm aperture at the cornea.
 
29
% I believe this refers to the case where you are measuring radiance by measuring radiant
 
30
% flux through two apertures at a known distance apart.  It would then make sense that you'd
 
31
% want to know the radiance defined by the direction subtended by a 7 mm aperture at the
 
32
% cornea, e.g. right where a large pupil would be.  If you measure using some other device
 
33
% (e.g. a PhotoResearch PR-XXX that directly obtains radiance and do so from the eye position,
 
34
% that also seems reasonable.
 
35
%
 
36
% ****************************************************************************
 
37
% IMPORTANT: Before using the ISO2007MPE routines, please see the notes on usage
 
38
% and responsibility in PsychISO2007MPE/Contents.m (type "help PsychISO2007MPE"
 
39
% at the Matlab prompt.
 
40
% ****************************************************************************
 
41
%
 
42
% 6/26/13  dhb  Wrote it.
 
43
 
 
44
%% Specify the limit (from table, see note above about why
 
45
% 5.88 rather than 6.)
 
46
exposureDurationHours = stimulusDurationSecs/3600;
 
47
if (exposureDurationHours <= 2)
 
48
    limit_UWattsPerSrCm2 = 5.88*(10^6);
 
49
else
 
50
    limit_UWattsPerSrCm2 = 5.88*(10^6)/(exposureDurationHours/2);
 
51
end
 
52
 
 
53
%% Unit conversion
 
54
radiance_UWattsPerSrM2 = (10^6)*radiance_WattsPerSrM2;
 
55
radiance_UWattsPerSrCm2 = (10^-4)*radiance_UWattsPerSrM2;
 
56
 
 
57
%% Get weighted sum.  The weighting function is zero outside the
 
58
% specified wavelength range, so we don't have to worry about the
 
59
% wavelength limits in the standard.  We do perform a sanity check
 
60
% that something got passed in the wavelength region of interest.
 
61
wls = SToWls(S);
 
62
index = find(wls >= 380 & wls <= 1400, 1);
 
63
if (isempty(index))
 
64
    error('Should not call this routine with no spectral sampling between 380 and 1400');
 
65
end
 
66
val_UWattsPerSrCm2 = sum(radiance_UWattsPerSrCm2 .* weightingR);
 
67