Skip to content

Commit

Permalink
Skip shearing galsim.DeltaFunction instances
Browse files Browse the repository at this point in the history
  • Loading branch information
taranu committed Oct 14, 2024
1 parent d4ca469 commit 7d4e2f7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions python/lsst/source/injection/inject_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,19 @@ def make_galsim_object(
object_class = getattr(galsim, source_type)
object_data = get_object_data(source_data, object_class)
object = object_class(**object_data)
# Create a version of the object with an area-preserving shear applied.
shear_data = get_shear_data(source_data)
if shear_data:
try:
object = object.shear(**shear_data)
except TypeError as err:
if logger:
logger.warning("Cannot apply shear to GalSim object: %s", err)
pass
# Apply the instrumental flux and return.
# Don't shear delta functions. It will work if the parameters are finite
# but is unnecessary and unhelpful.
if not isinstance(object, galsim.DeltaFunction):
# Create a version of the object with an area-preserving shear applied.
shear_data = get_shear_data(source_data)
if shear_data:
try:
object = object.shear(**shear_data)
except TypeError as err:
if logger:
logger.warning("Cannot apply shear to GalSim object: %s", err)
pass
# Apply the instrumental flux and return.
object = object.withFlux(inst_flux)
return object

Expand Down

0 comments on commit 7d4e2f7

Please sign in to comment.