caltype = 'antpos',
    antenna = 'DA52,DV22,DA63,DA48,DA61,DV11,DV10,DV04,DV15,DA50,DA43,DV16,DV17,DA62',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [3.80642939475e-05,0.000208067074874,-0.000100619093019,-0.000438846177427,0.000608006242819,0.000170992518114,-0.000578157130418,0.000314672396318,7.21083597271e-05,8.36793333292e-07,7.72997736931e-08,-1.10128894448e-06,-0.000476244700753,0.000646645340667,0.000222433784303,-0.000503372919646,0.000499006970657,0.000187546652871,-0.000411181905591,0.000281534048615,0.000194200978332,-0.000597593147508,0.000539165930576,0.000205271842583,4.27011400461e-07,-5.01982867718e-07,-5.47152012587e-07,7.03148543835e-07,1.39698386192e-08,1.25262886286e-07,3.88827174902e-07,-9.77888703346e-08,-6.7101791501e-07,1.17253512144e-06,9.49949026108e-08,-6.10016286373e-07,-2.06753611565e-07,-5.96046447754e-08,-1.28522515297e-07,5.33182173967e-07,-8.19563865662e-07,-7.23171979189e-07])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X95e355_X1f13.ms', tsystable = 'uid___A002_X95e355_X1f13.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X95e355_X1f13.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_X95e355_X1f13.ms.tsys', 'uid___A002_X95e355_X1f13.ms.wvr', 'uid___A002_X95e355_X1f13.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
Esempio n. 2
0
    caltype = 'antpos',
    antenna = 'DA46,DV18,PM02,DV08,DV09,DA44,DV13,DV12,DA41,DV14,DA43,DA42,DV03,DV17,DV10,DV16,DV15',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000247000250965,-0.000508999451995,-0.000311999581754,0.000508686011,0.000919706893087,0.000473518503357,0.00018812692387,0.000660056575273,0.000469934652856,0.000428024806118,0.000192386926053,-7.13865255571e-05,0.000397703996595,0.000303499271338,-0.000252154165917,0.000465348935348,0.000344158009965,0.000228367319351,0.000584870703864,0.000952647723338,-0.000227043112602,-0.000133162034778,0.00023574780856,0.000212197651384,0.00060776527971,-0.000525096431375,-0.000386487226933,0.000293836351762,0.000269524465858,-8.05776686625e-05,0.000478540400055,0.000105861353228,3.76092994824e-05,0.000157838716115,0.000211078409778,-0.00037259206194,0.000227385910925,-0.000120083500757,-7.74828167994e-07,-7.6349849694e-05,0.000854968838704,1.63702564808e-05,0.000486001936163,7.96910315645e-05,0.000160790103968,6.20906828402e-05,0.000561427652214,0.000133509319652,0.00023328837383,0.000377916222577,-0.000436685084871])

  timing()


