/usr/share/psychtoolbox-3/PsychHardware/PR670Toolbox/PR670parsespdstr.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 | function spd = PR670parsespdstr(readStr, S)
% PR670parsespdstr - Parses the spectral power distribution string returned by the PR-670.
%
% Syntax:
% spd = PR670parsespdstr(readStr)
% spd = PR670parsespdstr(readStr, S);
%
% Description:
% Parse the spectral power distribution string returned by the PR-670. The
% results are splined to the desired wavelength sampling defined by the 'S'
% input parameter.
%
% Input:
% readStr (1xN char) - Raw data returned from a meter measurment.
% S (1x3) - Wavelength sampling. Default: [380 5 81]
if nargin < 2 || isempty(S)
S = [380 5 81];
end
% Split up the data delimited by newline characters.
C = textscan(readStr, '%s', 'Delimiter', '\n');
C = C{1};
% Loop over all the data lines and pull out the spectral info. Note that
% the first line doesn't contain wavelength data so we toss it.
C = C(2:end);
numWavelengths = length(C);
if (numWavelengths ~= 201)
error('Unexpected native number of wavelength samples for PR-670');
end
spd = zeros(numWavelengths, 1);
wavelengths = spd;
for i = 1:length(C)
% Parse the wavelength measurement line. The first element of the
% returned cell array will be the wavelength, the second element the
% measurement.
D = textscan(C{i}, '%d,%f');
wavelengths(i) = D{1};
spd(i) = D{2};
end
% Convert to our units standard.
spd = 2 * spd;
if (wavelengths(2)-wavelengths(1) ~= 2)
error('Unexpected native wavelength sampling for PR-670');
end
% Spline to desired wavelength sampling.
startWavelength = wavelengths(1);
spacing = wavelengths(2) - wavelengths(1);
S0 = [startWavelength, spacing, numWavelengths];
spd = SplineSpd(S0, spd, S);
|