Code covered by the BSD License  

Highlights from
ProcessNetwork Version 1.0 Software

image thumbnail

ProcessNetwork Version 1.0 Software

by

 

Functions for the delineation of Dynamical Process Networks using Information Theory

[Abinary,Awtd,AwtdCut,charLagFirstPeak,TcharLagFirstPeak,charLagMaxPeak,TcharLagMaxPeak,TvsIzerocharLagMaxPeak,nSigLags,FirstSigLag,LastSigLag]=AdjMatrices(T,SigThreshT,TvsIzero);
function [Abinary,Awtd,AwtdCut,charLagFirstPeak,TcharLagFirstPeak,charLagMaxPeak,TcharLagMaxPeak,TvsIzerocharLagMaxPeak,nSigLags,FirstSigLag,LastSigLag]=AdjMatrices(T,SigThreshT,TvsIzero);

% COMPUTES AN ADJACENCY MATRIX A
% COMPUTES THE CHARACTERISTIC LAG WHICH IS THE FIRST SIGNIFICANT LAG
% TAKES THE TRANSFER INFORMATION MATRIX AND THE SIGNIFICANCE THRESHOLDS

[nSignals,~,nLags]=size(T);

Abinary=zeros(nSignals,nSignals,nLags);
Awtd=NaN(nSignals,nSignals,nLags);
AwtdCut=zeros(nSignals,nSignals,nLags);
charLagFirstPeak=zeros(nSignals,nSignals);
TcharLagFirstPeak=zeros(nSignals,nSignals);
charLagMaxPeak=zeros(nSignals,nSignals);
TcharLagMaxPeak=zeros(nSignals,nSignals);
TvsIzerocharLagMaxPeak=zeros(nSignals,nSignals);
nSigLags=zeros(nSignals,nSignals);
FirstSigLag=NaN(nSignals,nSignals);
LastSigLag=NaN(nSignals,nSignals);

for sX=1:nSignals
    for sY=1:nSignals

        FirstPeakFlag=0;
        FirstSigFlag=0;

        Awtd=T;

        %check the first lag
        lag=1;
        if T(sX,sY,lag) > SigThreshT(sX,sY)
            Abinary(sX,sY,lag) = 1;
            AwtdCut(sX,sY,lag) = T(sX,sY,lag);
            LastSigLag(sX,sY)=lag;
            nSigLags(sX,sY)=nSigLags(sX,sY)+1;
            charLagMaxPeak(sX,sY)=lag;
            TcharLagMaxPeak(sX,sY)=T(sX,sY,lag);
            TvsIzerocharLagMaxPeak(sX,sY)=TvsIzero(sX,sY,lag);
            FirstSigFlag=1;
            if nLags > 1
                if T(sX,sY,lag) > T(sX,sY,lag+1)
                    charLagFirstPeak(sX,sY)=lag;
                    TcharLagFirstPeak(sX,sY)=T(sX,sY,lag);
                    FirstPeakFlag = 1;
                end
            else
                charLagFirstPeak(sX,sY)=lag;
                TcharLagFirstPeak(sX,sY)=T(sX,sY,lag);
                FirstPeakFlag = 1;
            end
        end

        %check the other lag
        if nLags > 1
            for lag=2:nLags-1
                if T(sX,sY,lag) > SigThreshT(sX,sY)
                    Abinary(sX,sY,lag) = 1;
                    AwtdCut(sX,sY,lag) = T(sX,sY,lag);
                    LastSigLag(sX,sY)=lag;
                    nSigLags(sX,sY)=nSigLags(sX,sY)+1;
                    if FirstSigFlag == 0
                        FirstSigLag(sX,sY)=lag;
                        FirstSigFlag = 1;
                    end
                    if FirstPeakFlag == 0 && T(sX,sY,lag) > T(sX,sY,lag-1) && T(sX,sY,lag) > T(sX,sY,lag+1)
                        charLagFirstPeak(sX,sY)=lag;
                        TcharLagFirstPeak(sX,sY)=T(sX,sY,lag);
                        FirstPeakFlag = 1;
                    end
                    if T(sX,sY,lag) > TcharLagMaxPeak(sX,sY)
                        charLagMaxPeak(sX,sY)=lag;
                        TcharLagMaxPeak(sX,sY)=T(sX,sY,lag);
                        TvsIzerocharLagMaxPeak(sX,sY)=TvsIzero(sX,sY,lag);
                    end
                end
            end

            %check the last lag
            lag=nLags;
            if T(sX,sY,lag) > SigThreshT(sX,sY)
                Abinary(sX,sY,lag) = 1;
                AwtdCut(sX,sY,lag) = T(sX,sY,lag);
                LastSigLag(sX,sY)=lag;
                nSigLags(sX,sY)=nSigLags(sX,sY)+1;
                if FirstSigFlag == 0
                    FirstSigLag(sX,sY)=lag;
                    FirstSigFlag = 1;
                end
                if FirstPeakFlag == 0 && T(sX,sY,lag) > T(sX,sY,lag-1)
                    charLagFirst(sX,sY)=lag;
                    TcharLagFirst(sX,sY)=T(sX,sY,lag);
                    FirstPeakFlag = 1;
                end
                if T(sX,sY,lag) > TcharLagMaxPeak(sX,sY)
                    charLagMaxPeak(sX,sY)=lag;
                    TcharLagMaxPeak(sX,sY)=T(sX,sY,lag);
                    TvsIzerocharLagMaxPeak(sX,sY)=TvsIzero(sX,sY,lag);
                end
            end
        end
    end
end

Contact us