"""Calculate the axes of the ellipsoidal merger remnant"""

import numpy as np

from analysis import utils

# Calculate ellipsoidal axes of remnant
# Simply calculate the integrals r_i, r_j and obtain the principal axes
data = utils.loadData('hyperbolic_halo', 30000)
r_vec = data['r_vec'][data['types'][:,1]!='dark'] #Luminous components only
I = np.sum(r_vec[:,np.newaxis,:] * r_vec[:,:,np.newaxis], axis=0)
eig, _ = np.linalg.eigh(I)
print(np.sqrt(eig/eig[1]))
# we obtain 10:11:13