Commit aa9cab0b authored by Ole Koenig's avatar Ole Koenig

foucalc: Add normalized CPD to output structure

parent fef2a1b1
......@@ -99,7 +99,9 @@ define foucalc()
_for i (1, numchan, 1)
_for j (i+1, numchan, 1)
fieldnames = [fieldnames, ["realcpd", "imagcpd", "errrealcpd", "errimagcpd", "noicpd", "rawcof", "cof", "errcof", "lag", "errlag"]+string(i)+string(j)]; % assuming i < j < 100 ...
fieldnames = [fieldnames, ["normrealcpd", "normimagcpd", "errnormrealcpd", "errnormimagcpd",
"realcpd", "imagcpd", "errrealcpd", "errimagcpd", "noicpd",
"rawcof", "cof", "errcof", "lag", "errlag"]+string(i)+string(j)]; % assuming i < j < 100 ...
variable fouquant = @Struct_Type(fieldnames); % create structure
variable rmsquant = @Struct_Type(rms_fieldnames);
......@@ -226,6 +228,13 @@ define foucalc()
set_struct_field(fouquant, "errrealcpd"+lostr+histr, Real(errcpd));
set_struct_field(fouquant, "errimagcpd"+lostr+histr, Imag(errcpd));
variable tempnormcpd = normpsd(cpd, normtype, sqrt(avgrate[lo-1]*avgrate[hi-1]), sqrt(avgbkg[lo-1]*avgbkg[hi-1]), tseg, dimseg);
variable temperrnormcpd = errcpd / cpd[0] * tempnormcpd[0];
set_struct_field(fouquant, "normrealcpd"+lostr+histr, Real(tempnormcpd));
set_struct_field(fouquant, "errnormrealcpd"+lostr+histr, Real(temperrnormcpd));
set_struct_field(fouquant, "normimagcpd"+lostr+histr, Imag(tempnormcpd));
set_struct_field(fouquant, "errnormimagcpd"+lostr+histr, Imag(temperrnormcpd));
% use SIGPSD to calculate the cross power density noise
variable sigpsd_lo = get_struct_field(fouquant, "sigpsd"+lostr);
variable sigpsd_hi = get_struct_field(fouquant, "sigpsd"+histr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment