Skip to content

Commit

Permalink
Merge pull request #125 from LSSTDESC/u/jrbogart/diffsky_sqrt
Browse files Browse the repository at this point in the history
ensure np.sqrt doesn't have a negative argument
  • Loading branch information
JoanneBogart authored Dec 2, 2024
2 parents e1c8f19 + 5dddd8b commit 2c2f8ce
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions skycatalogs/objects/diffsky_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ def get_knot_size(self, z):
"""
# Deceleration paramameter
q = -0.5
# Angular diameter scaling approximation in pc
dA = (3e9/q**2)*(z*q+(q-1)*(np.sqrt(2*q*z+1)-1))/(1+z)**2*(1.4-0.53*z)
# Using typical knot size 250pc, convert to sigma in arcmin
if z < 0.6:
return 206264.8*250/dA/2.355
else:

if z >= 0.6:
# Above z=0.6, fractional contribution to post-convolved size
# is <20% for smallest Roman PSF size, so can treat as point source
# This also ensures sqrt in formula below has a
# non-negative argument
return None

# Angular diameter scaling approximation in pc
dA = (3e9/q**2)*(z*q+(q-1)*(np.sqrt(2*q*z+1)-1))/(1+z)**2*(1.4-0.53*z)
# Using typical knot size 250pc, convert to sigma in arcmin
return 206264.8*250/dA/2.355

def get_knot_n(self, rng=None):
"""
Return random value for number of knots based on galaxy sm.
Expand Down

0 comments on commit 2c2f8ce

Please sign in to comment.