/usr/share/psychtoolbox-3/PsychTests/WavelengthSamplingTest.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 | % WavelengthSamplingTest
%
% There are three formats used to represent wavelength
% sampling in the Psychtoolbox.
% S-format - a 3 by 1 row vector [start step numberSamples].
% wls-format - a list of evenly spaced wavelengths.
% struct-format - a structure with fields start, step, and numberSamples.
%
% The S-format predates the availability of structures in MATLAB, but
% is used widely in extant code. Low level conversion routines transform
% between these representations, and in particular routines MakeItS,
% MakeItWls, and MakeItStruct take any of the three formats and return
% one. By calling one of these before using wavelength format information,
% it is possible to write code that is compatible with all three.
%
% 7/11/03 dhb Wrote this test program.
% Clear
clear all
% Generate some test data
S = [380 5 81];
wls = MakeItWls(S);
wlstruct = MakeItStruct(S);
% Convert all formats to wls in various ways.
wls1 = SToWls(S);
wls2 = MakeItWls(S);
wls3 = MakeItWls(wls);
wls4 = MakeItWls(wlstruct);
if (any(wls ~= wls1))
fprintf('Wavelength conversion error: wls1 mismatched to wls\n');
end
if (any(wls ~= wls2))
fprintf('Wavelength conversion error: wls2 mismatched to wls\n');
end
if (any(wls ~= wls3))
fprintf('Wavelength conversion error: wls3 mismatched to wls\n');
end
if (any(wls ~= wls4))
fprintf('Wavelength conversion error: wls4 mismatched to wls\n');
end
% Convert all formats to S in various ways.
S1 = WlsToS(wls);
S2 = MakeItS(S);
S3 = MakeItS(wls);
S4 = MakeItS(wlstruct);
if (any(S ~= S1))
fprintf('Wavelength conversion error: S1 mismatched to S\n');
end
if (any(S ~= S2))
fprintf('Wavelength conversion error: S2 mismatched to S\n');
end
if (any(S ~= S3))
fprintf('Wavelength conversion error: S3 mismatched to S\n');
end
if (any(S ~= S4))
fprintf('Wavelength conversion error: S4 mismatched to S\n');
end
% Convert all formats to S in various ways.
wlstruct1 = MakeItStruct(S);
wlstruct2 = MakeItStruct(wls);
wlstruct3 = MakeItStruct(wlstruct);
if (wlstruct.start ~= wlstruct1.start || ...
wlstruct.step ~= wlstruct1.step || ...
wlstruct.numberSamples ~= wlstruct1.numberSamples)
fprintf('Wavelength conversion error: wlstruct1 mismatched to wlstruct\n');
end
if (wlstruct.start ~= wlstruct2.start || ...
wlstruct.step ~= wlstruct2.step || ...
wlstruct.numberSamples ~= wlstruct2.numberSamples)
fprintf('Wavelength conversion error: wlstruct2 mismatched to wlstruct\n');
end
if (wlstruct.start ~= wlstruct3.start || ...
wlstruct.step ~= wlstruct3.step || ...
wlstruct.numberSamples ~= wlstruct3.numberSamples)
fprintf('Wavelength conversion error: wlstruct3 mismatched to wlstruct\n');
end
|