Figure 9.18:

Effect of next measurement temperature on parameter confidence intervals.

Figure 9.18

Code for Figure 9.18

Text of the GNU GPL.

main.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
# Converted from nextT.m - optimal next temperature experiment (3 reps)
import numpy as np
from scipy.stats import chi2
from misc import save_ascii, ellipse

chisq  = 5.99
Tmin   = 300.0
Tmax   = 500.0
n0     = 1
T0     = np.concatenate([np.full(n0, Tmin), np.full(n0, Tmax)])
S      = np.eye(2)
Trep   = np.array([300.0, 500.0, 1000.0])
meanT  = 1.0 / (0.5*(1.0/Tmin + 1.0/Tmax))
table  = None

for Ti in Trep:
    Tmeas  = np.concatenate([T0, [Ti]])
    ndata  = len(Tmeas)
    Tcenter = -1.0/Tmeas + 1.0/meanT
    X      = np.column_stack([np.ones(ndata), Tcenter])
    measvar = 1e-3
    amat   = S @ X.T @ X @ S / measvar
    level  = chisq
    inva   = np.linalg.inv(amat)
    x, y   = ellipse(amat, level, 150)[:2]
    block  = np.column_stack([x, y])
    table  = block if table is None else np.column_stack([table, block])

save_ascii('nextT.dat', table)