Commits
150 150 | isOK = False |
151 151 | |
152 152 | if(withPointing and not os.path.exists(asdmname+"/Pointing.bin")): |
153 153 | print "ASDM binary file "+asdmname+"/Pointing.bin doesn't exist." |
154 154 | isOK = False |
155 155 | |
156 156 | if (not isOK): |
157 157 | raise Exception |
158 158 | |
159 159 | |
160 - | def analyseASDM(basename, caltablename0, genwvr=True): |
160 + | def analyseASDM(basename, caltablename0, genwvr=True, select_real_spws=''): |
161 161 | # Reduction of NGC3256 Band 6 |
162 162 | # M. Zwaan, May 2010 |
163 163 | # D. Petry, May 2010 |
164 164 | |
165 165 | # We ignore flux calibration for now. |
166 166 | # The script does bandpass, gain calibration (gaincal), WVR correction and a delay corrections. |
167 167 | # Calibration tables are applied with applycal and images of the calibrator and the |
168 168 | # galaxy are made. |
169 169 | |
170 170 | isOK = True |
257 257 | ) |
258 258 | tget(plotcal) |
259 259 | subplot=223+i |
260 260 | yaxis="amp" |
261 261 | plotrange=[0,0,0,0.02] |
262 262 | figfile=caltablename+"_bandpass.png" |
263 263 | plotcal() |
264 264 | |
265 265 | # For GSPLINE solutions, have to do it for different spws separately |
266 266 | |
267 + | # There is a bug in VI/VB2 if phantom SPWs are present (for instance WVR) |
268 + | # The bug CAS-11734 is triggered by FreqAxisTVI class, which gets called |
269 + | # by gaincal. Once that bug is fixed there is no need to do this split |
270 + | # anymore. |
271 + | vissel = msn |
272 + | if select_real_spws!='' : |
273 + | os.system('rm -rf '+bname+'_spwsel.ms') |
274 + | split(vis=msn, outputvis=bname+'_spwsel.ms', spw='0;1;2;3;4', datacolumn='DATA') |
275 + | vissel = bname+'_spwsel.ms' |
276 + | |
267 277 | print ">> Find G solutions" |
268 278 | for i in range(2): |
269 279 | print ">> SPW: ",i |
270 280 | os.system('rm -rf '+caltablename+'_spw'+str(i)+'.G') |
271 281 | gaincal( |
272 - | vis=msn, |
282 + | vis=vissel, |
273 283 | caltable=caltablename+"_spw"+str(i)+".G", |
274 284 | field=calfield, |
275 285 | spw=avspw[i], |
276 286 | selectdata=True, |
277 287 | solint="60s", |
278 288 | gaintable=[caltablename+'_spw'+str(i)+'.K',caltablename+'_spw'+str(i)+'.B'], |
279 289 | spwmap=[[i],[i]], |
280 290 | combine="",refant="0",minblperant=2,minsnr=-1,solnorm=False, |
281 291 | gaintype="G",calmode="ap", |
282 292 | ) |
283 293 | |
284 294 | print ">> Find G solutions, using WVR corrections" |
285 295 | for i in range(2): |
286 296 | print ">> SPW: ",i |
287 297 | os.system('rm -rf '+caltablename+'_spw'+str(i)+'.G_WVR') |
288 298 | wvrspw = 0 |
289 299 | if(cu.compare_version('>=',[3,4,0])): |
290 300 | wvrspw = i |
291 301 | gaincal( |
292 - | vis=msn, |
302 + | vis=vissel, |
293 303 | caltable=caltablename+"_spw"+str(i)+".G_WVR", |
294 304 | field=calfield, |
295 305 | spw=avspw[i], |
296 306 | selectdata=True, |
297 307 | solint="60s", |
298 308 | # Pre-apply the WVR correction, the bandpass and the delay correction |
299 309 | gaintable=[caltablename0,caltablename+'_spw'+str(i)+'.K',caltablename+'_spw'+str(i)+'.B'], |
300 310 | spwmap=[[wvrspw],[i],[i]], |
301 311 | combine="",refant="0",minblperant=2,minsnr=-1,solnorm=False, |
302 312 | gaintype="G",calmode="ap", |
747 757 | # Now import an ASDM and do a serious analysis |
748 758 | |
749 759 | |
750 760 | print '===================================================================' |
751 761 | print "Serious analysis of an ASDM ..." |
752 762 | |
753 763 | rval = True |
754 764 | part3 = True |
755 765 | |
756 766 | try: |
757 - | rval = analyseASDM(myasdm_dataset2_name, mywvr_correction_file) |
767 + | rval = analyseASDM(myasdm_dataset2_name, mywvr_correction_file, select_real_spws='0;1;2;3;4') |
758 768 | except: |
759 769 | print myname, ': *** Unexpected error analysing ASDM, regression failed ***' |
760 770 | part3 = False |
761 771 | |
762 772 | if(not rval): |
763 773 | print myname, ': *** Unexpected error analysing ASDM, regression failed ***' |
764 774 | part3 = False |
765 775 | |
766 776 | ############# |
767 777 | # |
848 858 | else: |
849 859 | print "Part 4: serious analysis of an exported and re-imported ASDM passed." |
850 860 | else: |
851 861 | print "Part 4: serious analysis of an exported and re-imported ASDM not executed." |
852 862 | |
853 863 | if(not (part1 and part2 and part3 and part4)): |
854 864 | print "Regression failed." |
855 865 | raise |
856 866 | else: |
857 867 | print "Regression passed." |