# Application of the WVR, Tsys and antpos cal tables
mystep = 5
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms', tsystable = 'hpc-uid___A002_X47bd4d_Xbd4.ms.tsys')
  
  
  applycal(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['hpc-uid___A002_X47bd4d_Xbd4.ms.tsys', 'hpc-uid___A002_X47bd4d_Xbd4.ms.wvr.smooth', 'hpc-uid___A002_X47bd4d_Xbd4.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
  applycal(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms',
  # DV14     1.60241e-04   -9.06593e-05   -3.67151e-04    4.10726e-04      2015-06-18 07:40:18
  # DA63     7.35842e-05   -1.11237e-04   -3.48316e-04    3.72977e-04      2015-06-18 07:40:18
  # DV10     1.93743e-05    2.94065e-05   -3.65355e-04    3.67048e-04      2015-06-18 07:40:18
  # DA53    -2.70048e-05   -1.74361e-04   -2.25566e-04    2.86376e-04      2015-06-18 07:40:18
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_Xa4dcb9_Xbad.ms', tsystable = 'uid___A002_Xa4dcb9_Xbad.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_Xa4dcb9_Xbad.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_Xa4dcb9_Xbad.ms.tsys', 'uid___A002_Xa4dcb9_Xbad.ms.wvr', 'uid___A002_Xa4dcb9_Xbad.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM05,CM12',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X85b7b2_Xb3.ms', tsystable = 'uid___A002_X85b7b2_Xb3.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X85b7b2_Xb3.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X85b7b2_Xb3.ms.tsys', 'uid___A002_X85b7b2_Xb3.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
    caltype = 'antpos',
    antenna = 'CM12,CM02,CM03,CM05',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_Xa1e1bf_X290.ms', tsystable = 'uid___A002_Xa1e1bf_X290.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_Xa1e1bf_X290.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_Xa1e1bf_X290.ms.tsys', 'uid___A002_Xa1e1bf_X290.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
    caltype = 'antpos',
    antenna = 'DV19,DV18,DA64,DA49,DA62,DA61,DA60,DA45,DV10,DA47,DA46,DA41,DA43,DV16,DA51,DA63,DA57,DA54,DV11,DV07,DV04,DV20,DA53,DA50,DV12,DV24,DV25,DV08,DV15,DA58,DV05,DV02,DV17,DV13',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000568790779515,-0.000960048260564,-0.00102838046779,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000350542975176,-0.00136158594062,-0.00102771511075,0.00102918455377,-0.00232664868236,-0.00126710766926,0.000471355393529,-0.00119987875223,-0.000884058885276,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000490408856422,-0.00135660730302,-0.00102397520095,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000858597457409,-0.00189473666251,-0.00125291012228,0.00067268848631,-0.00138315141508,-0.000907520447897,0.000569481262685,-0.00104891929093,-0.000820085003252,0.000748454127461,-0.00149133522063,-0.000856994651258,0.00189472222701,-0.00622595380992,-0.00312222354114,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000382543263633,-0.00130245732194,-0.00111832579152,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000829665135942,-0.00124130951181,-0.00117025657789,0.000513039702663,-0.00117243510926,-0.00120666779938,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000661999452859,-0.00169800035655,-0.0011000004597,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000500225694647,-0.000744895727704,-0.000412322215341,0.00032130877439,-0.00116064453922,-0.000723131333211,0.000717123296325,-0.00148645733893,-0.000767197339289,0.000355394796746,-0.000718360463543,-0.00069032730126,0.000800814772724,-0.00122360248343,-0.00107297561125,0.000467471672268,-0.0012010330936,-0.00114111118815,0.000594357991325,-0.00133694808869,-0.000945342999283,0.000233996569865,-0.00104491981857,-0.000759456501754,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000550707336515,-0.000622102059424,-0.000776093453169])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X9ee74a_X26f0.ms', tsystable = 'uid___A002_X9ee74a_X26f0.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X9ee74a_X26f0.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_X9ee74a_X26f0.ms.tsys', 'uid___A002_X9ee74a_X26f0.ms.wvr', 'uid___A002_X9ee74a_X26f0.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
    caltype = 'antpos',
    antenna = 'DV19,DV20,DA64,DA49,DA48,DA61,DA60,DA45,DA44,DA47,DV12,DA41,DA50,DV17,DA51,DA63,DA62,PM02,PM04,DV11,DV10,DV13,DA52,DV22,DA46,DA57,DA54,DA59',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.00057431604709,-0.0011954347568,-0.000936748536314,0.000350542975176,-0.00136158594062,-0.00102771511075,-9.88165859491e-05,2.23514060329e-05,0.000206892960223,0.000471355393529,-0.00119987875223,-0.000884058885276,-0.000277784435574,0.000264455628235,-9.86561100355e-05,0.000228956807405,-0.000833646394312,-0.000312126707286,0.000500225694647,-0.000744895727704,-0.000412322215341,0.000407614279538,-0.00108007155359,-0.000530316960067,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000748454127461,-0.00149133522063,-0.000856994651258,0.000555722791109,-0.00126095405742,-0.000843223602917,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000429643783718,-0.00154094118625,-0.000735029578209,0.000426281282526,-0.00140672852102,-0.00109221844716,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000550707336515,-0.000622102059424,-0.000776093453169,0.000671388117899,-0.00192410811043,-0.0012088027029,0.000599960339188,-0.000518520008632,-0.000752280261638,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000382543263633,-0.00130245732194,-0.00111832579152,0.000584799989147,-0.00144563166359,-0.00100361699165])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X9cffbd_Xefe.ms', tsystable = 'uid___A002_X9cffbd_Xefe.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X9cffbd_Xefe.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_X9cffbd_Xefe.ms.tsys', 'uid___A002_X9cffbd_Xefe.ms.wvr', 'uid___A002_X9cffbd_Xefe.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        ])
    #  parameter = [-0.000221839660157,0.000346910921173,0.000264363344571,-0.000128212173825,-0.000122380614286,0.000122464785674,-0.000207690850126,0.000103665931555,1.07650085352e-05,-0.000246277335521,0.000261395039717,0.000111126536973,-0.000289658688066,0.000105918890098,0.000191924550667,-0.000234128898797,0.000229045253644,-0.000364768324463,8.14211870312e-05,-0.000458046852059,8.47860343533e-05,0.000110554889203,-0.000307305869212,-0.000286443221636,-0.000374110897902,2.71041790439e-05,0.000314648056643,-1.0021229211e-05,6.0101771253e-06,5.49677426861e-05,-0.00025095781748,0.000156579918409,3.07555360296e-05,-0.000127083060314,0.000112575746756,0.000194570288131,-8.72450817554e-07,0.000229284510995,0.000162461847359,3.96474638441e-05,-0.000310785704733,0.000200015810236,-0.000211115402606,1.05159365076e-06,3.76575801814e-06,-0.000324716975517,0.0002867266026,3.15395176378e-05,-0.000345673877515,0.000118807595051,4.41511694324e-05,-6.65575907608e-05,-0.00015163124275,2.30942034569e-07,-0.000100381419225,-0.000116473821503,-8.91763397926e-05,-0.000126692168962,-0.000107596628631,0.000271293309595,-0.000238965118247,0.000119352480187,0.000177109168973,-0.000367546660154,0.000111422764918,0.000179411315328,-0.000101462197537,-0.000100607334197,3.44323507292e-05,-5.85658339886e-05,0.000267330256411,0.000199575993287,-0.00025508289008,0.000193107674288,0.000330066880071,-0.00014279138017,0.000206464449675,-4.84567102646e-05,-0.000110757963056,-4.61881493877e-05,9.1920228872e-05,7.16563922017e-05,9.71289968133e-06,-0.000296396729126,-0.000281386521826,0.000326110698093,7.14663412003e-05,-9.74708950745e-05,-7.60311018594e-05,-9.55442105173e-05,-0.000258917375863,-0.000267744559472,-2.31007218331e-05,-5.64765679256e-05,0.000169737680127,0.000176299509983,0.000102295532779,6.15939281393e-05,-9.21456021188e-05,-0.000135090947074,0.000182340344215,0.00021442582608,-0.000187695036972,5.21095375799e-05,0.000182800900407])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xa8df68_Xb4b.ms',
                         tsystable='uid___A002_Xa8df68_Xb4b.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xa8df68_Xb4b.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_Xa8df68_Xb4b.ms.tsys',
                 'uid___A002_Xa8df68_Xb4b.ms.wvr',
                 'uid___A002_Xa8df68_Xb4b.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0
        ])
    #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000568790779515,-0.000960048260564,-0.00102838046779,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.00057431604709,-0.0011954347568,-0.000936748536314,0.000350542975176,-0.00136158594062,-0.00102771511075,0.00102918455377,-0.00232664868236,-0.00126710766926,0.000471355393529,-0.00119987875223,-0.000884058885276,-0.000277784435574,0.000264455628235,-9.86561100355e-05,0.000490408856422,-0.00135660730302,-0.00102397520095,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000858597457409,-0.00189473666251,-0.00125291012228,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000748454127461,-0.00149133522063,-0.000856994651258,0.00189472222701,-0.00622595380992,-0.00312222354114,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000429643783718,-0.00154094118625,-0.000735029578209,0.000382543263633,-0.00130245732194,-0.00111832579152,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000550707336515,-0.000622102059424,-0.000776093453169,0.000671388117899,-0.00192410811043,-0.0012088027029,0.000842965677077,-0.00253113766768,-0.00131821886442,0.000599960339188,-0.000518520008632,-0.000752280261638,0.000500225694647,-0.000744895727704,-0.000412322215341,0.00032130877439,-0.00116064453922,-0.000723131333211,0.000717123296325,-0.00148645733893,-0.000767197339289,0.000355394796746,-0.000718360463543,-0.00069032730126,0.000105242357187,-0.000608640570411,-0.00087232774936,0.000829665135942,-0.00124130951181,-0.00117025657789,0.000467471672268,-0.0012010330936,-0.00114111118815,0.000584799989147,-0.00144563166359,-0.00100361699165,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000426281282526,-0.00140672852102,-0.00109221844716,0.000661999452859,-0.00169800035655,-0.0011000004597,0.000594357991325,-0.00133694808869,-0.000945342999283])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X9d13e3_Xd4f.ms',
                         tsystable='uid___A002_X9d13e3_Xd4f.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X9d13e3_Xd4f.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_X9d13e3_Xd4f.ms.tsys',
                 'uid___A002_X9d13e3_Xd4f.ms.wvr',
                 'uid___A002_X9d13e3_Xd4f.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
Esempio n. 10
0
flagdata(vis=msfile + '.tsys', spw='17:0~3,19:0~3,21:0~3,23:0~3')

##### Water Vaper Calibration
os.system("rm -rf {}.wvr".format(msfile))
wvrgcal(
    vis=msfile,
    caltable=msfile + '.wvr',
)
#> Cycle0, the offset should be set -1

##### Antenna position caliration

# Apply the Tsys and WVR calibration
from recipes.almahelpers import tsysspwmap

tsysmap = tsysspwmap(vis=msfile, tsystable=msfile + '.tsys')
for field in np.unique([fcal, bcal, gcal, science_field]):
    applycal(vis=msfile,
             field=field,
             spw=science_spw,
             gaintable=[msfile + '.tsys', msfile + '.wvr'],
             gainfield=[field, field],
             interp='linear',
             spwmap=[tsysmap, []],
             calwt=True,
             flagbackup=False)
#> Check the calibrated data

