Determine spectral slope of science source

From CARMA
(Difference between revisions)
Jump to: navigation, search
(Derive Spectral Index of Passband Calibrator)
Line 6: Line 6:
  
 
#! /bin/csh -f
 
#! /bin/csh -f
# Reduce CARMA c0800 data: SCRIPT 1
 
 
# Script 1 -- Deriving spectral index of 3C84, which was used for bandpass and phase calibration
 
# This script derives the flux of 3C84 in each spectral window using URANUS and the bootflux miriad program
 
# User should take the output of bootflux, and use a program to calculate the spectral index and flux of 3C84
 
# This information will be used in later scripts
 
  
 
#Set variable names
 
#Set variable names
Line 33: Line 27:
 
rm -Rf $vis
 
rm -Rf $vis
 
uvcat vis=c0800.4D_102HH211.2.miriad out=$vis select="-auto" options=nopass,nocal,nopol
 
uvcat vis=c0800.4D_102HH211.2.miriad out=$vis select="-auto" options=nopass,nocal,nopol
 
#Create obs summary files
 
#/bin/rm -f listobs.out uvlist.out
 
#/bin/rm -f uvlist.out
 
#/bin/rm -f uvindex.out
 
#listobs vis=$vis.unflagged log=listobs.out
 
#uvlist vis=$vis.unflagged options=spec log=uvlist.out
 
#uvindex vis=$vis.unflagged log=uvindex.out
 
  
 
#Flag visibility data
 
#Flag visibility data
uvflag vis=$vis edge=2 flagval=flag
 
uvflag vis=$vis select="ant(2),time(08:47:01.0,09:13:22.0)" flagval=flag
 
uvflag vis=$vis select="ant(2),time(10:29:53.0,10:56:38.0)" flagval=flag
 
uvflag vis=$vis select="ant(6),time(08:47:01.0,09:13:22.0)" flagval=flag
 
uvflag vis=$vis select="ant(10),time(08:47:01.0,09:13:22.0)" flagval=flag
 
uvflag vis=$vis select="ant(15),time(14:25:08.5,15:30:00.0)" flagval=flag
 
uvflag vis=$vis select="ant(5),time(09:13:22.0,09:38:26.5)" flagval=flag
 
uvflag vis=$vis select="ant(6),time(10:29:53.0,10:56:38.0)" flagval=flag
 
uvflag vis=$vis select="ant(4),time(09:13:22.0,09:38:26.5)" flagval=flag
 
uvflag vis=$vis select="ant(14),time(08:47:01.0,09:13:22.0)" flagval=flag
 
uvflag vis=$vis select="ant(1),time(08:00:00.0,13:07:06.0)" flagval=flag
 
uvflag vis=$vis select="time(14:39:10.0,14:39:30)" flagval=flag
 
uvflag vis=$vis select="time(14:42:12.5,14:42:57.5),source(IRAS4)" flagval=flag
 
uvflag vis=$vis select="time(09:38:26.5,10:04:33.5)" flagval=flag
 
 
uvflag vis=$vis select="time(11:00:00.0,15:00:00.0),source(URANUS)" flagval=flag
 
uvflag vis=$vis select="time(08:47:01.0,09:13:22.0)" flagval=flag
 
  
 
foreach band ( $bands )   
 
foreach band ( $bands )   
Line 88: Line 57:
 
      
 
      
 
     #Check selfcal solution for bandpass source
 
     #Check selfcal solution for bandpass source
    #smagpplt vis=$vis.$band.pb yaxis=phase device=1/xs nxy=4,4
 
    #set text = "Press ENTER .."
 
    #if ($#argv > 0) set text = "$* >>"
 
    #printf "\n$text"
 
    #set junk = ($<)
 
    #smagpplt vis=$vis.$band.pb yaxis=amp device=1/xs nxy=4,4
 
    #set text = "Press ENTER .."
 
    #if ($#argv > 0) set text = "$* >>"
 
    #printf "\n$text"
 
    #set junk = ($<)
 
 
      
 
      
 
     #Apply selfcal phase solution from the bandpass calibrator to the bandpass calibrator
 
     #Apply selfcal phase solution from the bandpass calibrator to the bandpass calibrator
Line 109: Line 68:
 
   
 
   
 
     #Check selfcal solution for flux source
 
     #Check selfcal solution for flux source
    #smagpplt vis=$vis.$band.pb yaxis=phase device=1/xs nxy=4,4
 
    #set text = "press ENTER .."
 
    #if ($#argv > 0) set text = "$* >>"
 
    #printf "\n$text"
 
    #set junk = ($<)
 
    #smagpplt vis=$vis.$band.pb yaxis=amp device=1/xs nxy=4,4
 
    #set text = "Press ENTER .."
 
    #if ($#argv > 0) set text = "$* >>"
 
    #printf "\n$text"
 
    #set junk = ($<)
 
  
 
     #Apply selfcal phase solution from the flux calibrator to the flux calibrator
 
     #Apply selfcal phase solution from the flux calibrator to the flux calibrator

Revision as of 14:57, 7 December 2011

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) in this example.

  1. ! /bin/csh -f
  1. Set variable names

set flux=URANUS set pass=3C84 set vis=uvdata

  1. Correlator bands

set bands = ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 )

  1. Brightness temperature of URANUS at our observing frequencies for flux calibration
  2. Derived using function provided by A. Isella. He derived it from WMAP data (and references therein).
   #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 )

  1. C8 at center of this D-array

set refant=8

  1. Prepare data

rm -Rf $vis uvcat vis=c0800.4D_102HH211.2.miriad out=$vis select="-auto" options=nopass,nocal,nopol

  1. Flag visibility data

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  
 #set text = "Press ENTER .."
 #if ($#argv > 0) set text = "$* >>" 
 #printf "\n$text" 
 #set junk = ($<)
 #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 SOURCE 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
   
   #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 SOURCE 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
   #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

Personal tools