/usr/share/psychtoolbox-3/PsychRadiometric/Obsolete/RetIrradianceToRadiance.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 | function radianceWattsPerM2Sr = RetIrradianceToRadiance(irradianceWattsPerUm2,irradianceS,pupilAreaMm2,eyeLengthMm)
% radianceWattsPerM2Sr = RetIrradianceToRadiance(irradianceWattsPerUm2,irradianceS,pupilAreaMm2,eyeLengthMm)
%
% Perform the geometric calculations necessary to convert a measurement of retinal
% irradiance to the source radiance that would produce it.
%
% Input irradianceWattsPerUm2 is in units of power/um^2-wlinterval.
% Input irradianceS gives the wavelength sampling information.
% Input pupilAreaMm2 should be in units of mm^2.
% Input eyeLengthMm should be the length of the eye in mm.
% Output radianceWattsPerM2Sr is in units of power/m^2-sr-wlinterval.
%
% Light power may be expressed in watts or quanta-sec or in your
% favorite units. Indeed, it may also be passed as energy rather
% than power.
%
% This conversion does not take absorption in the eye into account,
% as this is more conveniently foldeded into the spectral absorbtance.
%
% See also: RetIrradianceAndPupilAreaEyeLengthToRadiance
%
% Note: This routine is now obsolete, as it mixes radiometric and unit conversions. Preferred is to
% use RadianceAndPupilAreaEyeLengthToRetIrradiance and then take charge of your units in your
% calling code.
%
% 2/28/13 dhb Wrote it.
% 3/6/13 dhb Rewrite to use new conversion function. Move to Obsolete directory.
% dhb Also improved variable naming.
%% Make sure we didn't break anything?
CHECKAGAINSTOLDCODE = 1;
%% Convert units from um^2 to mm^2 base.
irradianceWattsPerMm2 = irradianceWattsPerUm2*1e6;
%% Convert to radiance
radianceWattsPerMm2Sr = RetIrradianceAndPupilAreaEyeLengthToRadiance(irradianceWattsPerMm2,irradianceS,pupilAreaMm2,eyeLengthMm);
%% Convert radiance to power/sr-m^2-wlinterval
radianceWattsPerM2Sr = radianceWattsPerMm2Sr*1e6;
%% Check what we get now against the original implementation
if (CHECKAGAINSTOLDCODE)
% Convert units from um^2 to mm^2 base.
irradianceWattsPerMm2Check = irradianceWattsPerUm2*1e6;
% Define factor to convert radiance spectrum to retinal irradiance in watts/mm^2-wlinterval.
% We then apply this in the opposite direction. See RadianceToRetIrradiance for the
% conversion logic.
conversionFactor = pupilAreaMm2/(eyeLengthMm^2);
radianceWattsPerMm2SrCheck = irradianceWattsPerMm2Check/conversionFactor;
% Convert radiance to power/sr-m^2-wlinterval
radianceWattsPerM2SrCheck = radianceWattsPerMm2SrCheck*1e6;
% Check
if (abs(radianceWattsPerM2Sr - radianceWattsPerM2SrCheck) > 1e-16)
error('New and old ways of computing this quantity do not agree. Oops!');
end
end
|