From jhibbard@cv3.cv.nrao.edu Thu Jan 3 17:04:38 2002 Date: Thu, 03 Jan 2002 19:00:35 -0500 From: John E. Hibbard To: aips2-naug@cv3.cv.nrao.edu Subject: successful log. [ Part 2: "Attached Text" ] #JEH> Continuation of test log from aips++ data reduction #JEH> of NGC 4038 D-array HI spectral line data. #JEH> Log 5. 01/03/02. Happy New Year. # #JEH> Well last we left our fearful tester, he was frustrated #JEH> by the strange amplitude levels of his bandpass, and #JEH> continuum flux measurements that were a factor of ~6 #JEH> lower than he found in his previous work on this system. #JEH> Result applied only if B and G corrections were both applied. #JEH> Also had problems flagging a baseline and getting statistics #JEH> to work. #JEH> Since then, the statistics problem seems to have evaporated, #JEH> the flagging problem is b/c of 0-based vs. 1-based indexing, #JEH> [so to flag ant. 8 w/23, need to say #JEH> fg.query('ANTENNA1==7 and ANTENNA2==22') instead of #JEH> fg.query('ANTENNA1==8 and ANTENNA2==23')], and George #JEH> says that I can get the proper flux scale by using the #JEH> gcal table with calibrator fluxes=1 (n4038D.gcal in previous #JEH> script) instead of the G table with fluxscale applied #JEH> (n4038D.gcalout in previous script). Also, can use cal.reset() #JEH> function instead of repeated cal.done()'s. So lets put this all #JEH> together and see if we can't get this right. #JEH> We remind the interested reader that fluxscale gave the #JEH> correct flux for the secondary flux calibrator, 1130-148. #JEH> Should be 5.335+/-0.002 Jy # #JEH> Using aips++ weekly (Ver 1.7, build 089) #JEH> Oh, Athol also told me how to make a copy of a ms - use tablecopy #JEH> with "deep" set to true. This is a global function under #JEH> utilities.table. include 'table.g' ok:=tablecopy(tablename="/export/data_1/jhibbard/aips++/n4038D_backup.ms" , newtablename="n4038D.ms" , deep=T); include 'flagger.g' fg:=flagger(msfile="n4038D.ms" ); fg.setchan(1:127); fg.setflagmode('flag'); fg.filter(column='DATA', operation='range', comparison='Amplitude', range=['0.00001Jy','5Jy']); #Want to flag baseline between ant 8 & 23: #something about 0 or 1 based indexing makes this not work: #fg.query('ANTENNA1==8 and ANTENNA2==23'); #That flags ant 9 w/24. So do this instead: fg.query('ANTENNA1==7 and ANTENNA2==22'); # fg.setantennas([4]); fg.setids(fieldid=[1]); fg.state(); fg.timerange('1996/06/03/00:57:30','1996/06/03/01:02:00'); # fg.setantennas([18]); fg.setids(fieldid=[3]); fg.state(); fg.timerange('1996/06/03/00:59:00','1996/06/03/02:56:00'); # fg.setantennas([10]); fg.setids(fieldid=[1]); fg.state(); fg.timerange('1996/06/03/00:56:00','1996/06/03/01:12:00'); # fg.setantennas([14]); fg.setids(fieldid=[1,2,3]); fg.state(); #fg.timerange('1996/06/03/00:56:00','1996/06/03/02:41:30'); #JEH> THIS FLAGS ANT 14 for whole run. If I was doing selfcal, #JEH> I would not want to do this: fg.timerange('1996/06/03/00:56:00','1996/06/03/04:23:30'); # fg.done(); # #JEH> Check that the above flags got applied: include 'msplot.g' mymsplot:=msplot('n4038D.ms', edit=F); #JEH> Yep, looks good. Done it. #JEH> The following lines are the same as before, except I have #JEH> replaced the cal.done's with cal.resets. include 'imager.g'; im:=imager('n4038D.ms'); im.setjy(fieldid=1); im.done(); include 'calibrater.g'; cal:=calibrater('n4038D.ms'); cal.setdata(msselect='FIELD_ID<=2'); #JEH> I would have thought that the line above should have been this: #cal.setdata(mode='channel',nchan=1,start=11,step=96,msselect='FIELD_ID<=2'); #but the two lines give the same result. George M. says this is a bug. #Probably uses all channels to calculate gains. Should flag channels #you are not interested in using. I'll work on that later. cal.setsolve(type='G',t=300.0,preavg=300.0,refant=24,table='n4038D.gcal'); cal.solve(); cal.plotcal(tablename='n4038D.gcal'); cal.fluxscale(tablein='n4038D.gcal', tableout='n4038D.gcalout', reference='1331+305', transfer=['1130-148']); cal.plotcal(tablename='n4038D.gcalout'); cal.reset(); #JEH> OK, THIS IS WHERE IT GETS DIFFERENT. Previously, we used the #JEH> table with the gains applied to the phase calibrator #JEH> (n4038D.gcalout in the above). George M. says to use the #JEH> calibration table with the fluxes of the phase cal set to 1 #JEH> for the 'B' solution in order to get a normalized bandpass table, #JEH> and then to use the gcalout and bcal for the total correction. #JEH> Lets give it a shot: cal.setdata(mode='channel', nchan=127, start=1, step=1, msselect='FIELD_ID<=2'); cal.setapply(type='G',t=0.0,table='n4038D.gcal'); cal.setsolve(type='B',t=86400.0,preavg=86400.0,refant=24,table='n4038D.bcal'); cal.solve(); cal.plotcal(tablename='n4038D.bcal'); #JEH> Well, that is **VERY** reassuring - the bpass plots all look #JEH> like the are normalized to 1, like good little bandpass plots #JEH> should. So lets apply the calibration, and see what we get for #JEH> fluxes. Note that in the "setapply" line, we specify the #JEH> file with the calibrated fluxes (gcalout): cal.reset(); cal.setdata(msselect='FIELD_ID IN [1:3]'); cal.setapply(type='G',t=0.0,table='n4038D.gcalout',select='FIELD_ID==2'); cal.setapply(type='B',t=0.0,table='n4038D.bcal'); cal.correct(); cal.done(); # First make a map of "ch 0" (ch 11-107) include 'imager.g' imagr:=imager('n4038D.ms'); imagr.setdata(fieldid=3, mode='channel', nchan=96, start=11, step=1, spwid=1); imagr.setimage(nx=256, ny=256, cellx='10arcsec', celly='10arcsec', stokes='I', fieldid=3, mode='channel', nchan=1, start=11, step=96, spwid=1); imagr.weight(robust=-1); imagr.make('n4038Dch0.model'); imagr.clean(algorithm='clark', niter=3000, gain=0.1, threshold='0.0Jy', model='n4038Dch0.model', image='n4038Dch0.restored', residual='n4038Dch0.residual'); imagr.restore(model='n4038Dch0.model', image='n4038Dch0.restored2'); imagr.done(); im:=image('n4038Dch0.restored2'); im.view(); #JEH> Looks good. Looks like AIPS map. #JEH> Lets compare fluxes between AIPS map and AIPS++: #JEH> aips++ AIPS #JEH> noise: 2.4 mJy/b 0.63 mJy/b #JEH> n4038 peak: 99.8 mJy/b 122.6 mJy/b #JEH> n4038 flux: 511.9 mJy 589.4 mJy #JEH> sw peak: 61.0 mJy/b 66.3 mJy/b #JEH> sw flux: 61.5 mJy 70.8 mJy #JEH> se peak: 105.6 mJy/b 113.3 mJy/b #JEH> se flux: 115.6 mJy 114.9 mJy #JEH> east peak: 30.7 mJy/b 32.3 mJy/b #JEH> east flux: 27.4 mJy 31.6 mJy #JEH> #JEH> Not perfect, but much better. Noise is high, #JEH> but it was high in AIPS before selfcal. #JEH> Tomorrow, I'll see what difference it makes to #JEH> flag the begining and end channels. Then #JEH> perhaps try selfcal.