splitmsfile = msfile + '.split'  # the msfile after priori calibration
os.system('rm -rf {0} {0}.flagversions'.format(splitmsfile))
split(vis=msfile,
    # DV16    -6.55585e-05   -3.62731e-04    1.75914e-04    4.08432e-04      2016-01-17 04:48:51
    # DA45    -1.41645e-05   -2.45379e-04   -2.15204e-04    3.26686e-04      2016-01-17 04:48:51
    # DV17    -9.94805e-07    6.84715e-05   -3.05240e-04    3.12827e-04      2016-01-17 04:48:51
    # DV21     1.64870e-04    1.51620e-04    1.80525e-04    2.87680e-04      2016-01-17 04:48:51
    # DV11    -1.59555e-04   -1.96314e-04   -1.86523e-05    2.53663e-04      2016-01-17 04:48:51
    # DA63    -1.82066e-04   -9.90175e-05   -2.58773e-05    2.08859e-04      2016-01-17 04:48:51

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xaeaf96_X515.ms',
                         tsystable='uid___A002_Xaeaf96_X515.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xaeaf96_X515.ms',
             field='0',
             spw='19,21,23,25',
             gaintable=[
                 'uid___A002_Xaeaf96_X515.ms.tsys',
                 'uid___A002_Xaeaf96_X515.ms.wvr',
                 'uid___A002_Xaeaf96_X515.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=True,
             flagbackup=False)
    caltype = 'antpos',
    antenna = 'DV20,DV18,DA64,DA63,DA62,DV11,DA44,DA47,DV12,DA41,DA50,DA42,DA51,DA57,DA54,DA55,DV07,DV10,DA58,DA52,DA53,DV22,DV23,DV24,DV25,DV08,DV09,DV06,DV15,DV04,DV02,DV03,DV01,DV16,DV13',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [-0.000221839660157,0.000346910921173,0.000264363344571,-0.000128212173825,-0.000122380614286,0.000122464785674,-0.000207690850126,0.000103665931555,1.07650085352e-05,-0.000246277335521,0.000261395039717,0.000111126536973,-0.000289658688066,0.000105918890098,0.000191924550667,-0.000234128898797,0.000229045253644,-0.000364768324463,8.14211870312e-05,-0.000458046852059,8.47860343533e-05,0.000110554889203,-0.000307305869212,-0.000286443221636,-0.000374110897902,2.71041790439e-05,0.000314648056643,-1.0021229211e-05,6.0101771253e-06,5.49677426861e-05,-0.00025095781748,0.000156579918409,3.07555360296e-05,-0.000127083060314,0.000112575746756,0.000194570288131,-8.72450817554e-07,0.000229284510995,0.000162461847359,3.96474638441e-05,-0.000310785704733,0.000200015810236,-0.000211115402606,1.05159365076e-06,3.76575801814e-06,-0.000324716975517,0.0002867266026,3.15395176378e-05,-0.000345673877515,0.000118807595051,4.41511694324e-05,-6.65575907608e-05,-0.00015163124275,2.30942034569e-07,-0.000100381419225,-0.000116473821503,-8.91763397926e-05,-0.000126692168962,-0.000107596628631,0.000271293309595,-0.000238965118247,0.000119352480187,0.000177109168973,-0.000367546660154,0.000111422764918,0.000179411315328,-0.000101462197537,-0.000100607334197,3.44323507292e-05,-5.85658339886e-05,0.000267330256411,0.000199575993287,-0.00025508289008,0.000193107674288,0.000330066880071,-0.00014279138017,0.000206464449675,-4.84567102646e-05,-0.000110757963056,-4.61881493877e-05,9.1920228872e-05,7.16563922017e-05,9.71289968133e-06,-0.000296396729126,-0.000281386521826,0.000326110698093,7.14663412003e-05,-9.74708950745e-05,-7.60311018594e-05,-9.55442105173e-05,-0.000258917375863,-0.000267744559472,-2.31007218331e-05,-5.64765679256e-05,0.000169737680127,0.000176299509983,0.000102295532779,6.15939281393e-05,-9.21456021188e-05,-0.000135090947074,0.000182340344215,0.00021442582608,-0.000187695036972,5.21095375799e-05,0.000182800900407])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_Xa8df68_Xb4b.ms', tsystable = 'uid___A002_Xa8df68_Xb4b.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_Xa8df68_Xb4b.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_Xa8df68_Xb4b.ms.tsys', 'uid___A002_Xa8df68_Xb4b.ms.wvr', 'uid___A002_Xa8df68_Xb4b.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
Esempio n. 13
0
    # DV17     3.14085e-04   -7.30734e-05   -5.97357e-04    6.78841e-04      2015-06-18 07:40:18
    # DV18    -1.65702e-04    4.36814e-04   -1.03487e-04    4.78511e-04      2015-06-18 07:40:18
    # DV14     1.60241e-04   -9.06593e-05   -3.67151e-04    4.10726e-04      2015-06-18 07:40:18
    # DA63     7.35842e-05   -1.11237e-04   -3.48316e-04    3.72977e-04      2015-06-18 07:40:18
    # DV10     1.93743e-05    2.94065e-05   -3.65355e-04    3.67048e-04      2015-06-18 07:40:18
    # DA53    -2.70048e-05   -1.74361e-04   -2.25566e-04    2.86376e-04      2015-06-18 07:40:18

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xa4ce71_X49f.ms',
                         tsystable='uid___A002_Xa4ce71_X49f.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xa4ce71_X49f.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_Xa4ce71_X49f.ms.tsys',
                 'uid___A002_Xa4ce71_X49f.ms.wvr',
                 'uid___A002_Xa4ce71_X49f.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
