######################################## ## spectline_flag.g ## ## Flagging commands for NGC4038 D-array HI data ## ## JHIBBARD 1/18/02 ## called by specline_doall.g ######################################### ######################################### ## ## Flagging ## ######################################### ## The data to be flagged were previously identified in AIPS ## You can do the same in aips++ with the msplot tool. We ## leave it the reader to do this step and flag their data ## as appropriate. ## REQUIRES "BASENAME" TO BE DEFINED FROM WITHOUT ## Set up some flagging parameters ## The following is for flagging ## outliers. However, the clipping ## is done on the DATA field, and ## before calibration, so the units ## really are not Jy. CLIP_HIGH := '5Jy'; # clip data points higher than this CLIP_LOW := '0.00001Jy'; # clip data points lower than this START_TIME := '1996/06/03/00:56:00'; END_TIME := '1996/06/03/04:23:30'; NCHAN := 127; include 'flagger.g' fg:=flagger(msfile=spaste(BASENAME,'.ms')); fg.setflagmode('flag'); #Here is an example of how you would flag a set of channels: #fg.setchan(1:BCHAN-1); #fg.query('ANTENNA1>=0'); #fg.setchan(ECHAN+1:NCHAN); #fg.query('ANTENNA1>=0'); # reset flagging scope to all channels fg.setchan(1:NCHAN); ## flag outliers ## Note: this clipping is done on the DATA field, and ## before calibration, so the units really are not Jy. ## Range specifies the range of valid data. fg.filter(column='DATA', operation='range', comparison='Amplitude', range=[CLIP_LOW,CLIP_HIGH]); ## flag bad baselines ## For these data, we need to flag baseline between ant 8 & 23. ## You would niavely think that the following would work: ## fg.query('ANTENNA1==8 and ANTENNA2==23'); ## But it doesn't; that would flag ant 9 w/24. ## NOTE!!!! THIS MAY CHANGE IN FURTHER RELEASES OF AIPS++!!! ## To get the desired result, do it as follows fg.query('ANTENNA1==7 and ANTENNA2==22'); ## flag bad antennaes ## In these data, Antenna 18 is at the center of the array, and ## is shadowed when on source until 02:57:00. Yet some scans still ## appear in the aips++ data, so flag these (it is unblocked ## when on the calibrators). fg.setantennas([18]); fg.setids(fieldid=[3]); fg.timerange(START_TIME,'1996/06/03/02:56:00'); ## Antenna 10 had high amplitudes and anomolous phase ## for the first scan. Behaved after that. fg.setantennas([10]); fg.setids(fieldid=[1]); fg.timerange(START_TIME, '1996/06/03/01:10:00'); ## Antenna 4 had some high amplitudes for parts of the first ## scan, so flag a short timerange. fg.setantennas([4]); fg.setids(fieldid=[1]); fg.timerange('1996/06/03/00:57:30','1996/06/03/01:02:00'); ## Antenna 14 has a low gains and phase jump, but gives us grief ## with the bandpass solution if we leave it in, so we flag it for ## the entire run. If we were self-calibrating the data, we would ## not necessarily want to flag all these data. fg.setantennas([14]); fg.setids(fieldid=[1,2,3]); #fg.timerange('1996/06/03/00:56:00','1996/06/03/02:41:30'); fg.timerange(START_TIME, END_TIME); fg.done(); ## Uncomment out the following if you want to check that your flags ## got applied (if you wanted to do interactive flagging, you would ## have edit=T and include the name of a flagfile. #include 'msplot.g' #mymsplot:=msplot(spaste(BASENAME,'.ms'), edit=F);