Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
desiproc account committed Apr 18, 2016
2 parents 232aa35 + 1965412 commit 7eca8e1
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions py/legacypipe/runbrick.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- :py:func:`stage_image_coadds`
- :py:func:`stage_srcs`
- :py:func:`stage_fitblobs`
- :py:func:`stage_fitblobs_finish`
- :py:func:`stage_coadds`
- :py:func:`stage_wise_forced`
- :py:func:`stage_writecat`
Expand Down Expand Up @@ -1521,8 +1520,11 @@ def _write_fitblobs_pickle(fn, data):
print('Wrote', fn)

def stage_fitblobs(T=None,
brickname=None,
brickid=None,
version_header=None,
blobsrcs=None, blobslices=None, blobs=None,
cat=None, targetrd=None, pixscale=None,
cat=None,
targetwcs=None,
W=None,H=None,
bands=None, ps=None, tims=None,
Expand All @@ -1533,12 +1535,14 @@ def stage_fitblobs(T=None,
checkpoint_filename=None,
checkpoint_period=600,
write_pickle_filename=None,
write_metrics=True,
get_all_models=False,
allbands = 'ugrizY',
**kwargs):
'''
This is where the actual source fitting happens.
The `one_blob` function is called for each "blob" of pixels with
the sources contained within that blob. The results are assembled
in the next stage, `stage_fitblobs_finish`.
the sources contained within that blob.
'''
tlast = Time()
for tim in tims:
Expand All @@ -1548,8 +1552,8 @@ def stage_fitblobs(T=None,
#import multiprocessing
#write_pool = multiprocessing.Pool(1)
import threading
keys = ['T', 'blobsrcs', 'blobslices', 'blobs', 'cat', 'targetrd',
'pixscale', 'targetwcs', 'W', 'H', 'bands', 'tims', 'survey',
keys = ['T', 'blobsrcs', 'blobslices', 'blobs', 'cat',
'targetwcs', 'W', 'H', 'bands', 'tims', 'survey',
'brickname', 'brickid', 'brick', 'version_header', 'ccds']
L = locals()
vals = {}
Expand Down Expand Up @@ -1784,34 +1788,10 @@ def stage_fitblobs(T=None,

print('[parallel fitblobs] Fitting sources took:', Time()-tlast)

return dict(fitblobs_R=R, tims=tims, ps=ps, blobs=blobs,
blobslices=blobslices, blobsrcs=blobsrcs)

def stage_fitblobs_finish(
survey=None,
brickname=None,
brickid=None,
version_header=None,
T=None, blobsrcs=None, blobslices=None, blobs=None,
cat=None, targetrd=None, pixscale=None,
targetwcs=None,
W=None,H=None,
bands=None, ps=None, tims=None,
plots=False, plots2=False,
fitblobs_R=None,
write_metrics=True,
get_all_models=False,
allbands = 'ugrizY',
**kwargs):
'''
This is a "glue" stage to repackage the results from the
`stage_fitblobs` stage.
'''
## This used to be in fitblobs_finish

# one_blob can reduce the number and change the types of sources!
# Reorder the sources here...
R = fitblobs_R
del fitblobs_R
assert(len(R) == len(blobsrcs))

# Drop now-empty blobs.
Expand Down Expand Up @@ -3164,12 +3144,11 @@ def run_brick(brick, radec=None, pixscale=0.262,

# fitblobs: see below

'fitblobs_finish':'fitblobs',
'coadds': 'fitblobs_finish',
'coadds': 'fitblobs',

# wise_forced: see below

'fitplots': 'fitblobs_finish',
'fitplots': 'fitblobs',
'psfplots': 'tims',
'initplots': 'srcs',

Expand Down

0 comments on commit 7eca8e1

Please sign in to comment.