Determine spectral slope of science source
From CARMA
(Difference between revisions)
(→Determine Spectral Index of Passband Calibrator) |
|||
(6 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | Work in progress | + | Work in progress, but the meat is all here now. |
+ | There are probably several approaches to this problem, and this is one. | ||
+ | (updated Feb 2012, Shaye) | ||
''These notes are from a project to determine the spectral slope of DG Tau, which is a protostellar object.'' | ''These notes are from a project to determine the spectral slope of DG Tau, which is a protostellar object.'' | ||
Line 18: | Line 20: | ||
set pass=3C84 # 3C84 was our passband calibrator | set pass=3C84 # 3C84 was our passband calibrator | ||
set vis=uvdata # this is our visibility data | set vis=uvdata # this is our visibility data | ||
− | set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) # these are the 16 bands | + | set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) # these are the 16 bands ; on linux `seq 1 16` works as well |
#Brightness temperature of URANUS at our observing frequencies to be used during flux calibration command "bootflux" | #Brightness temperature of URANUS at our observing frequencies to be used during flux calibration command "bootflux" | ||
Line 166: | Line 168: | ||
== Determine Spectral Index of Science Source == | == Determine Spectral Index of Science Source == | ||
− | set onsource=DGTAU | + | set onsource=DGTAU #unresolved science target |
− | set flux=URANUS | + | set flux=URANUS #flux calibrator |
− | set cal=3C111 | + | set cal=3C111 #phase calibrator |
− | set pass1=3C84 | + | set pass1=3C84 #passband calibrator |
− | set vis=uvdata | + | set vis=uvdata #visibility data |
− | + | ||
set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) | set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) | ||
set uranustb = ( 125.027 125.201 125.376 125.552 125.729 125.906 126.085 126.265 121.987 121.829 121.672 121.515 121.360 121.204 121.050 120.896 ) | set uranustb = ( 125.027 125.201 125.376 125.552 125.729 125.906 126.085 126.265 121.987 121.829 121.672 121.515 121.360 121.204 121.050 120.896 ) | ||
set refant=8 | set refant=8 | ||
− | # | + | #Flux derived for phase calibrator in steps above |
set fg=11.868 | set fg=11.868 | ||
− | + | #Run mfcal, using all channels to increase signal to noise, with the "flux" parameter set with values determined in the first step | |
− | + | mfcal vis=$vis.uflag select="source("$pass1")" interval=0.1,100000. refant=10 edge=2 line=chan,624,1,1,1 flux=18.755055,104.0,-0.5073 | |
− | + | /bin/rm -Rf $vis.fullpb | |
− | + | uvcat vis=$vis.uflag out=$vis.fullpb options=nopol,nocal | |
− | + | #Run phase selfcal on the phase calibrator to be applied to the target source | |
− | + | mselfcal vis=$vis.fullpb select="source("$cal")" interval=18.01 options=noscale,phase,apriori refant=$refant line=chan,1,1,624,624 | |
− | + | smauvplt vis=$vis.fullpb axis=time,phase device=/xs yrange=-180,180 nxy=1,1 options=nobase | |
− | + | /bin/rm -Rf $vis.scp | |
− | + | uvcat vis=$vis.fullpb select="source("$cal,$onsource,$pass1")" out=$vis.scp options=nopass,nopol | |
− | + | #Run amplitude selfcal on phase calibrator to be applied to the target source | |
− | + | #Input the flux of the phase calibrator derived from previous step | |
− | + | #(Don't we need to account for the slope of the phase calibrator?) | |
− | + | mselfcal vis=$vis.scp select="source("$cal")" interval=40.01 options=noscale,amplitude refant=$refant line=chan,1,1,624,624 flux=$fg | |
− | + | /bin/rm -Rf $vis.scpa | |
− | + | uvcat vis=$vis.scp select="source("$cal,$onsource,$pass1")" out=$vis.scpa options=nopass,nopol | |
− | + | #Now our science target has been calibrated completely. | |
− | + | #If the source is alone in the primary beam, we can use uvamp on each band to determine the amplitude (Jy) in that band | |
− | + | #Let's do this for the science source, the phase calibrator, and the passband calibrator | |
− | + | foreach band ($bands) | |
− | + | uvamp vis=$vis.scpa select="source("$onsource"),win("$band")" bin=1,50,klam log=script3_uvamp.$onsource.$band | |
− | + | uvamp vis=$vis.scpa select="source("$cal"),win("$band")" bin=1,50,klam log=script3_uvamp.$cal.$band | |
− | + | uvamp vis=$vis.scpa select="source("$pass1"),win("$band")" bin=1,50,klam log=script3_uvamp.$pass1.$band | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
end | end | ||
+ | #clean up | ||
+ | /bin/rm -Rf $vis.fullpb $vis.scp $vis.scpa | ||
+ | |||
+ | You now have 16 files representing the flux of your science source at each band frequency. | ||
+ | Use your favorite program to fit the spectral slope of the science source. |
Latest revision as of 11:48, 23 February 2012
Work in progress, but the meat is all here now. There are probably several approaches to this problem, and this is one. (updated Feb 2012, Shaye)
These notes are from a project to determine the spectral slope of DG Tau, which is a protostellar object.
- We assume your data has been properly flagged.
- There are 16 continuum windows (500 MHz BW, 39 channels) in this example.
Contents |
[edit] Overview
1. Determine spectral slope of bandpass calibrator and its flux at some reference frequency.
2. Determine spectral slope of phase calibrator and its flux at some reference frequency.
3. Determine spectral slope of science sources using the above values to prevent any slope due to calibration process.
[edit] Determine Spectral Index of Passband Calibrator
set flux=URANUS # Uranus was our flux calibrator set pass=3C84 # 3C84 was our passband calibrator set vis=uvdata # this is our visibility data set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) # these are the 16 bands ; on linux `seq 1 16` works as well #Brightness temperature of URANUS at our observing frequencies to be used during flux calibration command "bootflux" #Derived using function provided by A. Isella. He derived it from WMAP data (and references therein). #We hope this is more accurate than the models provided in Miriad. #Tb=b1 + b2*log(x) + b3*log(x)^2 + b4*log(x)^3 #b1=154.813 b2=106.598 b3=-91.0474 b4=15.0796 set uranustb = ( 125.02683 125.20088 125.37588 125.55175 125.72856 125.90630 126.08495 126.26458 121.98721 121.82910 121.67174 121.51508 121.35952 121.20437 121.04997 120.89625 ) #C8 picked as refant since it is at the center of this D-array and looks good set refant=8 #Prepare data rm -Rf $vis uvcat vis=c0800.4D_102HH211.2.miriad out=$vis select="-auto" options=nopass,nocal,nopol #Flagging of visibility data already done
#LOOP OVER ALL 16 BANDS foreach band ( $bands ) #Select individual window /bin/rm -Rf $vis.$band uvcat vis=$vis out=$vis.$band select="'win($band)'" options=nocal,nopol,nopass #Run mfcal on this window on very short timescale to minimize decorrelation mfcal vis=$vis.$band select="source("$pass")" interval=0.1,10000. refant=$refant edge=2 line=chan,39,1,1,1 #Check mfcal solution gpplt vis=$vis.$band yaxis=amp device=1/xs nxy=4,4 gpplt vis=$vis.$band yaxis=phase device=1/xs nxy=4,4 #Apply mfcal solution to correct for variation across the bandpass /bin/rm -Rf $vis.$band.pb uvcat vis=$vis.$band out=$vis.$band.pb options=nocal,nopol #STARTING STEPS FOR BOOTFLUX #BANDPASS CALIBRATOR PHASE CALIBRATION #Run selfcal on bandpass source do derive gain solutions for the bandpass source #Interval can be short since just applying it to the same source (?) mselfcal vis=$vis.$band.pb select="source("$pass")" interval=1.01 options=apriori,noscale,phase refant=$refant line=chan,1,1,39,39 #Check selfcal solution for bandpass source smagpplt vis=$vis.$band.pb yaxis=phase device=/xs nxy=4,4 smagpplt vis=$vis.$band.pb yaxis=amp device=/xs nxy=4,4 #Apply selfcal phase solution from the bandpass calibrator to the bandpass calibrator /bin/rm -Rf $vis.$band.$pass.scp uvcat vis=$vis.$band.pb out=$vis.$band.$pass.scp select="source("$pass")" options=nopass,nopol #FLUX CALIBRATOR PHASE CALIBRATION #Run selfcal on flux source to derive gain solutions for the flux source #Interval can be short since just applying it to the same source (?) mselfcal vis=$vis.$band.pb select="source("$flux")" interval=1.01 options=apriori,noscale,phase refant=$refant line=chan,1,1,39,39 #Check selfcal solution for flux source smagpplt vis=$vis.$band.pb yaxis=phase device=/xs nxy=4,4 smagpplt vis=$vis.$band.pb yaxis=amp device=/xs nxy=4,4 #Apply selfcal phase solution from the flux calibrator to the flux calibrator /bin/rm -Rf $vis.$band.$flux.scp uvcat vis=$vis.$band.pb out=$vis.$band.$flux.scp select="source("$flux")" options=nopass,nopol #UVCAT bandpass and phase corrected visiblity data for the BANDPASS and FLUX calibrator together #This is the visibility file to use in bootflux /bin/rm -Rf $vis.$band.btrdy uvcat vis=$vis.$band.$pass.scp,$vis.$band.$flux.scp out=$vis.$band.btrdy options=nopass,nopol,nocal #BOOTFLUX STEP #print out Tb of URANUS at this window echo $uranustb[$band] #run bootflux and dump output into log file bootflux vis=$vis.$band.btrdy select="source("$pass,$flux")" line=chan,1,1,39,39 taver=5.01 primary=$flux,$uranustb[$band] badres=70 log=bootfluxJ.$pass.log2 #grep that log file and extract the bootstrapped Average Flux and Flux Error of 3C84 at this window grep Average bootfluxJ.$pass.log2 | grep Flux | cut -c 17-31 > script1_bootflux.$pass.$band #print the result to the screen set tempfluxpass = `awk 'NR==1' script1_bootflux.$pass.$band` echo $tempfluxpass #clean up /bin/rm -Rf $vis.$band $vis.$band.pb $vis.$band.$pass.scp $vis.$band.$flux.scp $vis.$band.btrdy bootflux.$pass.log2 end
You now have 16 files representing the flux of your passband calibrator at each band frequency. Use your favorite program to fit the spectral slope of the passband calibrator and find its flux at some reference frequency. You will use these three values (slope, reference frequency, flux at the reference frequency) in the next step.
[edit] Determine Spectral Index of Phase Calibrator
set flux=URANUS # Flux calibrator set pass1=3C84 # Passband calibrator set pass2=3C454.3 # Secondary passband calibrator set cal=3C111 # Phase calibrator set vis=uvdata # visibility data set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) set uranustb = ( 124.89169 125.05010 125.20929 125.36919 125.52988 125.69135 125.85355 126.01654 121.49650 121.35417 121.21234 121.07124 120.93065 120.79076 120.65140 120.51263 ) set refant=8 #Run mfcal, using all channels to increase signal to noise, with the "flux" parameter set with values determined in the previous step #"flux" parameter takes: source flux density, reference frequency (GHz), source spectral index mfcal vis=$vis select="source("$pass1")" interval=0.1,10000. refant=$refant edge=2 line=chan,624,1,1,1 flux=1.868,103.0,-0.695 #Check mfcal solution gpplt vis=$vis yaxis=amp device=1/xs nxy=4,4 gpplt vis=$vis yaxis=phase device=1/xs nxy=4,4 #Apply mfcal solution to correct for variation across the bandpass /bin/rm -Rf $vis.fullpb uvcat vis=$vis out=$vis.fullpb options=nopol,nocal #LOOP OVER ALL 16 BANDS foreach band ($bands) #Select individual window /bin/rm -Rf $vis.$band uvcat vis=$vis.fullpb out=$vis.$band select="'win($band)'" options=nocal,nopol,nopass #Run selfcal on phase calibrator to derive gain solutions for it mselfcal vis=$vis.$band select="source("$cal")" interval=1.01 options=noscale,phase,apriori refant=$refant line=chan,1,1,39,39 #Check selfcal solution for phase calibrator smagpplt vis=$vis.fullpb yaxis=phase device=/xs nxy=4,4 smagpplt vis=$vis.fullpb yaxis=amp device=/xs nxy=4,4 #Apply selfcal phase solution from the phase calibrator to the phase calibrator /bin/rm -Rf $vis.$cal.$band.scp uvcat vis=$vis.$band out=$vis.$cal.$band.scp select="source("$cal")" options=nopass,nopol #Run selfcal on flux calibrator to derive gain solutions for it mselfcal vis=$vis.$band select="source("$flux")" interval=1.01 options=noscale,phase,apriori refant=$refant line=chan,1,1,39,39 #Check selfcal solution for flux calibrator smagpplt vis=$vis.fullpb yaxis=phase device=3/xs nxy=4,4 #Apply selfcal phase solution from the flux calibrator to the flux calibrator /bin/rm -Rf $vis.$flux.$band.scp uvcat vis=$vis.$band out=$vis.$flux.$band.scp select="source("$flux")" options=nopass,nopol #UVCAT bandpass and phase corrected visiblity data for the PHASE and FLUX calibrator together #This is the visibility file to use in bootflux /bin/rm -Rf $vis.$band.btrdy uvcat vis=$vis.$cal.$band.scp,$vis.$flux.$band.scp out=$vis.$band.btrdy options=nopass,nopol,nocal bootflux vis=$vis.$band.btrdy select="source("$cal,$flux")" line=chan,1,1,39,39 taver=5.01 badres=70 primary=$flux,$uranustb[$band] log=bootfluxJ.$cal.log2 grep Average bootfluxJ.$cal.log2 | grep Flux | cut -c 17-31 > script2_bootflux.$cal.$band set tempfluxcal = `awk 'NR==1' script2_bootflux.$cal.$band` echo $tempfluxcal /bin/rm -Rf $vis.$band $vis.$cal.$band.scp $vis.$flux.$band.scp $vis.$band.btrdy /bin/rm -Rf bootfluxJ.$cal.log2 end /bin/rm -Rf $vis.fullpb
You now have 16 files representing the flux of your phase calibrator at each band frequency. Use your favorite program to fit the spectral slope of the passband calibrator and find its flux at some reference frequency. You will use these three values (slope, reference frequency, flux at the reference frequency) in the next step.
[edit] Determine Spectral Index of Science Source
set onsource=DGTAU #unresolved science target set flux=URANUS #flux calibrator set cal=3C111 #phase calibrator set pass1=3C84 #passband calibrator set vis=uvdata #visibility data set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) set uranustb = ( 125.027 125.201 125.376 125.552 125.729 125.906 126.085 126.265 121.987 121.829 121.672 121.515 121.360 121.204 121.050 120.896 ) set refant=8
#Flux derived for phase calibrator in steps above set fg=11.868
#Run mfcal, using all channels to increase signal to noise, with the "flux" parameter set with values determined in the first step mfcal vis=$vis.uflag select="source("$pass1")" interval=0.1,100000. refant=10 edge=2 line=chan,624,1,1,1 flux=18.755055,104.0,-0.5073 /bin/rm -Rf $vis.fullpb uvcat vis=$vis.uflag out=$vis.fullpb options=nopol,nocal #Run phase selfcal on the phase calibrator to be applied to the target source mselfcal vis=$vis.fullpb select="source("$cal")" interval=18.01 options=noscale,phase,apriori refant=$refant line=chan,1,1,624,624 smauvplt vis=$vis.fullpb axis=time,phase device=/xs yrange=-180,180 nxy=1,1 options=nobase /bin/rm -Rf $vis.scp uvcat vis=$vis.fullpb select="source("$cal,$onsource,$pass1")" out=$vis.scp options=nopass,nopol #Run amplitude selfcal on phase calibrator to be applied to the target source #Input the flux of the phase calibrator derived from previous step #(Don't we need to account for the slope of the phase calibrator?) mselfcal vis=$vis.scp select="source("$cal")" interval=40.01 options=noscale,amplitude refant=$refant line=chan,1,1,624,624 flux=$fg /bin/rm -Rf $vis.scpa uvcat vis=$vis.scp select="source("$cal,$onsource,$pass1")" out=$vis.scpa options=nopass,nopol #Now our science target has been calibrated completely. #If the source is alone in the primary beam, we can use uvamp on each band to determine the amplitude (Jy) in that band #Let's do this for the science source, the phase calibrator, and the passband calibrator foreach band ($bands) uvamp vis=$vis.scpa select="source("$onsource"),win("$band")" bin=1,50,klam log=script3_uvamp.$onsource.$band uvamp vis=$vis.scpa select="source("$cal"),win("$band")" bin=1,50,klam log=script3_uvamp.$cal.$band uvamp vis=$vis.scpa select="source("$pass1"),win("$band")" bin=1,50,klam log=script3_uvamp.$pass1.$band end #clean up /bin/rm -Rf $vis.fullpb $vis.scp $vis.scpa
You now have 16 files representing the flux of your science source at each band frequency. Use your favorite program to fit the spectral slope of the science source.