Esempio n. 14
0
    caltype = 'antpos',
    antenna = 'DV19,DV18,DA51,DA48,DV08,DA45,DA44,DA46,DV15,DV03,DA43,DA42,DV11,PM01,DV20,DV17,DV25,DV07,PM04',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [-0.000453608576208,0.00103624816984,-8.55620019138e-05,-0.000290210596096,0.000500840221623,0.000122694263593,0.000183368908713,-0.000450953651932,-0.000106764446923,-0.000279455019968,-0.000114494208283,-0.000351774029861,0.000681170379647,0.00049271482177,-0.000117141018864,-0.0008147232099,0.000443949533267,-4.03596724729e-05,0.000138477416171,-0.000600100629702,-0.000470491487109,-3.4172211787e-05,0.00029221096951,-6.70448300752e-05,-0.000176969249007,0.000250389621818,4.57407823213e-06,-0.000205369131134,0.000259081692311,0.000129727393741,-0.000183955207432,-0.000445721339222,6.14651886934e-05,-0.000324754071755,0.000268328647425,0.000213224130552,0.000203554357668,-0.000146355884478,-8.53907404398e-05,-0.000384319492324,0.000268677305476,9.47788654794e-05,0.000170314656522,-4.65931306241e-05,-8.45103422819e-05,0.000847928335973,-0.00116970769294,-0.000657849868993,6.39669597149e-05,0.000639797188342,-0.000138476956636,0.000463083386421,-0.000467116013169,-0.000287898816168,-0.000229949713758,0.000208240039609,4.43194657724e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X72ae5e_X72b.ms', tsystable = 'uid___A002_X72ae5e_X72b.ms.tsys', tsysChanTol=1)
  
  
  
  applycal(vis = 'uid___A002_X72ae5e_X72b.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_X72ae5e_X72b.ms.tsys', 'uid___A002_X72ae5e_X72b.ms.wvr.smooth', 'uid___A002_X72ae5e_X72b.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
Esempio n. 15
0
def fillsplitconcat(asdms,
                    outvis,
                    spw='',
                    intent='',
                    field='',
                    dotsys=False,
                    dowvr=False,
                    wvrtie=[],
                    cleanup=True):

    assert type(asdms) == type([]), "Please specify a list for asdms"
    #assert type(spw)==type(""), "Please specify a spw selection string"
    assert type(outvis) == type(
        "") and len(outvis) > 0, "Please specify a name for outvis"

    if len(glob.glob(outvis)) > 0:
        raise Exception, "Found " + outvis + " already generated."

    # a temporary space for the intermediate files
    tmpdir = './FILLSPLITCONCAT_TMP/'
    if len(glob.glob(tmpdir)) < 1:
        os.mkdir(tmpdir)

    splitlist = []
    for sdmpath in asdms:
        # fill
        assert len(sdmpath) > 0
        sdm = sdmpath.rstrip('/').split('/')[-1]
        assert len(sdm) > 0
        fillms = tmpdir + sdm + '.ms'
        # only fill if not already present
        if (len(glob.glob(fillms)) < 1):
            print 'Filling ' + sdmpath + ' to ' + fillms
            importasdm(asdm=sdmpath, vis=fillms)
        else:
            print 'Found ' + fillms + ' already filled.'

        if dotsys or dowvr:
            gaintable = []
            gainfield = []
            spwmap = []
            interp = []
            if dotsys:
                tsysname = fillms + '.tsys'
                if (len(glob.glob(tsysname)) < 1):
                    gencal(vis=fillms, caltable=tsysname, caltype='tsys')
                gaintable.append(tsysname)
                gainfield.append('nearest')
                spwmap.append(tsysspwmap(vis=fillms, tsystable=tsysname))
                interp.append('linear,linear')
            if dowvr:
                wvrname = fillms + '.wvr'
                if (len(glob.glob(wvrname)) < 1):
                    wvrgcal(vis=fillms, caltable=wvrname, tie=wvrtie)
                gaintable.append(wvrname)
                gainfield.append('nearest')
                spwmap.append([])
                interp.append('linear')

            applycal(vis=fillms,
                     spw=spw,
                     intent=intent,
                     field=field,
                     gaintable=gaintable,
                     gainfield=gainfield,
                     spwmap=spwmap,
                     interp=interp,
                     calwt=False)

        if (len(spw) > 0 or len(intent) > 0):
            # only split if spw and/or intent selection specified
            # and not already split
            splitms = tmpdir + sdm + '.split_' + spw.replace(
                '*', '') + '_' + intent.replace('*', '').replace(',',
                                                                 '-') + '.ms'
            if (len(glob.glob(splitms)) < 1):
                print '  Splitting spw=\'' + spw + '\' from ' + fillms + ' into ' + splitms
                dc = 'data'
                if dotsys or dowvr:
                    dc = 'corrected'
                if (split(vis=fillms,
                          outputvis=splitms,
                          spw=spw,
                          intent=intent,
                          field=field,
                          datacolumn=dc)):
                    # only if split successful (spw might not select anything or import failed)
                    splitlist.append(splitms)
                else:
                    print 'split failed on ' + str(
                        fillms) + '; continuing without it'
            else:
                splitlist.append(splitms)
                print '  Found ' + splitms + ' already split.'
        else:
            # the filled ms is what we will concat
            splitlist.append(fillms)

    if len(splitlist) > 1:
        print 'Concat-ing: ', splitlist, ' to ', outvis
        concat(vis=splitlist, concatvis=outvis)

    else:
        if len(splitlist[0]) > 0:
            print 'Renaming: ', splitlist[0], ' to ', outvis
            os.rename(splitlist[0], outvis)
        else:
            raise Exception, 'No data was generated by filling/splitting/concat-ing'

    # remove the temporary directory
    if cleanup:
        os.system('rm -Rf ' + tmpdir)
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        ])
    #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000568790779515,-0.000960048260564,-0.00102838046779,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000350542975176,-0.00136158594062,-0.00102771511075,0.00102918455377,-0.00232664868236,-0.00126710766926,0.000471355393529,-0.00119987875223,-0.000884058885276,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000490408856422,-0.00135660730302,-0.00102397520095,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000858597457409,-0.00189473666251,-0.00125291012228,0.00067268848631,-0.00138315141508,-0.000907520447897,0.000569481262685,-0.00104891929093,-0.000820085003252,0.000748454127461,-0.00149133522063,-0.000856994651258,0.00189472222701,-0.00622595380992,-0.00312222354114,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000382543263633,-0.00130245732194,-0.00111832579152,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000829665135942,-0.00124130951181,-0.00117025657789,0.000513039702663,-0.00117243510926,-0.00120666779938,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000661999452859,-0.00169800035655,-0.0011000004597,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000500225694647,-0.000744895727704,-0.000412322215341,0.00032130877439,-0.00116064453922,-0.000723131333211,0.000717123296325,-0.00148645733893,-0.000767197339289,0.000355394796746,-0.000718360463543,-0.00069032730126,0.000800814772724,-0.00122360248343,-0.00107297561125,0.000467471672268,-0.0012010330936,-0.00114111118815,0.000594357991325,-0.00133694808869,-0.000945342999283,0.000233996569865,-0.00104491981857,-0.000759456501754,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000550707336515,-0.000622102059424,-0.000776093453169])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X9ee74a_X26f0.ms',
                         tsystable='uid___A002_X9ee74a_X26f0.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X9ee74a_X26f0.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_X9ee74a_X26f0.ms.tsys',
                 'uid___A002_X9ee74a_X26f0.ms.wvr',
                 'uid___A002_X9ee74a_X26f0.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
    os.system('rm -rf {}.ms.antpos'.format(uidname))
    gencal(vis=msfile,
           caltable='{}.ms.antpos'.format(uidname),
           caltype='antpos',
           antenna=refer_antenna,
           parameter=[0, 0, 0])
    #  parameter = [8.01868736744e-07,-9.60193574429e-07,-5.20143657923e-07])

