-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevaluate_IEAD_from_IEADstar.m
50 lines (37 loc) · 1.32 KB
/
evaluate_IEAD_from_IEADstar.m
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The function evaluate_IEAD_from_IEADstar computes IEAD values using
% an IEAD* (IEAD in the transformed coordinates) distribution
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input
% -----
% - theta: array with angle values
% - E: array with energy values
% - thetabar: mean angle
% - Ebar: mean energy
% - Theta: covariance matrix
% - thetastar: array with theta* values
% - Estar: array with E* values
% - IEADstar: array with IEAD* values
% Output
% ------
% - IEAD: array with IEAD values
% Author: Pablo Seleson
% ------
% Last Modified: February 25, 2022
% -------------
function [IEAD] = evaluate_IEAD_from_IEADstar(theta,E,thetabar,Ebar,Theta,thetastar,Estar,IEADstar)
% Dimension of data
dim = length(theta);
% Transform theta and E via the moments
[wx,wy] = transform_E_theta(theta,E,thetabar,Ebar,Theta);
% Find closest bins in the transformed coordinates
[~,I] = min(abs(wx'-thetastar) + abs(wy'-Estar));
I = I';
% Initialize array
IEAD = zeros(dim,1);
% Area conversion factor
factor = 1/(sqrt(abs(det(Theta))));
% Assign data from the closest bin in the transformed coordinates
for n = 1:dim
IEAD(n) = factor * IEADstar(I(n));
end