Skip to content

Commit

Permalink
Merge branch 'bugfix/SIM-1382/calculatePupilCoordinates'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsf committed Aug 28, 2015
2 parents 835c063 + 5743311 commit 6d52eb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/lsst/sims/GalSimInterface/galSimInterpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def drawSersic(self, gsObject, bandpass=None):
# Subtract pi/2 from the position angle, because GalSim sets position angle=0
# aligned with East, rather than North
centeredObj = centeredObj.shear(q=gsObject.minorAxisRadians/gsObject.majorAxisRadians, \
beta=(gsObject.positionAngleRadians-0.5*numpy.pi)*galsim.radians)
beta=(0.5*numpy.pi-gsObject.positionAngleRadians)*galsim.radians)
if self.PSF is not None:
centeredObj = self.PSF.applyPSF(xPupil=gsObject.xPupilArcsec, yPupil=gsObject.yPupilArcsec, obj=centeredObj,
bandpass=bandpass)
Expand Down
2 changes: 1 addition & 1 deletion tests/testHalfLightRadius.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def testHalfLightRadiusOfImage(self):

totalFlux, hlrFlux = self.get_flux_in_half_light_radius(imageName, hlr, detector, camera, obs)
sigmaFlux = numpy.sqrt(0.5*totalFlux/cat.photParams.gain) #divide by gain because Poisson stats apply to photons
self.assertTrue(numpy.abs(hlrFlux-0.5*totalFlux)<3.0*sigmaFlux)
self.assertTrue(numpy.abs(hlrFlux-0.5*totalFlux)<4.0*sigmaFlux)

if os.path.exists(catName):
os.unlink(catName)
Expand Down
11 changes: 5 additions & 6 deletions tests/testPositionAngle.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ def get_position_angle(self, imageName, afwCamera, afwDetector, \

# find the angle between the (1,1) vector in pixel space and the
# north axis of the image
theta = numpy.arctan2(raCenterP1[0]-raCenter[0], decCenterP1[0]-decCenter[0])
theta = numpy.arctan2(-1.0*(raCenterP1[0]-raCenter[0]), decCenterP1[0]-decCenter[0])

# rotate the (1,1) vector in pixel space so that it is pointing
# along the north axis
north = numpy.array([numpy.cos(theta)-numpy.sin(theta), numpy.cos(theta)+numpy.sin(theta)])
north = north/numpy.sqrt(north[0]*north[0]+north[1]*north[1])

# find the east axis of the image
east = numpy.array([north[1], -1.0*north[0]])
# find the west axis of the image
west = numpy.array([north[1], -1.0*north[0]])

# now find the covariance matrix of the x, y pixel space distribution
# of flux on the image
Expand Down Expand Up @@ -140,7 +140,7 @@ def get_position_angle(self, imageName, afwCamera, afwDetector, \
# return the angle between the north axis of the image
# and the semi-major axis of the object
cosTheta = numpy.dot(majorAxis, north)
sinTheta = numpy.dot(majorAxis, east)
sinTheta = numpy.dot(majorAxis, west)
theta = numpy.arctan2(sinTheta, cosTheta)

return numpy.degrees(theta)
Expand Down Expand Up @@ -185,7 +185,7 @@ def testPositionAngle(self):
numpy.random.random_sample(1)*20.0-10.0,
numpy.random.random_sample(1)*20.0-10.0,
pa=[pa],
mag_norm=[18.0])
mag_norm=[17.0])

db = paFileDBObj(dbFileName, runtable='test')

Expand All @@ -206,7 +206,6 @@ def testPositionAngle(self):
pa-360.0-paTest,
pa+360.0-paTest
])).min()

self.assertTrue(deviation<2.0)

if os.path.exists(catName):
Expand Down

0 comments on commit 6d52eb8

Please sign in to comment.