verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
verbose 1
lines 3 0
set dimen(elet) = 1.s
set elet = 'Fe'
define elet (elet)
echo Fe
define deltalam (.00212639278727566556*3)
define eqw_rej (0.05)
data "Sun/Fe-Sun.eqw"
read ! { l 3 e 4 gf 5 w 6 a 9 el 1.s  ion 2 }
print <l  e  gf  w  a el   ion >
if (0) {
data "dummy/Fe-dummy.eqw"
read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
define diff_star_offset (6.93)
define diffeqw (1)
} else {
define diff_star_offset (0)
define diffeqw (0)
}
if ( 1 ) {
data "Sun/Fe-Sun.eqw"
read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
define select_clean_eqw ( 1 )
 }
data "syntspec/Sun_spectre1.convol"
read xm1 1
read ym1 2
set ym1 = ym1 if (xm1 >= 5150 && xm1 <= 5200)
set xm1 = xm1 if (xm1 >= 5150 && xm1 <= 5200)
!rm -f syntspec/Sun_spectre1.convol
data "syntspec/Sun_spectre2.convol"
read xm2 1
read ym2 2
set ym2 = ym2 if (xm2 >= 6530 && xm2 <= 6600)
set xm2 = xm2 if (xm2 >= 6530 && xm2 <= 6600)
!rm -f syntspec/Sun_spectre2.convol
data "/tmp/Sun_obs"
read xo 1
read yo 2
set xo = xo/((0*1000/299792458)+1)
#set xo = vac2air(xo)
set yo1 = yo if (xo >= 5150 && xo <= 5200)
set xo1 = xo if (xo >= 5150 && xo <= 5200)
set yo2 = yo if (xo >= 6530 && xo <= 6600)
set xo2 = xo if (xo >= 6530 && xo <= 6600)
define model_plot ('"5777g4.44z0.00_Sun.intm0t1.100"')
data "Sun/Fe-Sun.abu"
lines 3 0
read {labu 1 eqwobsabu 2 abusyn 3 flagsyn 4 abueqw 5 flageqw 6 abuint 7 flagint 8 abuchi2 9 flagchi2 10}
define norm_Ha (1.0)
define norm_Mg (1.0)
if (1) {
define convol (-4.0)
define computeconvol (1)
} else {
define convol (0)
define computeconvol (0)
}
if (0 == 0) {
device postlandfile Sun-5777g4.44z0.00_Sun.int_m0_t1.100_Feeqw.ps
}
input_new "eqwidt.sm" 
define a (-42)
define b ($a_abxvswl - $a * 1.100 )
define TURBVELguess  (-$b/$a)
define b (($a_abxvswl + $siga_wlxFe1) - $a * 1.100 )
define TURBVEL_error (sqrt(((-$b/$a) - $TURBVELguess )**2))
if (1) {
define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0\
              && sqrt(($TURBVELguess - 1.100 )**2) < $TURBVEL_error  )
} else {
define converged_xit (1)
}
sort <wlFe1 aFe1>
define nweakest (int(dimen(aFe1)*1))
if ($nweakest < 10)  {
sort <wlFe2 aFe2>
define nweakest (int(dimen(aFe2)*1))
if ($nweakest < 10)  {
if (dimen(aFe1) > 1) {
set a_metestim  = aFe1
} else {
set a_metestim  = aFe2
}
} else {
echo $nweakest
set a_metestim  = aFe2[do(0,$nweakest-1)]
}
} else {
echo $nweakest
set a_metestim  = aFe1[do(0,$nweakest-1)]
}
stats a_metestim mean rms kurt
echo "mean metallicity:" $mean
stats_med a_metestim mean dum
echo "median metallicity:" $mean
define METALLICguess ($mean - 7.45)
if (1) {
if (($METALLICguess + $rms ) > 0 && ($METALLICguess - $rms ) < 0) {
define newmet (1)
} else {
define newmet (0)
}
} else {
define newmet (1)
}
if (1 == 0) {
define converged_convol (1)
}
if ($computeconvol) {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100 $converged_convol $newconvol $sigmadiffconvol -4.\
0
} else {
write + "Sun/Feguess_Sun.tab" $newmet $METALLICguess $rms 0 $converged_xit $TURBVELguess $TURBVEL_error  1.100  "0" "0"  "0" "0"
}
QUIT
data "models.sm"
verbose 1
lines 1 1
read {Teff1 2 logg1 4 met1 6}
lines 3 0
read  {tau1 3 T1 4 Pe1 5 Pg1 6 taur1 2}
define ndp (dimen(tau1)-1)
define end ($ndp+3)
do i=2,9 {
define beg ($end+1)
define end ($beg)
lines $beg $end
read Teff$i 2
read logg$i 4
read met$i 6
define beg ($end+2)
define end ($beg + $ndp)
lines $beg $end
read  tau$i 3
read T$i 4
read Pe$i 5
read Pg$i 6
read taur$i 2
}
if (0) {
define beg ($end+3)
lines $beg 0
read  {tau10 3 T10 4 Pe10 5 Pg10 6 taur10 2}
}
device postportfile interpol_check.ps
ctype green
toplabel T_{eff}=5627 logg=4.44 z=0
ctype black
location 3000 15000 17000 32000
ylabel log(Pe)
limits tau9 Pe9
box 0 2 0 0
lweight 4
ltype 0
ctype blue
relocate (4000 31000)
draw (4600 31000)
define Teff1 (Teff1)
define Teff2 (Teff2)
putlabel 6 T_{eff}=$Teff1 $Teff2
ctype red
relocate (4000 30500)
draw (4600 30500)
define Teff5 (Teff5)
define Teff6 (Teff6)
putlabel 6 T_{eff}=$Teff5 $Teff6
ctype black
lweight 1
relocate (4000 30000)
draw (4600 30000)
define logg1 (logg1)
define logg5 (logg5)
putlabel 6 logg=$logg1 $logg5
lweight 4
relocate (4000 29500)
draw (4600 29500)
define logg3 (logg3)
define logg7 (logg7)
putlabel 6 logg=$logg3 $logg7
ltype 0
relocate (4000 29000)
draw (4600 29000)
define met3 (met3)
define met1 (met1)
putlabel 6 [Fe/H]=$met1 $met3
ltype 1
define met2 (met2)
define met4 (met4)
relocate (4000 28500)
draw (4600 28500)
putlabel 6 [Fe/H]=$met2 $met4
ctype blue
lweight 1
ltype 0
connect tau1 Pe1
ltype 1
connect tau2 Pe2
lweight 2
ltype 0
connect tau3 Pe3
ltype 1
connect tau4 Pe4
ctype red
lweight 1
ltype 0
connect tau5 Pe5
ltype 1
connect tau6 Pe6
lweight 2
ltype 0
connect tau7 Pe7
ltype 1
connect tau8 Pe8
ltype 0
lweight 1
ctype green
connect tau9 Pe9
ctype black
if (0) {
connect tau10 Pe10
}
location 3000 15000 3000 17000
xlabel log (\tau_{5000})
ylabel T
limits tau9 T9
box
ctype blue
connect tau1 T1
ltype 1
connect tau2 T2
lweight 2
ltype 0
connect tau3 T3
ltype 1
connect tau4 T4
ctype red
lweight 1
ltype 0
connect tau5 T5
ltype 1
connect tau6 T6
ltype 0
lweight 2
connect tau7 T7
ltype 1
connect tau8 T8
ltype 0
ctype green
connect tau9 T9
ctype black
if (0) {
connect tau10 T10
}
lweight 1
location 19000 32000 17000 32000
xlabel log (\tau_{5000})
ylabel log(Pg)
limits tau9 Pg9
box
ctype blue
connect tau1 Pg1
ltype 1
connect tau2 Pg2
ltype 0
lweight 2
connect tau3 Pg3
ltype 1
connect tau4 Pg4
ctype red
ltype 0
lweight 1
connect tau5 Pg5
ltype 1
connect tau6 Pg6
ltype 0
lweight 2
connect tau7 Pg7
ltype 1
connect tau8 Pg8
ltype 0
ctype green
connect tau9 Pg9
ctype black
if (0) {
connect tau10 Pg10
}
lweight 1
if (0) {
location 19300 32000 3000 11000
ylabel actual error (%)
location 20000 32000 3000 6000
spline tau9  T9 tau10 Tbis
limits tau10 (abs(Tbis-T10)/T10 * 100)
connect  tau10 (abs(Tbis-T10)/T10 * 100)
box
ylabel T
xlabel log (\tau_{5000})
location 20000 32000 6000 9000
spline tau9 Pe9 tau10 Pebis
limits tau10 (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
box 0 2 0 0
connect  tau10  (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
ylabel Pe
location 20000 32000 9000 12000
spline tau9 Pg9 tau10 Pgbis
limits tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
connect  tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
box 0 2 0 0
ylabel Pg
}
QUIT
data "models.sm"
verbose 1
lines 1 1
read {Teff1 2 logg1 4 met1 6}
lines 3 0
read  {tau1 3 T1 4 Pe1 5 Pg1 6 taur1 2}
define ndp (dimen(tau1)-1)
define end ($ndp+3)
do i=2,9 {
define beg ($end+1)
define end ($beg)
lines $beg $end
read Teff$i 2
read logg$i 4
read met$i 6
define beg ($end+2)
define end ($beg + $ndp)
lines $beg $end
read  tau$i 3
read T$i 4
read Pe$i 5
read Pg$i 6
read taur$i 2
}
if (0) {
define beg ($end+3)
lines $beg 0
read  {tau10 3 T10 4 Pe10 5 Pg10 6 taur10 2}
}
device postportfile interpol_check.ps
ctype green
toplabel T_{eff}=5777 logg=4.44 z=0
ctype black
location 3000 15000 17000 32000
ylabel log(Pe)
limits tau9 Pe9
box 0 2 0 0
lweight 4
ltype 0
ctype blue
relocate (4000 31000)
draw (4600 31000)
define Teff1 (Teff1)
define Teff2 (Teff2)
putlabel 6 T_{eff}=$Teff1 $Teff2
ctype red
relocate (4000 30500)
draw (4600 30500)
define Teff5 (Teff5)
define Teff6 (Teff6)
putlabel 6 T_{eff}=$Teff5 $Teff6
ctype black
lweight 1
relocate (4000 30000)
draw (4600 30000)
define logg1 (logg1)
define logg5 (logg5)
putlabel 6 logg=$logg1 $logg5
lweight 4
relocate (4000 29500)
draw (4600 29500)
define logg3 (logg3)
define logg7 (logg7)
putlabel 6 logg=$logg3 $logg7
ltype 0
relocate (4000 29000)
draw (4600 29000)
define met3 (met3)
define met1 (met1)
putlabel 6 [Fe/H]=$met1 $met3
ltype 1
define met2 (met2)
define met4 (met4)
relocate (4000 28500)
draw (4600 28500)
putlabel 6 [Fe/H]=$met2 $met4
ctype blue
lweight 1
ltype 0
connect tau1 Pe1
ltype 1
connect tau2 Pe2
lweight 2
ltype 0
connect tau3 Pe3
ltype 1
connect tau4 Pe4
ctype red
lweight 1
ltype 0
connect tau5 Pe5
ltype 1
connect tau6 Pe6
lweight 2
ltype 0
connect tau7 Pe7
ltype 1
connect tau8 Pe8
ltype 0
lweight 1
ctype green
connect tau9 Pe9
ctype black
if (0) {
connect tau10 Pe10
}
location 3000 15000 3000 17000
xlabel log (\tau_{5000})
ylabel T
limits tau9 T9
box
ctype blue
connect tau1 T1
ltype 1
connect tau2 T2
lweight 2
ltype 0
connect tau3 T3
ltype 1
connect tau4 T4
ctype red
lweight 1
ltype 0
connect tau5 T5
ltype 1
connect tau6 T6
ltype 0
lweight 2
connect tau7 T7
ltype 1
connect tau8 T8
ltype 0
ctype green
connect tau9 T9
ctype black
if (0) {
connect tau10 T10
}
lweight 1
location 19000 32000 17000 32000
xlabel log (\tau_{5000})
ylabel log(Pg)
limits tau9 Pg9
box
ctype blue
connect tau1 Pg1
ltype 1
connect tau2 Pg2
ltype 0
lweight 2
connect tau3 Pg3
ltype 1
connect tau4 Pg4
ctype red
ltype 0
lweight 1
connect tau5 Pg5
ltype 1
connect tau6 Pg6
ltype 0
lweight 2
connect tau7 Pg7
ltype 1
connect tau8 Pg8
ltype 0
ctype green
connect tau9 Pg9
ctype black
if (0) {
connect tau10 Pg10
}
lweight 1
if (0) {
location 19300 32000 3000 11000
ylabel actual error (%)
location 20000 32000 3000 6000
spline tau9  T9 tau10 Tbis
limits tau10 (abs(Tbis-T10)/T10 * 100)
connect  tau10 (abs(Tbis-T10)/T10 * 100)
box
ylabel T
xlabel log (\tau_{5000})
location 20000 32000 6000 9000
spline tau9 Pe9 tau10 Pebis
limits tau10 (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
box 0 2 0 0
connect  tau10  (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
ylabel Pe
location 20000 32000 9000 12000
spline tau9 Pg9 tau10 Pgbis
limits tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
connect  tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
box 0 2 0 0
ylabel Pg
}
QUIT
data "models.sm"
verbose 1
lines 1 1
read {Teff1 2 logg1 4 met1 6}
lines 3 0
read  {tau1 3 T1 4 Pe1 5 Pg1 6 taur1 2}
define ndp (dimen(tau1)-1)
define end ($ndp+3)
do i=2,9 {
define beg ($end+1)
define end ($beg)
lines $beg $end
read Teff$i 2
read logg$i 4
read met$i 6
define beg ($end+2)
define end ($beg + $ndp)
lines $beg $end
read  tau$i 3
read T$i 4
read Pe$i 5
read Pg$i 6
read taur$i 2
}
if (0) {
define beg ($end+3)
lines $beg 0
read  {tau10 3 T10 4 Pe10 5 Pg10 6 taur10 2}
}
device postportfile interpol_check.ps
ctype green
toplabel T_{eff}=5927 logg=4.44 z=0
ctype black
location 3000 15000 17000 32000
ylabel log(Pe)
limits tau9 Pe9
box 0 2 0 0
lweight 4
ltype 0
ctype blue
relocate (4000 31000)
draw (4600 31000)
define Teff1 (Teff1)
define Teff2 (Teff2)
putlabel 6 T_{eff}=$Teff1 $Teff2
ctype red
relocate (4000 30500)
draw (4600 30500)
define Teff5 (Teff5)
define Teff6 (Teff6)
putlabel 6 T_{eff}=$Teff5 $Teff6
ctype black
lweight 1
relocate (4000 30000)
draw (4600 30000)
define logg1 (logg1)
define logg5 (logg5)
putlabel 6 logg=$logg1 $logg5
lweight 4
relocate (4000 29500)
draw (4600 29500)
define logg3 (logg3)
define logg7 (logg7)
putlabel 6 logg=$logg3 $logg7
ltype 0
relocate (4000 29000)
draw (4600 29000)
define met3 (met3)
define met1 (met1)
putlabel 6 [Fe/H]=$met1 $met3
ltype 1
define met2 (met2)
define met4 (met4)
relocate (4000 28500)
draw (4600 28500)
putlabel 6 [Fe/H]=$met2 $met4
ctype blue
lweight 1
ltype 0
connect tau1 Pe1
ltype 1
connect tau2 Pe2
lweight 2
ltype 0
connect tau3 Pe3
ltype 1
connect tau4 Pe4
ctype red
lweight 1
ltype 0
connect tau5 Pe5
ltype 1
connect tau6 Pe6
lweight 2
ltype 0
connect tau7 Pe7
ltype 1
connect tau8 Pe8
ltype 0
lweight 1
ctype green
connect tau9 Pe9
ctype black
if (0) {
connect tau10 Pe10
}
location 3000 15000 3000 17000
xlabel log (\tau_{5000})
ylabel T
limits tau9 T9
box
ctype blue
connect tau1 T1
ltype 1
connect tau2 T2
lweight 2
ltype 0
connect tau3 T3
ltype 1
connect tau4 T4
ctype red
lweight 1
ltype 0
connect tau5 T5
ltype 1
connect tau6 T6
ltype 0
lweight 2
connect tau7 T7
ltype 1
connect tau8 T8
ltype 0
ctype green
connect tau9 T9
ctype black
if (0) {
connect tau10 T10
}
lweight 1
location 19000 32000 17000 32000
xlabel log (\tau_{5000})
ylabel log(Pg)
limits tau9 Pg9
box
ctype blue
connect tau1 Pg1
ltype 1
connect tau2 Pg2
ltype 0
lweight 2
connect tau3 Pg3
ltype 1
connect tau4 Pg4
ctype red
ltype 0
lweight 1
connect tau5 Pg5
ltype 1
connect tau6 Pg6
ltype 0
lweight 2
connect tau7 Pg7
ltype 1
connect tau8 Pg8
ltype 0
ctype green
connect tau9 Pg9
ctype black
if (0) {
connect tau10 Pg10
}
lweight 1
if (0) {
location 19300 32000 3000 11000
ylabel actual error (%)
location 20000 32000 3000 6000
spline tau9  T9 tau10 Tbis
limits tau10 (abs(Tbis-T10)/T10 * 100)
connect  tau10 (abs(Tbis-T10)/T10 * 100)
box
ylabel T
xlabel log (\tau_{5000})
location 20000 32000 6000 9000
spline tau9 Pe9 tau10 Pebis
limits tau10 (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
box 0 2 0 0
connect  tau10  (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
ylabel Pe
location 20000 32000 9000 12000
spline tau9 Pg9 tau10 Pgbis
limits tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
connect  tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
box 0 2 0 0
ylabel Pg
}
QUIT
        verbose 1
        lines 3 0
        set dimen(elet) = 1.s
        set elet = 'Fe'
        define elet (elet)
        define eqw_rej (0.05)
        data "Sun/5627g4.44z0_Sun.int_m0t1.100.eqwidth"
        read ! { l 3 e 4 gf 5 w 6 a 13 el 1.s  ion 2 }
        define select_clean_eqw (1)
        if ( 1 ) {
        data "Sun/Fe-Sun.eqw"
        read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
        define select_clean_eqw ( 1 )
        }
       if (0) {
       data "dummy/Fe-dummy.eqw"
       read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
       define diff_star_offset (6.93)
       define diffeqw (1)
       } else {
       define diff_star_offset (0)
       define diffeqw (0)
       }
        data "syntspec/5627g4.44z0_Sun.int_m0t1.100_1.convol"
        read xm1 1
        read ym1 2
        data "syntspec/5627g4.44z0_Sun.int_m0t1.100_2.convol"
        read xm2 1
        read ym2 2
        data "/tmp/Sun_obs"
        read xo 1
        read yo 2
        set xo = xo/((0*1000/299792458)+1)
        set yo1 = yo if (xo >= 5150 && xo <= 5200)
        set xo1 = xo if (xo >= 5150 && xo <= 5200)
        set yo2 = yo if (xo >= 6530 && xo <= 6600)
        set xo2 = xo if (xo >= 6530 && xo <= 6600)
        define model_plot ('"5627g4.44z0_Sun.int_m0t1.100"')
        define norm_Ha (1.0)
        define norm_Mg (1.0)
        set dimen(labu) = 0
        define computeconvol (0)
        define convol (-4.0)
        device postlandfile Sun_Feparamtemp.ps
        input_new "eqwidt.sm" 
        write + "Sun/modelfit1_Sun.tab" 1 5627 4.44 1.100 \
        $meanFe1 $rmsFe1 \
        $meanFe2 $rmsFe2 $a_abvschi $siga_eFe1 $a_abvswl $siga_wlFe1 \
        $b_abvswl $b_abvschi $rmseFe1 $rmswlFe1 $meanredFe1
QUIT
        verbose 1
        lines 3 0
        set dimen(elet) = 1.s
        set elet = 'Fe'
        define elet (elet)
        define eqw_rej (0.05)
        data "Sun/5777g4.44z0_Sun.int_m0t1.100.eqwidth"
        read ! { l 3 e 4 gf 5 w 6 a 13 el 1.s  ion 2 }
        define select_clean_eqw (1)
        if ( 1 ) {
        data "Sun/Fe-Sun.eqw"
        read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
        define select_clean_eqw ( 1 )
        }
       if (0) {
       data "dummy/Fe-dummy.eqw"
       read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
       define diff_star_offset (6.93)
       define diffeqw (1)
       } else {
       define diff_star_offset (0)
       define diffeqw (0)
       }
        data "syntspec/5777g4.44z0_Sun.int_m0t1.100_1.convol"
        read xm1 1
        read ym1 2
        data "syntspec/5777g4.44z0_Sun.int_m0t1.100_2.convol"
        read xm2 1
        read ym2 2
        data "/tmp/Sun_obs"
        read xo 1
        read yo 2
        set xo = xo/((0*1000/299792458)+1)
        set yo1 = yo if (xo >= 5150 && xo <= 5200)
        set xo1 = xo if (xo >= 5150 && xo <= 5200)
        set yo2 = yo if (xo >= 6530 && xo <= 6600)
        set xo2 = xo if (xo >= 6530 && xo <= 6600)
        define model_plot ('"5777g4.44z0_Sun.int_m0t1.100"')
        define norm_Ha (1.0)
        define norm_Mg (1.0)
        set dimen(labu) = 0
        define computeconvol (0)
        define convol (-4.0)
        device postlandfile Sun_Feparamtemp.ps
        input_new "eqwidt.sm" 
        write + "Sun/modelfit1_Sun.tab" 2 5777 4.44 1.100 \
        $meanFe1 $rmsFe1 \
        $meanFe2 $rmsFe2 $a_abvschi $siga_eFe1 $a_abvswl $siga_wlFe1 \
        $b_abvswl $b_abvschi $rmseFe1 $rmswlFe1 $meanredFe1
QUIT
        verbose 1
        lines 3 0
        set dimen(elet) = 1.s
        set elet = 'Fe'
        define elet (elet)
        define eqw_rej (0.05)
        data "Sun/5927g4.44z0_Sun.int_m0t1.100.eqwidth"
        read ! { l 3 e 4 gf 5 w 6 a 13 el 1.s  ion 2 }
        define select_clean_eqw (1)
        if ( 1 ) {
        data "Sun/Fe-Sun.eqw"
        read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
        define select_clean_eqw ( 1 )
        }
       if (0) {
       data "dummy/Fe-dummy.eqw"
       read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
       define diff_star_offset (6.93)
       define diffeqw (1)
       } else {
       define diff_star_offset (0)
       define diffeqw (0)
       }
        data "syntspec/5927g4.44z0_Sun.int_m0t1.100_1.convol"
        read xm1 1
        read ym1 2
        data "syntspec/5927g4.44z0_Sun.int_m0t1.100_2.convol"
        read xm2 1
        read ym2 2
        data "/tmp/Sun_obs"
        read xo 1
        read yo 2
        set xo = xo/((0*1000/299792458)+1)
        set yo1 = yo if (xo >= 5150 && xo <= 5200)
        set xo1 = xo if (xo >= 5150 && xo <= 5200)
        set yo2 = yo if (xo >= 6530 && xo <= 6600)
        set xo2 = xo if (xo >= 6530 && xo <= 6600)
        define model_plot ('"5927g4.44z0_Sun.int_m0t1.100"')
        define norm_Ha (1.0)
        define norm_Mg (1.0)
        set dimen(labu) = 0
        define computeconvol (0)
        define convol (-4.0)
        device postlandfile Sun_Feparamtemp.ps
        input_new "eqwidt.sm" 
        write + "Sun/modelfit1_Sun.tab" 3 5927 4.44 1.100 \
        $meanFe1 $rmsFe1 \
        $meanFe2 $rmsFe2 $a_abvschi $siga_eFe1 $a_abvswl $siga_wlFe1 \
        $b_abvswl $b_abvschi $rmseFe1 $rmswlFe1 $meanredFe1
QUIT
  data "Sun/modelfit1_Sun.tab"
  lines 1 0
  read {model 1 Teff 2 logg 3 TURBVEL 4  meanFe1 5 rmsFe1 6 meanFe2 7 rmsFe2 8 a_abvschi 9 siga_eFe1 10 a_abvswl 11 siga_wlFe1 12 \
  b_abvswl 13 b_abvschi 14 rmseFe1 15 rmswlFe1 16 meanredFe1 17}
 device postportfile Sun/best_model_1.eps
  define met ($met1 - 7.45)
  vecminmax Teff_list minTeff maxTeff
  vecminmax logg_list minlogg maxlogg
  vecminmax TURBVEL_list minTURBVEL maxTURBVEL
    if (! (1)) {
    define Temp_best (5927)
    define Temp_error(0)
    define Teff_best  (5927)
    }
    if (! (0)) {
    define logg_best (4.44)
    define logg_error (0.00)
    }
  if ($Temp_best > $maxTeff \
  || $Temp_best < $minTeff \
  || $logg_best > $maxlogg \
  || $logg_best < $minlogg \
  || ((abs($met - 0)) > $met_error1) ) {
  define converged (0)
  } else {
  define converged (1)
  }
  write + "Sun/fixedmicroturb_parameters.tab" $converged   $Temp_best "+/-" $Temp_error "/" $Teff_best "+/-" $Teff_error \
  $logg_best  "+/-" $logg_error $met "+/-" $met_error1 \
  $TURBVEL_best "+/-" $TURBVEL_error "/" $microturb_best "+/-" $microturb_error \
 "(init" 5777 4.44 0 1.100 ")"
QUIT
data "models.sm"
verbose 1
lines 1 1
read {Teff1 2 logg1 4 met1 6}
lines 3 0
read  {tau1 3 T1 4 Pe1 5 Pg1 6 taur1 2}
define ndp (dimen(tau1)-1)
define end ($ndp+3)
do i=2,9 {
define beg ($end+1)
define end ($beg)
lines $beg $end
read Teff$i 2
read logg$i 4
read met$i 6
define beg ($end+2)
define end ($beg + $ndp)
lines $beg $end
read  tau$i 3
read T$i 4
read Pe$i 5
read Pg$i 6
read taur$i 2
}
if (0) {
define beg ($end+3)
lines $beg 0
read  {tau10 3 T10 4 Pe10 5 Pg10 6 taur10 2}
}
device postportfile interpol_check.ps
ctype green
toplabel T_{eff}=5777 logg=4.44 z=0
ctype black
location 3000 15000 17000 32000
ylabel log(Pe)
limits tau9 Pe9
box 0 2 0 0
lweight 4
ltype 0
ctype blue
relocate (4000 31000)
draw (4600 31000)
define Teff1 (Teff1)
define Teff2 (Teff2)
putlabel 6 T_{eff}=$Teff1 $Teff2
ctype red
relocate (4000 30500)
draw (4600 30500)
define Teff5 (Teff5)
define Teff6 (Teff6)
putlabel 6 T_{eff}=$Teff5 $Teff6
ctype black
lweight 1
relocate (4000 30000)
draw (4600 30000)
define logg1 (logg1)
define logg5 (logg5)
putlabel 6 logg=$logg1 $logg5
lweight 4
relocate (4000 29500)
draw (4600 29500)
define logg3 (logg3)
define logg7 (logg7)
putlabel 6 logg=$logg3 $logg7
ltype 0
relocate (4000 29000)
draw (4600 29000)
define met3 (met3)
define met1 (met1)
putlabel 6 [Fe/H]=$met1 $met3
ltype 1
define met2 (met2)
define met4 (met4)
relocate (4000 28500)
draw (4600 28500)
putlabel 6 [Fe/H]=$met2 $met4
ctype blue
lweight 1
ltype 0
connect tau1 Pe1
ltype 1
connect tau2 Pe2
lweight 2
ltype 0
connect tau3 Pe3
ltype 1
connect tau4 Pe4
ctype red
lweight 1
ltype 0
connect tau5 Pe5
ltype 1
connect tau6 Pe6
lweight 2
ltype 0
connect tau7 Pe7
ltype 1
connect tau8 Pe8
ltype 0
lweight 1
ctype green
connect tau9 Pe9
ctype black
if (0) {
connect tau10 Pe10
}
location 3000 15000 3000 17000
xlabel log (\tau_{5000})
ylabel T
limits tau9 T9
box
ctype blue
connect tau1 T1
ltype 1
connect tau2 T2
lweight 2
ltype 0
connect tau3 T3
ltype 1
connect tau4 T4
ctype red
lweight 1
ltype 0
connect tau5 T5
ltype 1
connect tau6 T6
ltype 0
lweight 2
connect tau7 T7
ltype 1
connect tau8 T8
ltype 0
ctype green
connect tau9 T9
ctype black
if (0) {
connect tau10 T10
}
lweight 1
location 19000 32000 17000 32000
xlabel log (\tau_{5000})
ylabel log(Pg)
limits tau9 Pg9
box
ctype blue
connect tau1 Pg1
ltype 1
connect tau2 Pg2
ltype 0
lweight 2
connect tau3 Pg3
ltype 1
connect tau4 Pg4
ctype red
ltype 0
lweight 1
connect tau5 Pg5
ltype 1
connect tau6 Pg6
ltype 0
lweight 2
connect tau7 Pg7
ltype 1
connect tau8 Pg8
ltype 0
ctype green
connect tau9 Pg9
ctype black
if (0) {
connect tau10 Pg10
}
lweight 1
if (0) {
location 19300 32000 3000 11000
ylabel actual error (%)
location 20000 32000 3000 6000
spline tau9  T9 tau10 Tbis
limits tau10 (abs(Tbis-T10)/T10 * 100)
connect  tau10 (abs(Tbis-T10)/T10 * 100)
box
ylabel T
xlabel log (\tau_{5000})
location 20000 32000 6000 9000
spline tau9 Pe9 tau10 Pebis
limits tau10 (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
box 0 2 0 0
connect  tau10  (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
ylabel Pe
location 20000 32000 9000 12000
spline tau9 Pg9 tau10 Pgbis
limits tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
connect  tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
box 0 2 0 0
ylabel Pg
}
QUIT
  verbose 1
  lines 3 0
  set dimen(elet) = 1.s
  set elet = 'Fe'
  define elet (elet)
  define deltalam (.00212639278727566556*3)
  define eqw_rej (0.05)
  data "Sun/5777g4.44z0_Sun.int_m0t1.100.eqwidth"
  read ! { l 3 e 4 gf 5 w 6 a 13 el 1.s  ion 2 }
  define select_clean_eqw (1)
  if (0) {
  data "dummy/Fe-dummy.eqw"
  read ! { ldiff 3 ediff 4 gfdiff 5 wdiff 6 adiff 9 eldiff 1.s  iondiff 2 }
  define diff_star_offset (6.93)
  define diffeqw (1)
  } else {
  define diff_star_offset (0)
  define diffeqw (0)
  }
  if ( 1 ) {
  data "Sun/Fe-Sun.eqw"
  read ! {lo 3 eo 4 gfo 5 wt 6 wo 7 ao 9 elo 1.s  iono 2 }
  define select_clean_eqw ( 1 )
  }
  data "syntspec/5777g4.44z0_Sun.int_m0t1.100_1.convol"
  read xm1 1
  read ym1 2
  data "syntspec/5777g4.44z0_Sun.int_m0t1.100_2.convol"
  read xm2 1
  read ym2 2
  data "/tmp/Sun_obs"
  read xo 1
  read yo 2
  set yo1 = yo if (xo >= 5150 && xo <= 5200)
  set xo1 = xo if (xo >= 5150 && xo <= 5200)
  set xo1 = xo1/((0*1000/299792458)+1)
  set yo2 = yo if (xo >= 6530 && xo <= 6600)
  set xo2 = xo if (xo >= 6530 && xo <= 6600)
  set xo2 = xo2/((0*1000/299792458)+1)
  define model_plot ('"5777g4.44z0_Sun.int_m0t1.100"')
  define norm_Ha (1.0)
  define norm_Mg (1.0)
  set dimen(labu) = 0
  define computeconvol (0)
  define convol (-4.0)
  device postlandfile Sun_Feparamtemp.ps
  input_new "eqwidt.sm" 
  if (1) {
  define converged_Teff (($a_abxvschi - $siga_exFe1 * 1) <= 0 \
                        && ($a_abxvschi + $siga_exFe1 * 1) > 0)
  } else {
  define converged_Teff (1)
  }
  if (1) {
  define converged_xit (($a_abxvswl - $siga_wlxFe1 * 1) <= 0 \
                        &&  ($a_abxvswl + $siga_wlxFe1 * 1) > 0)
  } else {
  define converged_xit (1)
  }
  if (0) {
  define converged_logg ((($meanredFe1-$meanFe2) - sqrt($rmsFe2**2) * 1) <= 0 && \
    (($meanredFe1-$meanFe2) + sqrt($rmsFe2**2) * 1) > 0)
  } else {
  define converged_logg (1)
  }
  if ( $converged_Teff  && $converged_xit && $converged_logg) {
  define converged (1)
  } else {
  define converged (0)
  }
  if (1) {
  define a (-42)
  define b ($a_abxvswl - $a * 1.100 )
  define TURBVEL  (int((-$b/$a)*1000)/1000)
  define b ($a_abxvswl + $siga_wlxFe1 *1)
  define b ($b - $a * 1.100 )
  define TURBVEL_error (int(abs(-$b/$a - $TURBVEL)*1000)/1000)
  } else {
  define TURBVEL (1.100)
  define TURBVEL_error (0.0)
  }
  if (1) {
  define a (-0.0002)
  define b ($a_abxvschi )
  define b ($b - $a * 5777 )
  define Teff (int(-$b/$a))
  define b ($a_abxvschi + $siga_exFe1 *1)
  define b ($b - $a * 5777 )
  define Teff_error (int(abs(-$b/$a - 5777)))
  } else {
  define Teff (5777 )
  define Teff_error (0)
  define converged_Teff (1)
  }
  if (0) {
  define a (-0.3)
  define b (($meanredFe1-$meanFe2))
  define b ($b - $a * 4.44 )
  define logg (int((-$b/$a)*1000)/1000)
  define b (($meanredFe1-$meanFe2) + sqrt($rmsFe2**2))
  define b ($b - $a * 4.44 )
  define logg_error (int(abs(-$b/$a - 4.44)*1000)/1000)
  } else {
  define logg (4.44)
  define logg_error (0.000)
  define converged_logg (1)
  }
  if (1) {
  define met (int(($meanxFe1- 7.45) *1000)/1000)
  define met_error (int($rmsxFe1*1000)/1000)
  } else {
  define met (0)
  define met_error (0.000)
  }
  if (1 == 2) {
  write + "Sun/best_parameters.tab" $converged  $Teff "+/-" $Teff_error 5777 $converged_Teff \
   $logg "+/-" $logg_error 4.44 $converged_logg \
   $met "+/-" $met_error  0 \
    $TURBVEL "+/-" $TURBVEL_error 1.100 $converged_xit
  } else {
  write "zreftemp"  $met
  }
QUIT
data "models.sm"
verbose 1
lines 1 1
read {Teff1 2 logg1 4 met1 6}
lines 3 0
read  {tau1 3 T1 4 Pe1 5 Pg1 6 taur1 2}
define ndp (dimen(tau1)-1)
define end ($ndp+3)
do i=2,9 {
define beg ($end+1)
define end ($beg)
lines $beg $end
read Teff$i 2
read logg$i 4
read met$i 6
define beg ($end+2)
define end ($beg + $ndp)
lines $beg $end
read  tau$i 3
read T$i 4
read Pe$i 5
read Pg$i 6
read taur$i 2
}
if (0) {
define beg ($end+3)
lines $beg 0
read  {tau10 3 T10 4 Pe10 5 Pg10 6 taur10 2}
}
device postportfile interpol_check.ps
ctype green
toplabel T_{eff}=5777 logg=4.44 z=0.00
ctype black
location 3000 15000 17000 32000
ylabel log(Pe)
limits tau9 Pe9
box 0 2 0 0
lweight 4
ltype 0
ctype blue
relocate (4000 31000)
draw (4600 31000)
define Teff1 (Teff1)
define Teff2 (Teff2)
putlabel 6 T_{eff}=$Teff1 $Teff2
ctype red
relocate (4000 30500)
draw (4600 30500)
define Teff5 (Teff5)
define Teff6 (Teff6)
putlabel 6 T_{eff}=$Teff5 $Teff6
ctype black
lweight 1
relocate (4000 30000)
draw (4600 30000)
define logg1 (logg1)
define logg5 (logg5)
putlabel 6 logg=$logg1 $logg5
lweight 4
relocate (4000 29500)
draw (4600 29500)
define logg3 (logg3)
define logg7 (logg7)
putlabel 6 logg=$logg3 $logg7
ltype 0
relocate (4000 29000)
draw (4600 29000)
define met3 (met3)
define met1 (met1)
putlabel 6 [Fe/H]=$met1 $met3
ltype 1
define met2 (met2)
define met4 (met4)
relocate (4000 28500)
draw (4600 28500)
putlabel 6 [Fe/H]=$met2 $met4
ctype blue
lweight 1
ltype 0
connect tau1 Pe1
ltype 1
connect tau2 Pe2
lweight 2
ltype 0
connect tau3 Pe3
ltype 1
connect tau4 Pe4
ctype red
lweight 1
ltype 0
connect tau5 Pe5
ltype 1
connect tau6 Pe6
lweight 2
ltype 0
connect tau7 Pe7
ltype 1
connect tau8 Pe8
ltype 0
lweight 1
ctype green
connect tau9 Pe9
ctype black
if (0) {
connect tau10 Pe10
}
location 3000 15000 3000 17000
xlabel log (\tau_{5000})
ylabel T
limits tau9 T9
box
ctype blue
connect tau1 T1
ltype 1
connect tau2 T2
lweight 2
ltype 0
connect tau3 T3
ltype 1
connect tau4 T4
ctype red
lweight 1
ltype 0
connect tau5 T5
ltype 1
connect tau6 T6
ltype 0
lweight 2
connect tau7 T7
ltype 1
connect tau8 T8
ltype 0
ctype green
connect tau9 T9
ctype black
if (0) {
connect tau10 T10
}
lweight 1
location 19000 32000 17000 32000
xlabel log (\tau_{5000})
ylabel log(Pg)
limits tau9 Pg9
box
ctype blue
connect tau1 Pg1
ltype 1
connect tau2 Pg2
ltype 0
lweight 2
connect tau3 Pg3
ltype 1
connect tau4 Pg4
ctype red
ltype 0
lweight 1
connect tau5 Pg5
ltype 1
connect tau6 Pg6
ltype 0
lweight 2
connect tau7 Pg7
ltype 1
connect tau8 Pg8
ltype 0
ctype green
connect tau9 Pg9
ctype black
if (0) {
connect tau10 Pg10
}
lweight 1
if (0) {
location 19300 32000 3000 11000
ylabel actual error (%)
location 20000 32000 3000 6000
spline tau9  T9 tau10 Tbis
limits tau10 (abs(Tbis-T10)/T10 * 100)
connect  tau10 (abs(Tbis-T10)/T10 * 100)
box
ylabel T
xlabel log (\tau_{5000})
location 20000 32000 6000 9000
spline tau9 Pe9 tau10 Pebis
limits tau10 (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
box 0 2 0 0
connect  tau10  (abs(10**Pebis-10**Pe10)/10**Pe10 * 100)
ylabel Pe
location 20000 32000 9000 12000
spline tau9 Pg9 tau10 Pgbis
limits tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
connect  tau10 (abs(10**Pgbis-10**Pg10)/10**Pg10 * 100)
box 0 2 0 0
ylabel Pg
}
QUIT
