Skip to content

Commit

Permalink
Change np.sqrt calls to math sqrt calls
Browse files Browse the repository at this point in the history
Fixed Indent

Fixed extra space
  • Loading branch information
bsmartradio committed Jul 21, 2023
1 parent e23793e commit 8e3e954
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Binary file added python/lsst/meas/extensions/.DS_Store
Binary file not shown.
21 changes: 11 additions & 10 deletions python/lsst/meas/extensions/trailedSources/NaivePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import numpy as np
import scipy.optimize as sciOpt
from scipy.special import erf
from math import sqrt

from lsst.geom import Point2D
from lsst.meas.base.pluginRegistry import register
Expand Down Expand Up @@ -161,8 +162,8 @@ def measure(self, measRecord, exposure):
xpy = Ixx + Iyy
xmy2 = xmy*xmy
xy2 = Ixy*Ixy
a2 = 0.5 * (xpy + np.sqrt(xmy2 + 4.0*xy2))
b2 = 0.5 * (xpy - np.sqrt(xmy2 + 4.0*xy2))
a2 = 0.5 * (xpy + sqrt(xmy2 + 4.0*xy2))
b2 = 0.5 * (xpy - sqrt(xmy2 + 4.0*xy2))

# Measure the trail length
# Check if the second-moments are weighted
Expand Down Expand Up @@ -215,7 +216,7 @@ def measure(self, measRecord, exposure):
xcErr2, ycErr2 = np.diag(measRecord.getCentroidErr())

# Error in length
desc = np.sqrt(xmy2 + 4.0*xy2) # Descriminant^1/2 of EV equation
desc = sqrt(xmy2 + 4.0*xy2) # Descriminant^1/2 of EV equation
da2dIxx = 0.5*(1.0 + (xmy/desc))
da2dIyy = 0.5*(1.0 - (xmy/desc))
da2dIxy = 2.0*Ixy / desc
Expand All @@ -227,21 +228,21 @@ def measure(self, measRecord, exposure):
# Error in theta
dThetadIxx = -Ixy / (xmy2 + 4.0*xy2) # dThetadIxx = -dThetadIyy
dThetadIxy = xmy / (xmy2 + 4.0*xy2)
thetaErr = np.sqrt(dThetadIxx*dThetadIxx*(IxxErr2 + IyyErr2) + dThetadIxy*dThetadIxy*IxyErr2)
thetaErr = sqrt(dThetadIxx*dThetadIxx*(IxxErr2 + IyyErr2) + dThetadIxy*dThetadIxy*IxyErr2)

# Error in flux
dFdxc, dFdyc, _, dFdL, dFdTheta = gradFlux
fluxErr = np.sqrt(dFdL*dFdL*lengthErr*lengthErr + dFdTheta*dFdTheta*thetaErr*thetaErr
+ dFdxc*dFdxc*xcErr2 + dFdyc*dFdyc*ycErr2)
fluxErr = sqrt(dFdL*dFdL*lengthErr*lengthErr + dFdTheta*dFdTheta*thetaErr*thetaErr
+ dFdxc*dFdxc*xcErr2 + dFdyc*dFdyc*ycErr2)

# Errors in end-points
dxdradius = np.cos(theta)
dydradius = np.sin(theta)
radiusErr2 = lengthErr*lengthErr/4.0
xErr2 = np.sqrt(xcErr2 + radiusErr2*dxdradius*dxdradius + thetaErr*thetaErr*dxdtheta*dxdtheta)
yErr2 = np.sqrt(ycErr2 + radiusErr2*dydradius*dydradius + thetaErr*thetaErr*dydtheta*dydtheta)
x0Err = np.sqrt(xErr2) # Same for x1
y0Err = np.sqrt(yErr2) # Same for y1
xErr2 = sqrt(xcErr2 + radiusErr2*dxdradius*dxdradius + thetaErr*thetaErr*dxdtheta*dxdtheta)
yErr2 = sqrt(ycErr2 + radiusErr2*dydradius*dydradius + thetaErr*thetaErr*dydtheta*dydtheta)
x0Err = sqrt(xErr2) # Same for x1
y0Err = sqrt(yErr2) # Same for y1

# Set flags
measRecord.set(self.keyRa, ra)
Expand Down

0 comments on commit 8e3e954

Please sign in to comment.