Skip to content

Commit

Permalink
Merge pull request #616 from legacysurvey/fix-initial-galaxy-pos
Browse files Browse the repository at this point in the history
During initial source fitting, fix the positions of galaxies (this mostly affects SGA preburns)
  • Loading branch information
dstndstn authored Jul 23, 2020
2 parents 389657b + 90265ee commit 4737e5a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions py/legacypipe/oneblob.py
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,14 @@ def _optimize_individual_sources_subtract(self, cat, Ibright,
# Add this source's initial model back in.
models.add(srci, self.tims)

from tractor import Galaxy
is_galaxy = isinstance(src, Galaxy)
if is_galaxy:
# During SGA pre-burns, freeze initial positions (fit other parameters),
# to avoid problems like NGC0943, where one galaxy in a pair moves a large distance
# to fit the overall light profile.
src.freezeParam('pos')

if self.bigblob:
# Create super-local sub-sub-tims around this source
# Make the subimages the same size as the modelMasks.
Expand Down Expand Up @@ -1777,6 +1785,9 @@ def _optimize_individual_sources_subtract(self, cat, Ibright,
srctractor.optimize_loop(**self.optargs)
#print('First-round final log-prob:', srctractor.getLogProb())

if is_galaxy:
src.thawParam('pos')

# Re-remove the final fit model for this source
models.update_and_subtract(srci, src, self.tims)

Expand Down

0 comments on commit 4737e5a

Please sign in to comment.