Commit e784d4e7 authored by Giorgio Calderone's avatar Giorgio Calderone
Browse files

Added links amongs emission lines

parent bbed41f9
Loading
Loading
Loading
Loading
+70 −10
Original line number Diff line number Diff line
@@ -172,13 +172,12 @@ function fit(source::QSO{TRecipe}; id=1) where TRecipe <: q1927p654
    # Patch parameters
    if  haskey(model, :OIII_4959)  &&
        haskey(model, :OIII_5007)
        model[:OIII_4959].norm.fixed = true
        model[:OIII_4959].voff.fixed = true
        @patch! model m -> m[:OIII_4959].voff = m[:OIII_5007].voff
        @patch! model m -> begin
            m[:OIII_4959].norm = m[:OIII_5007].norm / 3
            m[:OIII_4959].voff = m[:OIII_5007].voff
    end
    if  haskey(model, :NII_6549)  &&
        haskey(model, :NII_6583)
        model[:NII_6549].voff.fixed = true
        @patch! model m -> m[:NII_6549].voff = m[:NII_6583].voff
    end
    if  haskey(model, :OIII_5007_bw)  &&
        haskey(model, :OIII_5007)
@@ -187,20 +186,80 @@ function fit(source::QSO{TRecipe}; id=1) where TRecipe <: q1927p654
            m[:OIII_5007_bw].fwhm += m[:OIII_5007].fwhm
        end
    end
    if  haskey(model, :OI_6300)  &&
        haskey(model, :OI_6364)
        # model[:OI_6300].norm.fixed = true
        model[:OI_6300].voff.fixed = true
        @patch! model m -> begin
            # m[:OI_6300].norm = m[:OI_6364].norm / 3
            m[:OI_6300].voff = m[:OI_6364].voff
        end
    end
    if  haskey(model, :NII_6549)  &&
        haskey(model, :NII_6583)
        # model[:NII_6549].norm.fixed = true
        model[:NII_6549].voff.fixed = true
        @patch! model m -> begin
            # m[:NII_6549].norm = m[:NII_6583].norm / 3
            m[:NII_6549].voff = m[:NII_6583].voff
        end
    end
    if  haskey(model, :SII_6716)  &&
        haskey(model, :SII_6731)
        # model[:SII_6716].norm.fixed = true
        model[:SII_6716].voff.fixed = true
        @patch! model m -> begin
            # m[:SII_6716].norm = m[:SII_6731].norm / 1.5
            m[:SII_6716].voff = m[:SII_6731].voff
        end
    end

    if  haskey(model, :na_Ha)  &&
        haskey(model, :na_Hb)
        model[:na_Hb].voff.fixed = true
        @patch! model m -> m[:na_Hb].voff = m[:na_Ha].voff
    end

    # The following are required to avoid degeneracy with iron
    # template
    if  haskey(model, :Hg)  &&
        haskey(model, :br_Hb)
        model[:Hg].voff.fixed = true
        model[:Hg].fwhm.fixed = true
        @patch! model m -> begin
            m[:Hg].voff = m[:br_Hb].voff
            m[:Hg].fwhm = m[:br_Hb].fwhm
        end
    end
    if  haskey(model, :br_Hg)  &&
        haskey(model, :br_Hb)
        model[:br_Hg].voff.fixed = true
        model[:br_Hg].fwhm.fixed = true
        @patch! model m -> begin
            m[:br_Hg].voff = m[:br_Hb].voff
            m[:br_Hg].fwhm = m[:br_Hb].fwhm
        end
    end
    if  haskey(model, :na_Hg)  &&
        haskey(model, :na_Hb)
        model[:na_Hg].voff.fixed = true
        model[:na_Hg].fwhm.fixed = true
        @patch! model m -> begin
            m[:na_Hg].voff = m[:na_Hb].voff
            m[:na_Hg].fwhm = m[:na_Hb].fwhm
        end
    end

    if  haskey(model, :br_Hb)  &&
        haskey(model, :bb_Hb)
    # Ensure luminosity at peak of the broad base component is
    # smaller than the associated broad component:
    if  haskey(model, :br_Hb)  &&
        haskey(model, :bb_Hb)
        model[:bb_Hb].norm.high = 1
        model[:bb_Hb].norm.val  = 0.5
        @patch! model m -> m[:bb_Hb].norm *= m[:br_Hb].norm / m[:br_Hb].fwhm * m[:bb_Hb].fwhm
    end

    if  haskey(model, :br_Ha)  &&
        haskey(model, :bb_Ha)
        # Ensure luminosity at peak of the broad base component is
        # smaller than the associated broad component:
        model[:bb_Ha].norm.high = 1
        model[:bb_Ha].norm.val  = 0.5
        @patch! model m -> m[:bb_Ha].norm *= m[:br_Ha].norm / m[:br_Ha].fwhm * m[:bb_Ha].fwhm
@@ -311,6 +370,7 @@ function fit(source::QSO{TRecipe}; id=1) where TRecipe <: q1927p654
    end
    evaluate!(model)

    # ----------------------------------------------------------------
    # Last run with all parameters free
    println(source.log, "\nLast run with all parameters free...")
    thaw(model, :qso_cont)