######################## Step 7 ###########################
# Application of the WVR, Tsys and antpos cal tables
runstep = 7
if runstep in runsteps:
    step2log(runstep)

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='{}.ms'.format(uidname),
                         tsystable='{}.ms.tsys'.format(uidname))

    applycal(vis=msfile,
             field='0',
             spw='16,18,20,22',
             gaintable=[msfile + '.tsys', msfile + '.antpos'],
             gainfield=['0', ''],
             interp=['linear', ''],
             spwmap=[tsysmap, []],
             calwt=True,
             flagbackup=False)

    # Note: J1256-0547 didn't have any Tsys measurement, and I couldn't find any close measurement. But this is not a science target, so this is probably Ok.

    applycal(vis=msfile,
             field='2',
    caltype = 'antpos',
    antenna = 'CM12,CM02,CM03,CM04,CM05',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-0.000372972339392,8.44690948725e-05,-0.000422492623329,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X9f852b_X134a.ms', tsystable = 'uid___A002_X9f852b_X134a.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X9f852b_X134a.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X9f852b_X134a.ms.tsys', 'uid___A002_X9f852b_X134a.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        ])
    #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.00057431604709,-0.0011954347568,-0.000936748536314,0.000350542975176,-0.00136158594062,-0.00102771511075,-9.88165859491e-05,2.23514060329e-05,0.000206892960223,0.000471355393529,-0.00119987875223,-0.000884058885276,-0.000277784435574,0.000264455628235,-9.86561100355e-05,0.000228956807405,-0.000833646394312,-0.000312126707286,0.000500225694647,-0.000744895727704,-0.000412322215341,0.000407614279538,-0.00108007155359,-0.000530316960067,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000748454127461,-0.00149133522063,-0.000856994651258,0.000555722791109,-0.00126095405742,-0.000843223602917,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000429643783718,-0.00154094118625,-0.000735029578209,0.000426281282526,-0.00140672852102,-0.00109221844716,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000550707336515,-0.000622102059424,-0.000776093453169,0.000671388117899,-0.00192410811043,-0.0012088027029,0.000599960339188,-0.000518520008632,-0.000752280261638,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000382543263633,-0.00130245732194,-0.00111832579152,0.000584799989147,-0.00144563166359,-0.00100361699165])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X9cffbd_Xefe.ms',
                         tsystable='uid___A002_X9cffbd_Xefe.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X9cffbd_Xefe.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_X9cffbd_Xefe.ms.tsys',
                 'uid___A002_X9cffbd_Xefe.ms.wvr',
                 'uid___A002_X9cffbd_Xefe.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
    gencal(vis='uid___A002_X85b7b2_Xb3.ms',
           caltable='uid___A002_X85b7b2_Xb3.ms.antpos',
           caltype='antpos',
           antenna='CM01,CM11,CM05,CM12',
           parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X85b7b2_Xb3.ms',
                         tsystable='uid___A002_X85b7b2_Xb3.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X85b7b2_Xb3.ms',
             field='0',
             spw='16,18,20,22',
             gaintable=[
                 'uid___A002_X85b7b2_Xb3.ms.tsys',
                 'uid___A002_X85b7b2_Xb3.ms.antpos'
             ],
             gainfield=['0', ''],
             interp='linear,linear',
             spwmap=[tsysmap, []],
             calwt=T,
             flagbackup=F)
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM05,CM12',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X85c183_X1434.ms', tsystable = 'uid___A002_X85c183_X1434.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X85c183_X1434.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X85c183_X1434.ms.tsys', 'uid___A002_X85c183_X1434.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
  # DV14     1.60241e-04   -9.06593e-05   -3.67151e-04    4.10726e-04      2015-06-18 07:40:18
  # DA63     7.35842e-05   -1.11237e-04   -3.48316e-04    3.72977e-04      2015-06-18 07:40:18
  # DV10     1.93743e-05    2.94065e-05   -3.65355e-04    3.67048e-04      2015-06-18 07:40:18
  # DA53    -2.70048e-05   -1.74361e-04   -2.25566e-04    2.86376e-04      2015-06-18 07:40:18
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_Xa4ce71_X49f.ms', tsystable = 'uid___A002_Xa4ce71_X49f.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_Xa4ce71_X49f.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['uid___A002_Xa4ce71_X49f.ms.tsys', 'uid___A002_Xa4ce71_X49f.ms.wvr', 'uid___A002_Xa4ce71_X49f.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
    # antenna x_offset y_offset z_offset total_offset baseline_date
    # DV03     9.42926e-04   -2.45067e-03   -1.61322e-03    3.08178e-03      2015-12-18 05:37:51
    # DA52     4.10999e-04   -1.98424e-03   -2.09411e-04    2.03715e-03      2015-12-16 10:36:49
    # DA59    -7.65598e-05    2.19242e-04   -7.63880e-05    2.44466e-04      2015-11-22 10:37:22
    # DA61    -4.65158e-05    1.85439e-04   -6.51274e-05    2.01973e-04      2015-11-22 10:37:22
    # DA54     3.51765e-05   -3.22489e-05    3.93549e-05    6.18562e-05      2015-11-22 10:37:22

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xaec9ef_X88a.ms',
                         tsystable='uid___A002_Xaec9ef_X88a.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xaec9ef_X88a.ms',
             field='0',
             spw='19,21,23,25',
             gaintable=[
                 'uid___A002_Xaec9ef_X88a.ms.tsys',
                 'uid___A002_Xaec9ef_X88a.ms.wvr',
                 'uid___A002_Xaec9ef_X88a.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=True,
             flagbackup=False)
Esempio n. 24
0
    gencal(vis='uid___A002_X9ff365_X2a83.ms',
           caltable='uid___A002_X9ff365_X2a83.ms.antpos',
           caltype='antpos',
           antenna='CM12,CM02,CM03,CM04,CM05',
           parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-0.000372972339392,8.44690948725e-05,-0.000422492623329,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X9ff365_X2a83.ms',
                         tsystable='uid___A002_X9ff365_X2a83.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X9ff365_X2a83.ms',
             field='0',
             spw='16,18,20,22',
             gaintable=[
                 'uid___A002_X9ff365_X2a83.ms.tsys',
                 'uid___A002_X9ff365_X2a83.ms.antpos'
             ],
             gainfield=['0', ''],
             interp='linear,linear',
             spwmap=[tsysmap, []],
             calwt=T,
             flagbackup=F)
Esempio n. 25
0
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM05,CM12',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X872bbc_X7c.ms', tsystable = 'uid___A002_X872bbc_X7c.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X872bbc_X7c.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X872bbc_X7c.ms.tsys', 'uid___A002_X872bbc_X7c.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
Esempio n. 26
0
  # DV17    -9.94805e-07    6.84715e-05   -3.05240e-04    3.12827e-04      2016-01-17 04:48:51
  # DV21     1.64870e-04    1.51620e-04    1.80525e-04    2.87680e-04      2016-01-17 04:48:51
  # DV11    -1.59555e-04   -1.96314e-04   -1.86523e-05    2.53663e-04      2016-01-17 04:48:51
  # DA63    -1.82066e-04   -9.90175e-05   -2.58773e-05    2.08859e-04      2016-01-17 04:48:51
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_Xaecf7b_X3943.ms', tsystable = 'uid___A002_Xaecf7b_X3943.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_Xaecf7b_X3943.ms',
    field = '0',
    spw = '19,21,23,25',
    gaintable = ['uid___A002_Xaecf7b_X3943.ms.tsys', 'uid___A002_Xaecf7b_X3943.ms.wvr', 'uid___A002_Xaecf7b_X3943.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = True,
    flagbackup = False)
  
  
  
Esempio n. 27
0
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM05,CM12',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X87436c_Xb7a.ms', tsystable = 'uid___A002_X87436c_Xb7a.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X87436c_Xb7a.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X87436c_Xb7a.ms.tsys', 'uid___A002_X87436c_Xb7a.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
Esempio n. 28
0
    gencal(vis='uid___A002_Xa1e1bf_X290.ms',
           caltable='uid___A002_Xa1e1bf_X290.ms.antpos',
           caltype='antpos',
           antenna='CM12,CM02,CM03,CM05',
           parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xa1e1bf_X290.ms',
                         tsystable='uid___A002_Xa1e1bf_X290.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xa1e1bf_X290.ms',
             field='0',
             spw='16,18,20,22',
             gaintable=[
                 'uid___A002_Xa1e1bf_X290.ms.tsys',
                 'uid___A002_Xa1e1bf_X290.ms.antpos'
             ],
             gainfield=['0', ''],
             interp='linear,linear',
             spwmap=[tsysmap, []],
             calwt=T,
             flagbackup=F)
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM05,CM12',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X87c075_X1066.ms', tsystable = 'uid___A002_X87c075_X1066.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X87c075_X1066.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X87c075_X1066.ms.tsys', 'uid___A002_X87c075_X1066.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
        parameter=[
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0
        ])
    #  parameter = [3.80642939475e-05,0.000208067074874,-0.000100619093019,0.000337375946255,-0.00068222664251,3.44278831377e-05,0.000356406336305,-0.000707597162912,0.000114816281422,-0.000578157130418,0.000314672396318,7.21083597271e-05,8.36793333292e-07,7.72997736931e-08,-1.10128894448e-06,-0.000476244700753,0.000646645340667,0.000222433784303,-0.000503372919646,0.000499006970657,0.000187546652871,-0.000411181905591,0.000281534048615,0.000194200978332,-0.000597593147508,0.000539165930576,0.000205271842583,4.27011400461e-07,-5.01982867718e-07,-5.47152012587e-07,-0.000438846177427,0.000608006242819,0.000170992518114,3.88827174902e-07,-9.77888703346e-08,-6.7101791501e-07,1.17253512144e-06,9.49949026108e-08,-6.10016286373e-07,-2.06753611565e-07,-5.96046447754e-08,-1.28522515297e-07,7.03148543835e-07,1.39698386192e-08,1.25262886286e-07,5.33182173967e-07,-8.19563865662e-07,-7.23171979189e-07])

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X95e355_X220a.ms',
                         tsystable='uid___A002_X95e355_X220a.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X95e355_X220a.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_X95e355_X220a.ms.tsys',
                 'uid___A002_X95e355_X220a.ms.wvr',
                 'uid___A002_X95e355_X220a.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
