|
13 | 13 | class load(object): |
14 | 14 |
|
15 | 15 |
|
16 | | - def __init__(self, imagename, psfname, poscatalog, negcatalog, |
| 16 | + def __init__(self, imagename, poscatalog, negcatalog, psfname=None, |
17 | 17 | snr_thresh=100, local_thresh=0.6, local_region=10, |
18 | 18 | psfcorr_region=2, high_corr_thresh=0.5, negdetec_region=10, |
19 | 19 | negatives_thresh=10, phasecenter_excl_radius=None, |
@@ -60,13 +60,17 @@ def __init__(self, imagename, psfname, poscatalog, negcatalog, |
60 | 60 | """ |
61 | 61 |
|
62 | 62 | # image, psf image, positive and negative catalogues |
| 63 | + self.loglevel = loglevel |
| 64 | + self.prefix = prefix |
| 65 | + self.log = utils.logger(self.loglevel, prefix=self.prefix) |
63 | 66 | self.imagename = imagename |
| 67 | + |
64 | 68 | self.psfname = psfname |
| 69 | + if not self.psfname: |
| 70 | + self.log.info("dE tagging will be made without the PSF correlation" |
| 71 | + " note that this might affect the results.") |
65 | 72 | self.poscatalog = poscatalog |
66 | 73 | self.negcatalog = negcatalog |
67 | | - self.loglevel = loglevel |
68 | | - self.prefix = prefix |
69 | | - self.log = utils.logger(self.loglevel, prefix=self.prefix) |
70 | 74 |
|
71 | 75 | # reading the imagename data |
72 | 76 | self.imagedata, self.wcs, self.header, self.pixsize =\ |
@@ -126,8 +130,12 @@ def number_negatives(self): |
126 | 130 |
|
127 | 131 | pmodel = Tigger.load(self.poscatalog, verbose=self.loglevel) |
128 | 132 | nmodel = Tigger.load(self.negcatalog, verbose=self.loglevel) |
129 | | - psources = pmodel.sources |
130 | | - sources = filter(lambda src: src.getTag(self.high_corr_tag), psources) |
| 133 | + psources = pmodel.sources |
| 134 | + if not self.psfname: |
| 135 | + sources = filter(lambda src: src.getTag(self.high_local_tag), psources) |
| 136 | + |
| 137 | + else: |
| 138 | + sources = filter(lambda src: src.getTag(self.high_corr_tag), psources) |
131 | 139 |
|
132 | 140 | tolerance = numpy.deg2rad(self.negdetec_region * self.bmaj_deg) |
133 | 141 |
|
@@ -158,13 +166,14 @@ def source_selection(self): |
158 | 166 | high_local_tag=self.high_local_tag, neg_side=True, |
159 | 167 | setatr=False, prefix=self.prefix, do_high_loc=True) |
160 | 168 | # correlation |
161 | | - utils.psf_image_correlation( |
162 | | - catalog=self.poscatalog, psfimage=self.psfname, |
163 | | - imagedata=self.imagedata, header=self.header, |
164 | | - wcs=self.wcs, pixelsize=self.pixsize, corr_region= |
165 | | - self.psfcorr_region, thresh=self.high_corr_thresh, |
166 | | - tags=self.high_local_tag, coefftag=self.high_corr_tag, |
167 | | - setatr=False, do_high=True, prefix=self.prefix) |
| 169 | + if self.psfname: |
| 170 | + utils.psf_image_correlation( |
| 171 | + catalog=self.poscatalog, psfimage=self.psfname, |
| 172 | + imagedata=self.imagedata, header=self.header, |
| 173 | + wcs=self.wcs, pixelsize=self.pixsize, corr_region= |
| 174 | + self.psfcorr_region, thresh=self.high_corr_thresh, |
| 175 | + tags=self.high_local_tag, coefftag=self.high_corr_tag, |
| 176 | + setatr=False, do_high=True, prefix=self.prefix) |
168 | 177 | # number of negative detections |
169 | 178 | self.number_negatives() |
170 | 179 |
|
|
0 commit comments