From d9cdaed941c6603ba06617bb3ec2c90dd7f6b402 Mon Sep 17 00:00:00 2001 From: Griffin Foster Date: Fri, 14 Feb 2014 15:41:34 +0200 Subject: [PATCH 1/2] lsm: added a verify function to assure sources are in real positions in the sky --- Pyxides/lsm.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Pyxides/lsm.py b/Pyxides/lsm.py index 2d76688..783e443 100644 --- a/Pyxides/lsm.py +++ b/Pyxides/lsm.py @@ -83,6 +83,7 @@ def pybdsm_search (image="${imager.RESTORED_IMAGE}",output="$PYBDSM_OUTPUT",pol= args = [] if select: args += [ "--select",select ]; + verifyGaulModel(gaul) tigger_convert(gaul,output,"-t","ASCII","--format", "name Isl_id Source_id Wave_id ra_d E_RA dec_d E_DEC i E_Total_flux Peak_flux E_Peak_flux Xposn E_Xposn Yposn E_Yposn Maj E_Maj Min E_Min PA E_PA emaj_d E_DC_Maj emin_d E_DC_Min pa_d E_DC_PA Isl_Total_flux E_Isl_Total_flux Isl_rms Isl_mean Resid_Isl_rms Resid_Isl_mean S_Code" + @@ -97,6 +98,26 @@ def pybdsm_search (image="${imager.RESTORED_IMAGE}",output="$PYBDSM_OUTPUT",pol= document_globals(pybdsm_search,"PYBDSM_* imager.RESTORED_IMAGE"); +def verifyGaulModel(gaullsm): + """Check all sources in a gaul file are in valid locations before running tigger + convert. Useful when images are 'all-sky' and have undefined regions. + """ + falseSources=0 + olsm='' + fh=open(gaullsm,'r') + for ll in fh.readlines(): + cll=' '.join(ll.split()) + if cll=='' or cll.startswith('#'): + olsm+=ll + continue + lineArray=cll.split(' ') + if math.isnan(float(lineArray[4])): falseSources+=1 + else: olsm+=ll + fh.close() + + fh=open(gaullsm,'w') + fh.write(olsm) + fh.close() def transfer_tags (fromlsm="$LSMREF",lsm="$LSM",output="$LSM",tags="dE",tolerance=60*ARCSEC): @@ -162,4 +183,4 @@ def pointify (lsm="$LSM",output="$LSM",name=""): document_globals(add_ccs,"MODEL_CC_*"); - \ No newline at end of file + From 27b4ae31edaf894fa7c1948a9a7a7936d6442d35 Mon Sep 17 00:00:00 2001 From: SpheMakh Date: Sun, 28 Sep 2014 17:13:09 +0200 Subject: [PATCH 2/2] imager.py: Fixed incorrect order of passing arguments to ms.copycol() on line 327 --- Pyxides/imager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pyxides/imager.py b/Pyxides/imager.py index 0cff3f5..850382b 100644 --- a/Pyxides/imager.py +++ b/Pyxides/imager.py @@ -324,7 +324,7 @@ def predict_vis (msname="$MS",image="$MODEL_IMAGE",column="MODEL_DATA",channeliz rm_fr(casaimage); if column != "MODEL_DATA": - ms.copycol(msname,"MODEL_DATA",column); + ms.copycol(msname=msname,fromcol="MODEL_DATA",tocol=column); document_globals(predict_vis,"MS MODEL_IMAGE COPY_IMAGE_TO ms.IFRS ms.DDID ms.FIELD ms.CHANRANGE");