0001 function parm = set_pair_ch(posfile)
0002
0003
0004
0005
0006 parm = define_pair_channel;
0007
0008 p = load(posfile);
0009
0010
0011 Nsource = length(parm.source);
0012 parm.src_pos = zeros(Nsource,3);
0013
0014 for k=1:Nsource
0015 ix = strmatch(parm.source{k}, p.channel.name, 'exact');
0016 if isempty(ix)
0017 error('channel %s not found.\n', parm.source{k});
0018 end
0019 parm.src_pos(k,:) = p.channel.Xspm(ix, :);
0020 end
0021
0022
0023 Ndetector = length(parm.detector);
0024 parm.det_pos = zeros(Ndetector,3);
0025
0026 for k=1:Ndetector
0027 ix = strmatch(parm.detector{k}, p.channel.name, 'exact');
0028 if isempty(ix)
0029 error('channel %s not found.\n', parm.detector{k});
0030 end
0031 parm.det_pos(k,:) = p.channel.Xspm(ix, :);
0032 end
0033
0034 return
0035
0036 if Npair~=size(det_pos,1)
0037 error('# of source and detector are different');
0038 end
0039