jpilup_dke_yp

PURPOSE ^

SYNOPSIS ^

function [flag] = jpilup_dke_yp(tt,kk,tl,tp,tc,kmin,kmax,nhisto,ko,i);

DESCRIPTION ^

    Dead-time and spectrum modification due to JET-FEB ADC coding system


    Input:

    Output:


by Y.PEYSSON CEA-DRFC <yves.peysson@cea.fr>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [flag] = jpilup_dke_yp(tt,kk,tl,tp,tc,kmin,kmax,nhisto,ko,i);
0002 %
0003 %    Dead-time and spectrum modification due to JET-FEB ADC coding system
0004 %
0005 %
0006 %    Input:
0007 %
0008 %    Output:
0009 %
0010 %
0011 %by Y.PEYSSON CEA-DRFC <yves.peysson@cea.fr>
0012 %
0013 %
0014 beta = 5;
0015 alpha = beta*tp/(tl-tp);
0016 %
0017 if length(tt) == 1,
0018     flag = ko(i);
0019     return;
0020 else
0021     ttt = tt -min(tt) + tp; 
0022     flag = zeros(size(ttt))';
0023     tmin = 0;
0024     tmax = max(ttt) +tl -tp;
0025     t = linspace(tmin,tmax,(tmax -tmin)/tc);
0026     k = zeros(size(t));
0027     k(1) = 0;
0028     kdiag = linspace(kmin,kmax,nhisto+1);
0029      mask = [];
0030     for j = 2:length(t),
0031         for jj = 1:length(ttt),
0032             if t(j) >= ttt(jj)-tp & t(j) < ttt(jj)+tl-tp,
0033                 a = kk(jj)/((tp^(alpha+beta))*((beta/alpha)^beta));
0034                       tref = tp+t(j)-ttt(jj);
0035                 k(j) = k(j) + a*(tref.^alpha).*((tl-tref).^beta);
0036             end
0037         end
0038         for jj = 1:nhisto+1,
0039             if k(j-1) < kdiag(jj) & k(j) >= kdiag(jj),
0040                 mask = [mask;(t(j-1)+t(j))/2,kdiag(jj),1];
0041             elseif k(j-1) >= kdiag(jj) & k(j) < kdiag(jj),
0042                 mask = [mask;(t(j-1)+t(j))/2,kdiag(jj),-1];
0043             end
0044         end
0045     end
0046 %
0047     for j = 1:size(mask,1)-1,
0048         if mask(j,3) + mask(j+1,3) == 0 & mask(j,3) > mask(j+1,3) & mask(j,2) < max(kdiag),
0049             flag0 = 0;
0050             for jj = 1:length(ttt),
0051                 if ttt(jj) > mask(j,1) & ttt(jj) <= mask(j+1,1) & flag0 == 0,
0052                     flag(jj) = 1;
0053                     flag0 =1;
0054                 end
0055             end
0056         end
0057     end
0058 %
0059     flag = flag.* ko(i:1:i+length(tt)-1);
0060     flag(find(flag == 0)) = -1 + flag(find(flag == 0));
0061 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.