Skip to content

Commit

Permalink
Tweaks to polychromatic example
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienbaron committed Aug 28, 2024
1 parent 45631dc commit 37d3588
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
26 changes: 16 additions & 10 deletions demos/example_image_reconstruction_polychromatic_MWC480.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,33 @@ pixsize = 0.2 # mas/pixel
ft = setup_nfft_polychromatic(data, nx, pixsize);
nwavs = length(ft)

# Setup regularization
regularizers = [ [ ["centering", 1e4], ["tv", 1e2] ]] # Frame 1 is centered
for i=1:nwavs-1
push!(regularizers,[["tv",1e2]]) # Total variation for all
end
# # Setup regularization
# regularizers = [ [ ["centering", 1e4], ["tv", 1e2] ]] # Frame 1 is centered
# for i=1:nwavs-1
# push!(regularizers,[["tv",1e2]]) # Total variation for all
# end

regularizers = [[ ["centering", 1e7]]] # Frame 1 is centered

regularizers = [ [ ["centering", 1e4], ["l1l2", 1e5, 0.4] ]] # Frame 1 is centered
for i=1:nwavs-1
push!(regularizers,[["l1l2",1e5,0.4]]) # Total variation for all
push!(regularizers,[]) # Total variation for all
end


# for i=1:nwavs-1
# push!(regularizers,[["l1l2",1e5,0.4]]) # Total variation for all
# end

# Uncomment the desired transspectral regularization
# push!(regularizers,[ ["transspectral_tvsq", 1e5] ] );
push!(regularizers,[["transspectral_structnorm", 1e2], ["transspectral_tv", 1e2] ] );
push!(regularizers,[ ["transspectral_structnorm", 1e2], ["transspectral_tvsq", 1e5] ] );
#push!(regularizers,[["transspectral_structnorm", 1e7], ["transspectral_tv", 1e4] ] );

pointsource = zeros(nx,nx);
pointsource[div(nx+1,2), div(nx+1,2)] = 1.0;
x_start = repeat(pointsource, 1,1,nwavs);

x = copy(x_start);
for i=1:10
for i=1:3
x = reconstruct_polychromatic(x, data, ft, regularizers = regularizers, maxiter = 200, verb=false);
end
imdisp_polychromatic(x.^.2, pixsize=pixsize)
Expand Down
6 changes: 5 additions & 1 deletion src/oichi2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -692,14 +692,18 @@ function chi2_polychromatic_f(x::Array{Float64,3}, ft::Array{Array{NFFTPlan{Floa
end
f = zeros(nwavs)
for i=1:nwavs # weighted sum -- should probably do the computation in parallel
if verb == true
printstyled("Spectral channel $i\n",color=printcolor[i]);
end

if use_diffphases == true
f[i] = chi2_f(x[:,:,i], ft[i], data[i], cvis=cvis[i], verb = verb, weights = weights);
else
f[i] = chi2_f(x[:,:,i], ft[i], data[i], verb = verb, weights = weights);
end
fr = f[i]/(data[i].nv2+data[i].nt3amp+data[i].nt3phi)
if verb == true
printstyled("Spectral channel $i chi2= $(f[i]) chi2r = $(fr)\n",color=printcolor[i]);
printstyled("\n Chi2r = $(fr) \t Chi2 = $(f[i])\n",color=printcolor[i]);
end
end
chi2f = sum(f)
Expand Down

0 comments on commit 37d3588

Please sign in to comment.