aboutsummaryrefslogtreecommitdiffstats
path: root/plot_llh/angles_to_fr.py
blob: 7a842af857b1839fccbebeffbc7035c342dcd115 (plain)
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
#! /usr/bin/env python
from __future__ import absolute_import, division

import sys
sys.path.extend(['.', '../'])

import numpy as np

from utils import fr as fr_utils

SOURCE = [1, 2, 0]

if len(sys.argv)< 2:
    print sys.argv
    print "Usage: angles_to_fr.py input_filepath."
    exit(1)

infile = sys.argv[1]
outfile = infile[:-4] + '_proc.npy'

d = np.load(infile)

def m_fr(theta):
    s_12_2, c_13_4, s_23_2, dcp, m21_2, m3x_2 = theta
    sm_u = np.array(
        fr_utils.angles_to_u((s_12_2, c_13_4, s_23_2, dcp)), dtype=np.complex256
    )
    return fr_utils.u_to_fr(SOURCE, sm_u)

pd = np.array(map(m_fr, d))
np.save(outfile, pd)