Commit 9ca6ed7b authored by Giorgio Calderone's avatar Giorgio Calderone
Browse files

Updated

parent d5012143
Loading
Loading
Loading
Loading
+35 −47
Original line number Diff line number Diff line
@@ -220,8 +220,9 @@ function cont_at(bestfit, λ)
end


tabellone = DataFrame(epoch=Int[], date=String[], galaxy=Float64[],
                      contslope=Float64[], cont5100=Float64[], l5100=Float64[],
tab = DataFrame(epoch=Int[], date=String[], galaxy=Float64[],
                contslope=Float64[],
                c3500=Float64[], c5100=Float64[],
                bb_Ha_norm=Float64[], bb_Ha_fwhm=Float64[], bb_Ha_voff=Float64[],
                br_Ha_norm=Float64[], br_Ha_fwhm=Float64[], br_Ha_voff=Float64[],
                na_Ha_norm=Float64[], na_Ha_fwhm=Float64[], na_Ha_voff=Float64[],
@@ -230,17 +231,13 @@ tabellone = DataFrame(epoch=Int[], date=String[], galaxy=Float64[],
                na_Hb_norm=Float64[], na_Hb_fwhm=Float64[], na_Hb_voff=Float64[],
                oiii_fwhm=Float64[],  oiii_voff=Float64[])

l5100 = Vector{Float64}()
for id in 1:length(res.bestfit.preds)
    push!(l5100, 5100 .* Spline1D(domain(res.model[id])[:], res.model[id]())(5100.))
end

for id in 1:length(res.bestfit.preds)
    push!(tabellone,
    push!(tab,
          (id, epoch_filenames[id][27:end-4],
           res.bestfit[id][:galaxy].norm.val,
           res.bestfit[id][:qso_cont].alpha.val, cont_at(res.bestfit[id], 4000)[1],
           l5100[id],
           res.bestfit[id][:qso_cont].alpha.val,
           cont_at(res.bestfit[id], 3500)[1],
           cont_at(res.bestfit[id], 5100)[1],
           res.bestfit[id][:bb_Ha].norm.patched, res.bestfit[id][:bb_Ha].fwhm.patched, res.bestfit[id][:bb_Ha].voff.patched,
           res.bestfit[id][:br_Ha].norm.patched, res.bestfit[id][:br_Ha].fwhm.patched, res.bestfit[id][:br_Ha].voff.patched,
           res.bestfit[id][:na_Ha].norm.patched, res.bestfit[id][:na_Ha].fwhm.patched, res.bestfit[id][:na_Ha].voff.patched,
@@ -250,51 +247,42 @@ for id in 1:length(res.bestfit.preds)
           res.bestfit[id][:OIII_5007].fwhm.patched, res.bestfit[id][:OIII_5007].voff.patched))
end

dd = Date.(tabellone.date, Ref("yyyymmdd"))
tabellone[!, :day] .= getproperty.(dd - dd[1], :value)
tab[!, :l3500] .= [3500 .* Spline1D(domain(res.model[id])[:], res.model[id]())(3500.) for id in 1:length(chosen_epochs)]
tab[!, :l5100] .= [5100 .* Spline1D(domain(res.model[id])[:], res.model[id]())(5100.) for id in 1:length(chosen_epochs)]
tab[!, :Ha] .= tab.br_Ha_norm .+ tab.bb_Ha_norm .+ tab.na_Ha_norm
tab[!, :Hb] .= tab.br_Hb_norm .+ tab.bb_Hb_norm .+ tab.na_Hb_norm

dd = Date.(tab.date, Ref("yyyymmdd"))
tab[!, :day] .= getproperty.(dd - dd[1], :value)

f = FITS("1ES_1927p654_results_$(job).fits", "w")
write(f, tabellone)
write(f, tab)
close(f)

@gp( [res.bestfit[id][:qso_cont].alpha.val for id in 1:length(chosen_epochs)],
     [res.bestfit[id][:br_Ha].norm.patched for id in 1:length(chosen_epochs)],
     "w l")

@gp(:-,
    [res.bestfit[id][:qso_cont].alpha.val for id in 1:length(chosen_epochs)],
    [res.bestfit[id][:br_Hb].norm.patched for id in 1:length(chosen_epochs)],
    "w l")


@gp( [res.bestfit[id][:qso_cont].alpha.val for id in 1:length(chosen_epochs)],
     [cont_at(res.bestfit[id], 5100)[1] for id in 1:length(chosen_epochs)],
     "w l")

@gp( [cont_at(res.bestfit[id], 5100)[1] for id in 1:length(chosen_epochs)],
     [res.bestfit[id][:br_Ha].norm.patched for id in 1:length(chosen_epochs)],
     "w l")
@gp    tab.contslope tab.Ha "w l t 'Ha'"  ylog=true
@gp :- tab.contslope tab.Hb "w l t 'Hb'"
@gp :- tab.contslope tab.c5100 "w l t 'c5100'"
@gp :- tab.contslope tab.l5100 "w l t 'l5100'"
@gp :- tab.contslope tab.c3500 "w lp t 'c3500'"
@gp :- tab.contslope tab.l3500 "w lp t 'l3500'"


@gp( l5100,
     [res.bestfit[id][:br_Ha].norm.patched for id in 1:length(chosen_epochs)],
     "w l")
@gp    tab.c5100 tab.Ha "w l t 'c5100'"
@gp :- tab.l5100 tab.Ha "w l t 'l5100'"


@gp    tabellone.day [cont_at(res.bestfit[id], 5100)[1] for id in 1:length(chosen_epochs)] "w lp" ylog=true
@gp :- tabellone.day [res.bestfit[id][:br_Ha].norm.patched for id in 1:length(chosen_epochs)] .* 1e2 "w lp"
@gp :- tabellone.day [res.bestfit[id][:br_Hb].norm.patched for id in 1:length(chosen_epochs)] .* 1e2 "w lp"
@gp :- tabellone.day l5100 "w lp"
@gp    tab.day tab.c5100 "w lp t 'c5100'" ylog=true
@gp :- tab.day tab.l5100 "w lp t 'l5100'"
@gp :- tab.day tab.Ha    "w lp t 'Ha'"
@gp :- tab.day tab.Hb    "w lp t 'Hb'"

@gp    tabellone.day -3 .+ 1e-3 .*[cont_at(res.bestfit[id], 5100)[1] for id in 1:length(chosen_epochs)] "w lp"
@gp :- tabellone.day [res.bestfit[id][:qso_cont].alpha.val for id in 1:length(chosen_epochs)] "w lp"
@gp :- tab.day tab.contslope "w lp"


@gp "set grid"
for id in 1:length(chosen_epochs)
    #@gp :- domain(res.model[id])[:] res.model[id]() "w l t '$id' lw 3"
    @gp :- domain(res.model[id])[:] res.model[id](:qso_cont) "w l t '$id' lw 3"
    #@gp :- models[(id, :x)] models[(id, :qso_cont)] "w l t '$id' lw 2"
end
save(:prenorm, term="png size 800,600", output="output/evolution.png")