Commit 324405dc authored by Martin Reinecke's avatar Martin Reinecke
Browse files

adjust notebook

parent 613bae17
Pipeline #25099 passed with stages
in 6 minutes and 39 seconds
......@@ -178,18 +178,18 @@
%% Cell type:code id: tags:
``` python
s_power = ift.power_analyze(sh)
m_power = ift.power_analyze(m)
s_power_data = s_power.val
m_power_data = m_power.val
s_power_data = s_power.to_global_data()
m_power_data = m_power.to_global_data()
# Get signal data and reconstruction data
s_data = HT(sh).val
m_data = HT(m).val
s_data = HT(sh).to_global_data()
m_data = HT(m).to_global_data()
d_data = d.val
d_data = d.to_global_data()
```
%% Cell type:markdown id: tags:
### Signal Reconstruction
......@@ -269,15 +269,18 @@
``` python
l = int(N_pixels * 0.2)
h = int(N_pixels * 0.2 * 2)
mask = ift.Field(s_space, val=1)
mask.val[ l : h] = 0
mask = np.full(s_space.shape, 1.)
mask[l:h] = 0
mask = ift.Field.from_global_data(s_space, mask)
R = ift.DiagonalOperator(mask)*HT
n.val[l:h] = 0
n = n.to_global_data()
n[l:h] = 0
n = ift.Field.from_global_data(s_space, n)
d = R(sh) + n
```
%% Cell type:code id: tags:
......@@ -295,26 +298,26 @@
%% Cell type:code id: tags:
``` python
m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 200)
m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 200)
```
%% Cell type:markdown id: tags:
### Get data
%% Cell type:code id: tags:
``` python
# Get signal data and reconstruction data
s_data = s.val
m_data = HT(m).val
m_var_data = m_var.val
s_data = s.to_global_data()
m_data = HT(m).to_global_data()
m_var_data = m_var.to_global_data()
uncertainty = np.sqrt(m_var_data)
d_data = d.val
d_data = d.to_global_data()
# Set lost data to NaN for proper plotting
d_data[d_data == 0] = np.nan
```
......@@ -367,36 +370,39 @@
# Lose some data
l = int(N_pixels * 0.33)
h = int(N_pixels * 0.33 * 2)
mask = ift.Field(s_space, val=1)
mask.val[l:h,l:h] = 0
mask = np.full(s_space.shape, 1.)
mask[l:h,l:h] = 0.
mask = ift.Field.from_global_data(s_space, mask)
R = ift.DiagonalOperator(mask)*HT
n.val[l:h, l:h] = 0
n = n.to_global_data()
n[l:h, l:h] = 0
n = ift.Field.from_global_data(s_space, n)
curv = Curvature(R=R, N=N, Sh=Sh)
D = curv.inverse
d = R(sh) + n
j = R.adjoint_times(N.inverse_times(d))
# Run Wiener filter
m = D(j)
# Uncertainty
m_mean, m_var = ift.probe_with_posterior_samples(curv, m, HT, 20)
m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 20)
# Get data
s_power = ift.power_analyze(sh)
m_power = ift.power_analyze(m)
s_power_data = s_power.val
m_power_data = m_power.val
s_data = HT(sh).val
m_data = HT(m).val
m_var_data = m_var.val
d_data = d.val
s_power_data = s_power.to_global_data()
m_power_data = m_power.to_global_data()
s_data = HT(sh).to_global_data()
m_data = HT(m).to_global_data()
m_var_data = m_var.to_global_data()
d_data = d.to_global_data()
uncertainty = np.sqrt(np.abs(m_var_data))
```
%% Cell type:code id: tags:
......@@ -427,12 +433,12 @@
``` python
mi = np.min(s_data)
ma = np.max(s_data)
fig, axes = plt.subplots(3, 2, figsize=(15, 22.5))
samp1 = HT(curv.draw_sample()+m).val
samp2 = HT(curv.draw_sample()+m).val
samp1 = HT(curv.draw_sample()+m).to_global_data()
samp2 = HT(curv.draw_sample()+m).to_global_data()
data = [s_data, m_data, samp1, samp2, s_data - m_data, uncertainty]
caption = ["Signal", "Reconstruction", "Sample 1", "Sample 2", "Residuals", "Uncertainty Map"]
for ax in axes.flat:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment