@@ -25,9 +25,10 @@ def __init__(self, imagename, psfname=None, sourcefinder_name='pybdsm',
2525 makeplots = True , do_psf_corr = True , do_local_var = True ,
2626 psf_corr_region = 5 , local_var_region = 10 , rel_excl_src = None ,
2727 pos_smooth = 2 , neg_smooth = 2 , loglevel = 0 , thresh_pix = 5 ,
28- thresh_isl = 3 , neg_thresh_isl = 3 , neg_thresh_pix = 5 ,
29- prefix = None , do_nearsources = False , increase_beam_cluster = False ,
30- savemask_pos = False , savemask_neg = False , ** kw ):
28+ thresh_isl = 3 , neg_thresh_isl = 3 , neg_thresh_pix = 5 , reset_rel = None ,
29+ prefix = None , do_nearsources = False , savefits = False ,
30+ increase_beam_cluster = False , savemask_pos = False , savemask_neg = False ,
31+ ** kw ):
3132
3233 """ Takes in image and extracts sources and makes
3334 reliability estimations..
@@ -89,6 +90,10 @@ def __init__(self, imagename, psfname=None, sourcefinder_name='pybdsm',
8990 savefits: boolean. Default is False.
9091 If True a negative image is saved.
9192
93+ reset_rel: boolean. Default is False. If true then
94+ sources with correlation < 0.002 and rel >0.60
95+ have their reliabilities set to 0.
96+
9297 increase_beam_cluster: boolean, optional. If True, sources
9398 groupings will be increase by 20% the beam size. If False,
9499 the actual beam size will be used. Default is False.
@@ -137,7 +142,8 @@ def __init__(self, imagename, psfname=None, sourcefinder_name='pybdsm',
137142 self .do_psf_corr = do_psf_corr
138143 self .savemaskpos = savemask_pos
139144 self .savemaskneg = savemask_neg
140- self .savefits = False
145+ self .savefits = savefits
146+ self .derel = reset_rel
141147
142148 if not self .psfname :
143149 self .log .info (" No psf provided, do_psf_corr is set to False." )
@@ -312,6 +318,9 @@ def params(self, modelfits, data_image):
312318 cf = (numpy .diag ((numpy .rot90 (c_region ))** 2 )
313319 .sum ())** 0.5 / 2 ** 0.5
314320 srs .setAttribute ("cf" , cf )
321+ #srs.setAttribute("ex", emaj)
322+ #srs.setAttribute("ey", emin)
323+ #srs.setAttribute("I_err", data["E_Total_flux"][i])
315324 corr .append (cf )
316325 model .sources .append (srs )
317326 peak .append (peak_flux )
@@ -320,6 +329,9 @@ def params(self, modelfits, data_image):
320329 loc .append (local )
321330 else :
322331 model .sources .append (srs )
332+ #srs.setAttribute("ex", emaj)
333+ #srs.setAttribute("ey", emin)
334+ #srs.setAttribute("I_err", data["E_Total_flux"][i])
323335 peak .append (peak_flux )
324336 total .append (flux )
325337 area .append (srcarea )
@@ -451,10 +463,10 @@ def get_reliability(self):
451463
452464 # remove sources with poor correlation and high reliability,
453465 # the values are currently arbitrary
454- if self .do_psf_corr :
466+ if self .do_psf_corr and self . derel :
455467 for s in pmodel .sources :
456468 cf , r = s .cf , s .rel
457- if cf < 0.01 and r > 0.70 :
469+ if cf < 0.002 and r > 0.60 :
458470 s .rel = 0.0
459471
460472 if self .makeplots :
0 commit comments