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

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychRadiometric/PsychISO2007MPE/ISO2007MPEComputeType1ContinuousCornealUVWeightedValue.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_UWattsPerCm2,limit_UWattsPerCm2] = ISO2007MPEComputeType1ContinuousCornealUVWeightedValue(S,radiance_WattsPerSrM2,weightingS,stimulusDurationSecs,stimulusAreaDegrees2)
 
2
% [val_UWattsPerCm2,limit_UWattsPerCm2] = ISO2007MPEComputeType1ContinuousCornealUVWeightedValue(S,radiance_WattsPerSrM2,weightingS,stimulusDurationSecs,stimulusAreaDegrees2)
 
3
%
 
4
% Compute the weighted UV radiation for Type 1 instruments as given on page 7, Table 2, 
 
5
% 5.4.1.1.
 
6
%
 
7
% Input spectrum is radiance in units of Watts/[sr-m2-wlinterval].
 
8
%
 
9
% Also return the exposure limit for this quantity.
 
10
%
 
11
% See page 6 for a definition of a Type 1 instrument.  As far as I can tell, the key
 
12
% criterion is that it doesn't put out more light that exceeds the Type 1 limits.
 
13
 
14
% If the exposure time is longer than 2 hours the specified limits should be reduced by
 
15
% 1/exposureDuration in hours.  This routine implements that adjustment for its returned
 
16
% limit value.  It does not implement a further reduction of of the limit (by a factor of 2)
 
17
% for microscopes and endoilluminators.
 
18
%
 
19
% ****************************************************************************
 
20
% IMPORTANT: Before using the ISO2007MPE routines, please see the notes on usage
 
21
% and responsibility in PsychISO2007MPE/Contents.m (type "help PsychISO2007MPE"
 
22
% at the Matlab prompt.
 
23
% ****************************************************************************
 
24
%
 
25
% 6/25/13  dhb  Wrote it.
 
26
 
 
27
%% Specify the limit (from table)
 
28
exposureDurationHours = stimulusDurationSecs/3600;
 
29
if (exposureDurationHours <= 2)
 
30
    limit_UWattsPerCm2 = 0.4;
 
31
else
 
32
    limit_UWattsPerCm2 = 0.4/(exposureDurationHours/2);
 
33
end
 
34
 
 
35
%% Convert radiance to corneal irradiance
 
36
cornealIrradiance_WattsPerM2 = RadianceAndDegrees2ToCornIrradiance(radiance_WattsPerSrM2,stimulusAreaDegrees2);
 
37
cornealIrradiance_UWattsPerM2 = (10^6)*cornealIrradiance_WattsPerM2;
 
38
cornealIrradiance_UWattsPerCm2 = (10^-4)*cornealIrradiance_UWattsPerM2;
 
39
 
 
40
%% Get weighted sum.  The weighting function is zero outside the
 
41
% specified wavelength range, so we don't have to worry about the
 
42
% wavelength limits in the standard.  We do perform a sanity check
 
43
% that something got passed in the wavelength region of interest.
 
44
wls = SToWls(S);
 
45
index = find(wls >= 250 & wls <= 400, 1);
 
46
if (isempty(index))
 
47
    error('Should not call this routine with no spectral sampling between 250 and 400');
 
48
end
 
49
val_UWattsPerCm2 = sum(cornealIrradiance_UWattsPerCm2 .* weightingS);
 
50