Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ska-sa/pyxis
Browse files Browse the repository at this point in the history
  • Loading branch information
o-smirnov committed Oct 9, 2014
2 parents cb31c57 + 27b4ae3 commit 59e405a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Pyxides/imager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
21 changes: 21 additions & 0 deletions Pyxides/lsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -98,6 +99,26 @@ def pybdsm_search (image="${imager.RESTORED_IMAGE}",output="$PYBDSM_OUTPUT",pol=

document_globals(pybdsm_search,"PYBDSM_* imager.RESTORED_IMAGE CLUSTER_* MIN_EXTENT");

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):
Expand Down

0 comments on commit 59e405a

Please sign in to comment.