Esempio n. 31
0
def fillsplitconcat(asdms,outvis,spw='',intent='',field='',dotsys=False,dowvr=False,wvrtie=[],cleanup=True):

    assert type(asdms)==type([]), "Please specify a list for asdms"
    #assert type(spw)==type(""), "Please specify a spw selection string"
    assert type(outvis)==type("") and len(outvis)>0, "Please specify a name for outvis"

    if len(glob.glob(outvis))>0:
        raise Exception, "Found "+outvis+" already generated."

    # a temporary space for the intermediate files
    tmpdir='./FILLSPLITCONCAT_TMP/'
    if len(glob.glob(tmpdir))<1:
        os.mkdir(tmpdir)

    splitlist=[]
    for sdmpath in asdms:
        # fill
        assert len(sdmpath)>0
        sdm=sdmpath.rstrip('/').split('/')[-1]
        assert len(sdm)>0
        fillms=tmpdir+sdm+'.ms'
        # only fill if not already present
        if (len(glob.glob(fillms))<1):
            print 'Filling '+sdmpath+' to '+fillms
            importasdm(asdm=sdmpath,vis=fillms)
        else:
            print 'Found '+fillms+' already filled.'

        if dotsys or dowvr:
            gaintable=[]
            gainfield=[]
            spwmap=[]
            interp=[]
            if dotsys:
                tsysname=fillms+'.tsys'
                if (len(glob.glob(tsysname))<1):
                    gencal(vis=fillms,caltable=tsysname,caltype='tsys')
                gaintable.append(tsysname)
                gainfield.append('nearest')
                spwmap.append(tsysspwmap(vis=fillms,tsystable=tsysname))
                interp.append('linear,linear')
            if dowvr:
                wvrname=fillms+'.wvr'
                if (len(glob.glob(wvrname))<1):
                    wvrgcal(vis=fillms,caltable=wvrname,tie=wvrtie)
                gaintable.append(wvrname)
                gainfield.append('nearest')
                spwmap.append([])
                interp.append('linear')

            applycal(vis=fillms,spw=spw,intent=intent,field=field,
                     gaintable=gaintable,gainfield=gainfield,
                     spwmap=spwmap,interp=interp,calwt=False)


        if (len(spw)>0 or len(intent)>0):
            # only split if spw and/or intent selection specified
            # and not already split
            splitms=tmpdir+sdm+'.split_'+spw.replace('*','')+'_'+intent.replace('*','').replace(',','-')+'.ms'
            if (len(glob.glob(splitms))<1):
                print '  Splitting spw=\''+spw+'\' from '+fillms+' into '+splitms
                dc='data'
                if dotsys or dowvr:
                    dc='corrected'
                if (split(vis=fillms,outputvis=splitms,
                          spw=spw,intent=intent,field=field,
                          datacolumn=dc)):
                    # only if split successful (spw might not select anything or import failed)
                    splitlist.append(splitms)
                else:
                    print 'split failed on '+str(fillms)+'; continuing without it'
            else:
                splitlist.append(splitms)
                print '  Found '+splitms+' already split.'
        else:
            # the filled ms is what we will concat
            splitlist.append(fillms)
    
    if len(splitlist)>1:
        print 'Concat-ing: ',splitlist,' to ',outvis
        concat(vis=splitlist,concatvis=outvis)

    else:
        if len(splitlist[0])>0:
            print 'Renaming: ',splitlist[0],' to ',outvis
            os.rename(splitlist[0],outvis)
        else:
            raise Exception, 'No data was generated by filling/splitting/concat-ing'

    # remove the temporary directory
    if cleanup:
        os.system('rm -Rf '+tmpdir)
Esempio n. 32
0
os.system('rm -rf '+name+'.ms.tsyscal.afterflagging2/*png') 

plotbandpass(caltable=name+'.ms.tsyscal', xaxis='freq', yaxis='amp',
                 spw=spw, overlay='antenna', # all scans are plotted together, one plot per antenna
                 plotrange=[0, 0, 0, 180],  # [x0,x1,y0,y1]; x0=x1 -> automatic range determined by CASA
                 figfile=name+'.ms.tsyscal.afterflagging2/cal-tsys_per_spw_'+spw+'_overlayant_'+name+'_afterflagging.png', interactive=False) 
plotbandpass(caltable=name+'.ms.tsyscal', xaxis='freq', yaxis='amp',
                 spw=spw, overlay='time',
                 plotrange=[0, 0, 0, 180],  # [x0,x1,y0,y1]; x0=x1 -> automatic range determined by CASA
                 figfile=name+'.ms.tsyscal.afterflagging2/cal-tsys_per_spw_'+spw+'_overlayant_'+name+'_afterflagging.png', interactive=False) 

#===== 1.5 ## Apply newly determined WVR and Tsys caltables to all fields
##### J0423-0120 (0), J0423-013 (2), ngc_1614 (3)
# applycal reads the specificed gain calibration tables, applies them to the raw data column (with the specified selection), writes the calibrated results into the corrected column. It will overwrite existing corrected data (if existed)
from recipes.almahelpers import tsysspwmap
tsysmap = tsysspwmap(vis = name+'.ms', tsystable = name+'.ms.tsyscal', tsysChanTol = 1)

# Field 0
        applycal(vis=name+'.ms',
             field = '0', # field to which we want to apply the corrections field
             spw= '17, 19, 21, 23', # SpWs to which we want the corrections to be applied, exclude 1, 3, 5, 7, 11, 13, 15 due to the priori flagging
             gaintable = [name+'.ms.tsyscal', name+'.ms.wvr'], # Gain calibration tables to apply on the fly
             gainfield=['0',''],  # select a subset of calibrators from gaintable. Here I apply the Tsys from field to itself
             interp='linear,linear', # 'Time-interpolation, Frequency-interpolation'
             calwt = T, # applying the weights estimated from the Tsys measurements
             flagbackup=F, # backup the state of the flags before applying calibration. Default is True but we don't need its backup here. why?
             spwmap = [tsysmap,[]])  # tsysmap = [0,17,17,19,19,21,21,23,23] -> we apply Tsys SpW-0 solutions to SpW-0; apply Tsys SpW-17 solutions to SpW-1, apply Tsys SpW-19 solutions to SpW-2, etc. ; for the WVR we use all fields

# Field 1
        applycal(vis=name+'.ms',
             field = '1', # field to which we want to apply the corrections field
Esempio n. 33
0
    # DV17     3.14085e-04   -7.30734e-05   -5.97357e-04    6.78841e-04      2015-06-18 07:40:18
    # DV18    -1.65702e-04    4.36814e-04   -1.03487e-04    4.78511e-04      2015-06-18 07:40:18
    # DV14     1.60241e-04   -9.06593e-05   -3.67151e-04    4.10726e-04      2015-06-18 07:40:18
    # DA63     7.35842e-05   -1.11237e-04   -3.48316e-04    3.72977e-04      2015-06-18 07:40:18
    # DV10     1.93743e-05    2.94065e-05   -3.65355e-04    3.67048e-04      2015-06-18 07:40:18
    # DA53    -2.70048e-05   -1.74361e-04   -2.25566e-04    2.86376e-04      2015-06-18 07:40:18

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xa4dcb9_Xbad.ms',
                         tsystable='uid___A002_Xa4dcb9_Xbad.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_Xa4dcb9_Xbad.ms',
             field='0',
             spw='17,19,21,23',
             gaintable=[
                 'uid___A002_Xa4dcb9_Xbad.ms.tsys',
                 'uid___A002_Xa4dcb9_Xbad.ms.wvr',
                 'uid___A002_Xa4dcb9_Xbad.ms.antpos'
             ],
             gainfield=['0', '', ''],
             interp='linear,linear',
             spwmap=[tsysmap, [], []],
             calwt=T,
             flagbackup=F)
