-
Notifications
You must be signed in to change notification settings - Fork 0
/
information_matrix.py
executable file
·47 lines (35 loc) · 1.32 KB
/
information_matrix.py
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
"""Compute information matrices."""
import numpy as np
from numba import jit
import response_surface as rs
@jit(nopython=True)
def Mdiscrete(t, phi, theta, omega):
"""
Compute information matrix for a discrete experiment with control points
(t, phi) conditioned on the parameter vector, theta, and the offsets, omega.
M = SUM F(t,phi; theta,omega) . F(t,phi; theta,omega)'
expts
where F is the Jacobian matrix.
Args: (where M = number of time points, N = number of peaks)
t: (M x 1) array of evolution times
phi: (M x 1) array of phases (in radians)
theta: flattened (3 x N) array (with array.ravel).
theta[0,:] = amplitudes
theta[1,:] = lambda (auto-relaxation rate)
theta[2,:] = S2tc (in ns)
omega: (1 x N) array of resonance offsets, in angular units (s-1).
Returns:
y: (M x N) array of intensities
"""
#if phi is None:
# phi = np.zeros_like(t)
# M = np.zeros( (theta.size,theta.size) );
M = np.zeros( (len(theta), len(theta)) );
for i in range(len(t)):
F = rs.jac(t[i], phi[i], theta, omega)
M = M + np.dot(F,F.T)
# M = M + F.dot(F.T)
# for tau, phase in np.nditer([t, phi]):
# F = rs.jac(tau,phase,theta,omega)
# M = M + F.dot(F.T)
return M