Skip to content

Commit 11daccc

Browse files
committed
Update examples
1 parent 82ad969 commit 11daccc

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

examples/hybrid_imaging.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ obs = ehtim.obsdata.load_uvfits(joinpath(dirname(pathof(Comrade)), "..", "exampl
4444
# Now we do some minor preprocessing:
4545
# - Scan average the data since the data have been preprocessed so that the gain phases
4646
# coherent.
47-
obs = scan_average(obs).add_fractional_noise(0.01)
47+
obs = scan_average(obs).add_fractional_noise(0.02)
4848

4949
# For this tutorial we will once again fit complex visibilities since they
5050
# provide the most information once the telescope/instrument model are taken
@@ -109,7 +109,7 @@ end
109109

110110
# Now let's define our metadata. First we will define the cache for the image. This is
111111
# required to compute the numerical Fourier transform.
112-
fovxy = μas2rad(150.0)
112+
fovxy = μas2rad(250.0)
113113
npix = 32
114114
grid = imagepixels(fovxy, fovxy, npix, npix)
115115
buffer = IntensityMap(zeros(npix,npix), grid)
@@ -221,7 +221,7 @@ post = Posterior(lklhd, prior)
221221
xrand = prior_sample(rng, post)
222222
# and then plot the results
223223
import WGLMakie as CM
224-
g = imagepixels(μas2rad(150.0), μas2rad(150.0), 128, 128)
224+
g = imagepixels(μas2rad(250.0), μas2rad(250.0), 128, 128)
225225
imageviz(intensitymap(skymodel(post, xrand), g))
226226

227227
# ## Reconstructing the Image

examples/imaging_closures.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ end
123123
# Gaussian Markov random fields are extremly flexible models.
124124
# To prevent overfitting it is common to use priors that penalize complexity. Therefore, we
125125
# want to use priors that enforce similarity to our mean image, and prefer smoothness.
126-
cprior = HierarchicalPrior(fmap, Uniform(0.0, 1_000.0))
126+
cprior = HierarchicalPrior(fmap, InverseGamma(1.0, -log(0.01*rat)))
127127

128-
prior = NamedDist(c = cprior, σimg = Uniform(0.0, 5.0), fg=Uniform(0.0, 1.0))
128+
prior = NamedDist(c = cprior, σimg = truncated(Normal(0.0, 0.1); lower = 0.0), fg=Uniform(0.0, 1.0))
129129

130130
lklhd = RadioLikelihood(sky, dlcamp, dcphase;
131131
skymeta = metadata)

examples/imaging_pol.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Page(exportable=true, offline=true) # hide
102102

103103
# For reproducibility we use a stable random number genreator
104104
using StableRNGs
105-
rng = StableRNG(123)
105+
rng = StableRNG(125)
106106

107107

108108
# Now we will load some synthetic polarized data.
@@ -303,7 +303,7 @@ using OptimizationOptimJL
303303
using Zygote
304304
f = OptimizationFunction(tpost, Optimization.AutoZygote())
305305
= logdensityof(tpost)
306-
prob = Optimization.OptimizationProblem(f, prior_sample(tpost), nothing)
306+
prob = Optimization.OptimizationProblem(f, prior_sample(rng, tpost), nothing)
307307
sol = solve(prob, LBFGS(), maxiters=15_000, g_tol=1e-1);
308308

309309
# !!! warning
@@ -329,17 +329,18 @@ img = intensitymap!(copy(imgtruesub), skymodel(post, xopt))
329329

330330
#Plotting the results gives
331331
import WGLMakie as CM
332-
fig = CM.Figure(;resolution=(450, 200));
332+
fig = CM.Figure(;resolution=(450, 350));
333333
polimage(fig[1,1], imgtruesub,
334334
axis=(xreversed=true, aspect=1, title="Truth", limits=((-20.0,20.0), (-20.0, 20.0))),
335-
length_norm=1, plot_total=true,
336-
pcolorrange=(-0.25, 0.25), pcolormap=CM.Reverse(:jet))
335+
length_norm=1, plot_total=true, pcolormap=:RdBu,
336+
pcolorrange=(-0.25, 0.25),)
337337
polimage(fig[1,2], img,
338338
axis=(xreversed=true, aspect=1, title="Recon.", limits=((-20.0,20.0), (-20.0, 20.0))),
339-
length_norm=1, plot_total=true,
340-
pcolorrange=(-0.25, 0.25), pcolormap=CM.Reverse(:jet))
341-
CM.Colorbar(fig[1,3], colormap=CM.Reverse(:jet), colorrange=(-0.25, 0.25), label="Signed Polarization Fraction sign(V)*|p|")
342-
CM.colgap!(fig.layout, 1)
339+
length_norm=1, plot_total=true, pcolormap=:RdBu,
340+
pcolorrange=(-0.25, 0.25),)
341+
CM.Colorbar(fig[2,:], colormap=:RdBu, vertical=false, colorrange=(-0.25, 0.25), label="Signed Polarization Fraction sign(V)*|p|", flipaxis=false)
342+
CM.colgap!(fig.layout, 3)
343+
CM.rowgap!(fig.layout, 3)
343344
fig
344345
#-
345346

examples/imaging_vis.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using LinearAlgebra
2424

2525
# For reproducibility we use a stable random number genreator
2626
using StableRNGs
27-
rng = StableRNG(42)
27+
rng = StableRNG(123)
2828

2929

3030

@@ -39,7 +39,7 @@ obs = ehtim.obsdata.load_uvfits(joinpath(dirname(pathof(Comrade)), "..", "exampl
3939
# - Scan average the data since the data have been preprocessed so that the gain phases
4040
# coherent.
4141
# - Add 1% systematic noise to deal with calibration issues that cause 1% non-closing errors.
42-
obs = scan_average(obs.add_fractional_noise(0.01))
42+
obs = scan_average(obs.add_fractional_noise(0.02))
4343

4444
# Now we extract our complex visibilities.
4545
dvis = extract_table(obs, ComplexVisibilities())
@@ -206,7 +206,7 @@ end
206206
# and to prevent overfitting it is common to use priors that penalize complexity. Therefore, we
207207
# want to use priors that enforce similarity to our mean image. If the data wants more complexity
208208
# then it will drive us away from the prior.
209-
cprior = HierarchicalPrior(fmap, Uniform(0.0, 1000.0))#InverseGamma(1.0, -log(0.01*rat)))
209+
cprior = HierarchicalPrior(fmap, InverseGamma(1.0, -log(0.01*rat)))
210210

211211

212212
# We can now form our model parameter priors. Like our other imaging examples, we use a
@@ -357,7 +357,7 @@ imgs = intensitymap.(samples, fovx, fovy, 128, 128)
357357

358358
mimg = mean(imgs)
359359
simg = std(imgs)
360-
fig = CM.Figure(;resolution=(800, 800))
360+
fig = CM.Figure(;resolution=(400, 400))
361361
CM.image(fig[1,1], mimg,
362362
axis=(xreversed=true, aspect=1, title="Mean Image"),
363363
colormap=:afmhot)

0 commit comments

Comments
 (0)