Esempio n. 34
0
def gen_tsys_and_flag(filename, spws_info, pipeline, doplots=False):

    print "========================================================"
    print " Step 2  Generate Tsys and apply flagging"
    print "========================================================"

    if checkdir(os.getcwd(), path_galaxy) == False:
        os.chdir('../' + path_galaxy + 'calibration')
    if os.path.isdir("plots/") == False:
        os.system('mkdir plots')  # folder containing all plots

    # 2.1 Generation of the Tsys cal table
    print " 2.1 Generating Tsys calibration table"

    os.system('rm -Rf ' + filename + '.tsys')
    gencal(vis=filename, caltable=filename + '.tsys', caltype='tsys')

    # 2.2 Create png plots of CASA Tsys and bandpass solution
    print " 2.2 Create plots of Tsys and bandpass solution"
    #os.system('rm -rf plots/'+filename+'.tsys.plots.overlayTime/'+filename+'.tsys')

    if doplots == True:
        os.system('rm -Rf plots/' + filename + '.tsys.plots.overlayTime/' +
                  filename + '.tsys')
        plotbandpass(caltable=filename + '.tsys',
                     overlay='time',
                     xaxis='freq',
                     yaxis='amp',
                     subplot=22,
                     buildpdf=False,
                     interactive=False,
                     showatm=True,
                     pwv='auto',
                     chanrange='92.1875%',
                     showfdm=True,
                     field='',
                     figfile='plots/' + filename + '.tsys.plots.overlayTime/' +
                     filename + '.tsys')

        # Create png plots for Tsys per source with antennas
        es.checkCalTable(filename + '.tsys',
                         msName=filename,
                         interactive=False)
        os.system('rm -rf plots/' + filename + '.tsys.plots')
        os.system('mv ' + filename + '.tsys.plots  plots/.')

    # 2.3 Do initial flagging
    print "2.3 Initial flagging, reading flags in file file_flags.py. You can modify this file to add more flags"
    extract_flagging(
        filename, pipeline
    )  # Extract flags from original ALMA calibration script (sdflag entries)
    if os.path.exists('../script/file_flags.py'):
        execfile('../script/file_flags.py')

    # 2.4 Create Tsys map
    print "2.4 Creating Tsysmaps"
    # Read spws and frquencies for science and tsys
    spws_scie, spws_tsys, freq_rep_scie, freq_rep_tsys = spws_info[0:4]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis=filename,
                         tsystable=filename + '.tsys',
                         trim=False)

    print "Spectral windows for science are: ", spws_scie, freq_rep_scie
    print "Spectral windows for tsys are   : ", spws_tsys, freq_rep_tsys
    print "Original map between science and tsys spws: (they should have the same frequency)"
    for i in range(len(spws_scie)):
        print spws_scie[i], tsysmap[spws_scie[i]]

    tsysmap = get_tsysmap(tsysmap, spws_scie, spws_tsys, freq_rep_scie,
                          freq_rep_tsys)

    spwmap = {}
    for i in spws_scie:
        if not tsysmap[i] in spwmap.keys():
            spwmap[tsysmap[i]] = []
        spwmap[tsysmap[i]].append(i)

    return spwmap
    caltype = 'antpos',
    antenna = 'CM01,CM11,CM12',
    parameter = [0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000360958191864,-0.000491564156966,-1.53252508184e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X85dcf7_Xc7c.ms', tsystable = 'uid___A002_X85dcf7_Xc7c.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X85dcf7_Xc7c.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X85dcf7_Xc7c.ms.tsys', 'uid___A002_X85dcf7_Xc7c.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
        caltype="antpos",
        antenna="CM12,CM02,CM03,CM05",
        parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    )
    #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])


# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if mystep in thesteps:
    casalog.post("Step " + str(mystep) + " " + step_title[mystep], "INFO")
    print "Step ", mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap

    tsysmap = tsysspwmap(vis="uid___A002_Xa1e1bf_X6f1.ms", tsystable="uid___A002_Xa1e1bf_X6f1.ms.tsys", tsysChanTol=1)

    applycal(
        vis="uid___A002_Xa1e1bf_X6f1.ms",
        field="0",
        spw="16,18,20,22",
        gaintable=["uid___A002_Xa1e1bf_X6f1.ms.tsys", "uid___A002_Xa1e1bf_X6f1.ms.antpos"],
        gainfield=["0", ""],
        interp="linear,linear",
        spwmap=[tsysmap, []],
        calwt=T,
        flagbackup=F,
    )

    # Note: J1517-2422 didn't have any Tsys measurement, and I couldn't find any close measurement. But this is not a science target, so this is probably Ok.
            0,
            0,
        ],
    )
    #  parameter = [0.000763224595131,-0.000872836862611,-0.00100151686389,0.000568790779515,-0.000960048260564,-0.00102838046779,0.000376327428967,-0.00146782677621,-0.00112532451749,0.000575381331146,-0.00161136779934,-0.00117099285126,0.00057431604709,-0.0011954347568,-0.000936748536314,0.000350542975176,-0.00136158594062,-0.00102771511075,0.00102918455377,-0.00232664868236,-0.00126710766926,0.000471355393529,-0.00119987875223,-0.000884058885276,-0.000277784435574,0.000264455628235,-9.86561100355e-05,0.000490408856422,-0.00135660730302,-0.00102397520095,0.000566912652314,-0.000942276669298,-0.00089417600233,0.000858597457409,-0.00189473666251,-0.00125291012228,-0.000144578050822,-0.000582538545132,-0.000986936502159,0.000469437917569,-0.000701300406205,-0.000656311497542,0.000748454127461,-0.00149133522063,-0.000856994651258,0.00189472222701,-0.00622595380992,-0.00312222354114,0.000670030074481,-0.00150872308554,-0.000943140154195,0.000429643783718,-0.00154094118625,-0.000735029578209,0.000382543263633,-0.00130245732194,-0.00111832579152,0.00037343815848,-0.0013356736041,-0.000845442467062,0.000297389547474,-0.00103880338778,-0.000898549931055,0.000550707336515,-0.000622102059424,-0.000776093453169,0.000671388117899,-0.00192410811043,-0.0012088027029,0.000842965677077,-0.00253113766768,-0.00131821886442,0.000599960339188,-0.000518520008632,-0.000752280261638,0.000500225694647,-0.000744895727704,-0.000412322215341,0.00032130877439,-0.00116064453922,-0.000723131333211,0.000717123296325,-0.00148645733893,-0.000767197339289,0.000355394796746,-0.000718360463543,-0.00069032730126,0.000105242357187,-0.000608640570411,-0.00087232774936,0.000829665135942,-0.00124130951181,-0.00117025657789,0.000467471672268,-0.0012010330936,-0.00114111118815,0.000584799989147,-0.00144563166359,-0.00100361699165,0.000449148240922,-0.00121965529975,-0.000785080128059,0.000514037961512,-0.00116958478532,-0.000836663256079,0.000426281282526,-0.00140672852102,-0.00109221844716,0.000661999452859,-0.00169800035655,-0.0011000004597,0.000594357991325,-0.00133694808869,-0.000945342999283])


# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if mystep in thesteps:
    casalog.post("Step " + str(mystep) + " " + step_title[mystep], "INFO")
    print "Step ", mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap

    tsysmap = tsysspwmap(vis="uid___A002_X9d13e3_Xd4f.ms", tsystable="uid___A002_X9d13e3_Xd4f.ms.tsys", tsysChanTol=1)

    applycal(
        vis="uid___A002_X9d13e3_Xd4f.ms",
        field="0",
        spw="17,19,21,23",
        gaintable=[
            "uid___A002_X9d13e3_Xd4f.ms.tsys",
            "uid___A002_X9d13e3_Xd4f.ms.wvr",
            "uid___A002_X9d13e3_Xd4f.ms.antpos",
        ],
        gainfield=["0", "", ""],
        interp="linear,linear",
        spwmap=[tsysmap, [], []],
        calwt=T,
        flagbackup=F,
Esempio n. 38
0
    gencal(vis='uid___A002_X85dcf7_Xefe.ms',
           caltable='uid___A002_X85dcf7_Xefe.ms.antpos',
           caltype='antpos',
           antenna='CM01,CM11,CM12',
           parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0])
    #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000360958191864,-0.000491564156966,-1.53252508184e-05])

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X85dcf7_Xefe.ms',
                         tsystable='uid___A002_X85dcf7_Xefe.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X85dcf7_Xefe.ms',
             field='0',
             spw='16,18,20,22',
             gaintable=[
                 'uid___A002_X85dcf7_Xefe.ms.tsys',
                 'uid___A002_X85dcf7_Xefe.ms.antpos'
             ],
             gainfield=['0', ''],
             interp='linear,linear',
             spwmap=[tsysmap, []],
             calwt=T,
             flagbackup=F)
    caltype = 'antpos',
    antenna = 'CM12,CM02,CM03,CM04,CM05',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [-1.26590310937e-05,0.000133968636039,-5.30862834409e-05,9.85723924856e-05,-0.000690061029368,-0.00037334201369,0.000443109311163,-0.000620041042566,-0.000481208786368,-0.000372972339392,8.44690948725e-05,-0.000422492623329,-8.22705465483e-05,0.000106050712869,1.76862508909e-05])
  

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]

  
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'uid___A002_X9ff365_X2a83.ms', tsystable = 'uid___A002_X9ff365_X2a83.ms.tsys', tsysChanTol = 1)
  
  
  
  applycal(vis = 'uid___A002_X9ff365_X2a83.ms',
    field = '0',
    spw = '16,18,20,22',
    gaintable = ['uid___A002_X9ff365_X2a83.ms.tsys', 'uid___A002_X9ff365_X2a83.ms.antpos'],
    gainfield = ['0', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[]],
    calwt = T,
    flagbackup = F)
  
  
  
        caltype='antpos',
        antenna='DA42',
        #  parameter = [])
        parameter=[0, 0, 0])

    # antenna x_offset y_offset z_offset total_offset baseline_date

# Application of the WVR, Tsys and antpos cal tables
mystep = 7
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_Xd90607_X10f75.ms',
                         tsystable='uid___A002_Xd90607_X10f75.ms.tsys',
                         tsysChanTol=1)

    # but seems not to be as good (due to non-standard LO settings) as
    tsysmap = [
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
        20, 21, 22, 23, 24, 21, 21, 23, 23, 21, 21, 23, 23, 33, 34, 35, 36, 37,
        38, 39, 40, 41, 42, 43, 44, 41, 41, 43, 43, 41, 41, 43, 43, 53, 54, 55,
        56, 57, 58, 59, 60, 61, 62, 63, 64, 61, 61, 63, 63, 61, 61, 63, 63
    ]

    # Note: J1832-2039 didn't have any Tsys measurement, and I couldn't find any close measurement. But this is not a science target, so this is probably Ok.

    applycal(vis='uid___A002_Xd90607_X10f75.ms',
             field='1',
             spw='25,27,29,31,45,47,49,51,65,67,69,71',
    caltype = 'antpos',
    antenna = 'DA46,DV18,PM02,DV08,DV09,DA44,DV13,DV12,DA41,DV14,DA43,DA42,DV03,DV17,DV10,DV16,DV15',
    parameter = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
  #  parameter = [0.000247000250965,-0.000508999451995,-0.000311999581754,0.000508686011,0.000919706893087,0.000473518503357,0.00018812692387,0.000660056575273,0.000469934652856,0.000428024806118,0.000192386926053,-7.13865255571e-05,0.000397703996595,0.000303499271338,-0.000252154165917,0.000465348935348,0.000344158009965,0.000228367319351,0.000584870703864,0.000952647723338,-0.000227043112602,-0.000133162034778,0.00023574780856,0.000212197651384,0.00060776527971,-0.000525096431375,-0.000386487226933,0.000293836351762,0.000269524465858,-8.05776686625e-05,0.000478540400055,0.000105861353228,3.76092994824e-05,0.000157838716115,0.000211078409778,-0.00037259206194,0.000227385910925,-0.000120083500757,-7.74828167994e-07,-7.6349849694e-05,0.000854968838704,1.63702564808e-05,0.000486001936163,7.96910315645e-05,0.000160790103968,6.20906828402e-05,0.000561427652214,0.000133509319652,0.00023328837383,0.000377916222577,-0.000436685084871])

  timing()


# Application of the WVR, Tsys and antpos cal tables
mystep = 5
if(mystep in thesteps):
  casalog.post('Step '+str(mystep)+' '+step_title[mystep],'INFO')
  print 'Step ', mystep, step_title[mystep]
  
  from recipes.almahelpers import tsysspwmap
  tsysmap = tsysspwmap(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms', tsystable = 'hpc-uid___A002_X47bd4d_Xbd4.ms.tsys')
  
  
  applycal(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms',
    field = '0',
    spw = '17,19,21,23',
    gaintable = ['hpc-uid___A002_X47bd4d_Xbd4.ms.tsys', 'hpc-uid___A002_X47bd4d_Xbd4.ms.wvr.smooth', 'hpc-uid___A002_X47bd4d_Xbd4.ms.antpos'],
    gainfield = ['0', '', ''],
    interp = 'linear,linear',
    spwmap = [tsysmap,[],[]],
    calwt = T,
    flagbackup = F)
  
  
  
  applycal(vis = 'hpc-uid___A002_X47bd4d_Xbd4.ms',
Esempio n. 42
0
    gencal(vis='uid___A002_X85c183_X1434.ms',
           caltable='uid___A002_X85c183_X1434.ms.antpos',
           caltype='antpos',
           antenna='CM01,CM11,CM05,CM12',
           parameter=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    #  parameter = [0.000254319605787,-0.000394619449271,-6.89422103618e-05,0.000187085476452,-0.00047325931429,-0.00032447903775,0.000164579600096,-0.000295721925795,-0.000169022008777,0.000360958191864,-0.000491564156966,-1.53252508184e-05])

# Application of the WVR, Tsys and antpos cal tables
mystep = 8
if (mystep in thesteps):
    casalog.post('Step ' + str(mystep) + ' ' + step_title[mystep], 'INFO')
    print 'Step ', mystep, step_title[mystep]

    from recipes.almahelpers import tsysspwmap
    tsysmap = tsysspwmap(vis='uid___A002_X85c183_X1434.ms',
                         tsystable='uid___A002_X85c183_X1434.ms.tsys',
                         tsysChanTol=1)

    applycal(vis='uid___A002_X85c183_X1434.ms',
             field='0',
             spw='16,18,20,22',
             gaintable=[
                 'uid___A002_X85c183_X1434.ms.tsys',
                 'uid___A002_X85c183_X1434.ms.antpos'
             ],
             gainfield=['0', ''],
             interp='linear,linear',
             spwmap=[tsysmap, []],
             calwt=T,
             flagbackup=F)