Skip to content

Commit

Permalink
srcpix
Browse files Browse the repository at this point in the history
  • Loading branch information
dstndstn committed Apr 18, 2016
1 parent 8ceed4a commit d9ac0d4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions py/legacypipe/oneblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def __init__(self, name, blobwcs, blobmask, timargs, srcs, bands,

alphas = [0.1, 0.3, 1.0]
self.optargs = dict(priors=True, shared_params=False, alphas=alphas,
print_progress=False)
print_progress=True)
#print_progress=False)
self.blobh,self.blobw = blobmask.shape
self.bigblob = (self.blobw * self.blobh) > 100*100
if self.bigblob:
Expand Down Expand Up @@ -306,8 +307,8 @@ def run_model_selection(self, cat, Ibright, B):
srcwcs = self.blobwcs.get_subimage(xl, yl, 1+xh-xl, 1+yh-yl)
# A mask for which pixels in the 'srcwcs' square are occupied.
srcpix = insrc[yl:yh+1, xl:xh+1]
from scipy.ndimage.morphology import binary_erosion
srcpix2 = binary_erosion(srcpix)
# from scipy.ndimage.morphology import binary_erosion
# srcpix2 = binary_erosion(srcpix)
else:
modelMasks = models.model_masks(i, src)
srctims = self.tims
Expand Down Expand Up @@ -372,8 +373,8 @@ def run_model_selection(self, cat, Ibright, B):
# If lots of exposures, cut to a subset that reach the DECaLS
# depth goals and use those in an initial round?
if self.many_exposures:
dtims,insubset = self._get_todepth_subset(srctims, srcwcs)

dtims,insubset = self._get_todepth_subset(srctims, srcwcs,
srcpix)
allflags = {}
for name,newsrc in trymodels:

Expand Down Expand Up @@ -668,7 +669,7 @@ def run_model_selection(self, cat, Ibright, B):
del models


def _get_todepth_subset(self, srctims, srcwcs):
def _get_todepth_subset(self, srctims, srcwcs, srcpix):
timsubset = set()
for band in self.bands:
# Order to try them: first, DECaLS data (our propid),
Expand Down Expand Up @@ -724,7 +725,7 @@ def _get_todepth_subset(self, srctims, srcwcs):
if srcpix is None:
p1,p2,p3 = np.percentile(detiv, pctiles)
else:
p1,p2,p3 = np.percentile(detiv[srcpix2], pctiles)
p1,p2,p3 = np.percentile(detiv[srcpix], pctiles)

m1 = NanoMaggies.nanomaggiesToMag(np.sqrt(1./p1) * Nsigma)
m2 = NanoMaggies.nanomaggiesToMag(np.sqrt(1./p2) * Nsigma)
Expand Down

0 comments on commit d9ac0d4

Please sign in to comment.