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 6bbbc76 + d1bcbe0 commit 7a57b1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
9 changes: 0 additions & 9 deletions python/lsst/sims/catUtils/mixins/AstrometryMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from lsst.sims.coordUtils.AstrometryUtils import appGeoFromICRS, observedFromAppGeo
from lsst.sims.coordUtils.AstrometryUtils import observedFromICRS, calculatePupilCoordinates
from lsst.sims.coordUtils.AstrometryUtils import calculateGnomonicProjection
from lsst.sims.coordUtils.CameraUtils import findChipName, calculatePixelCoordinates
from lsst.sims.coordUtils.CameraUtils import calculateFocalPlaneCoordinates

Expand Down Expand Up @@ -40,14 +39,6 @@ def get_galactic_coords(self):
return numpy.array([glon,glat])



@compound('x_focal_nominal', 'y_focal_nominal')
def get_gnomonicProjection(self):
ra = self.column_by_name('raObserved')
dec = self.column_by_name('decObserved')
return calculateGnomonicProjection(ra, dec, obs_metadata=self.obs_metadata,
epoch=self.db_obj.epoch)

@compound('x_pupil','y_pupil')
def get_pupilFromSky(self):
"""
Expand Down
34 changes: 15 additions & 19 deletions tests/testAstrometryMixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from lsst.sims.catalogs.measures.instance import InstanceCatalog
from lsst.sims.utils import ObservationMetaData, arcsecFromRadians
from lsst.sims.coordUtils import observedFromAppGeo, calculatePupilCoordinates
from lsst.sims.coordUtils import calculateGnomonicProjection, calculateFocalPlaneCoordinates
from lsst.sims.coordUtils import calculateFocalPlaneCoordinates
from lsst.sims.coordUtils import findChipName, calculatePixelCoordinates
from lsst.sims.catalogs.generation.utils import myTestStars, makeStarTestDB, \
myTestGals, makeGalTestDB
Expand Down Expand Up @@ -44,7 +44,7 @@ class testCatalog(InstanceCatalog,AstrometryStars,CameraCoords):
"""
catalog_type = 'test_stars'
column_outputs=['id','raPhoSim','decPhoSim','raObserved','decObserved',
'x_focal_nominal', 'y_focal_nominal', 'x_pupil','y_pupil',
'x_pupil','y_pupil',
'chipName', 'xPix', 'yPix','xFocalPlane','yFocalPlane']
#Needed to do camera coordinate transforms.
camera = camTestUtils.CameraWrapper().camera
Expand All @@ -66,9 +66,12 @@ class testStellarCatalog(InstanceCatalog, AstrometryStars, CameraCoords):

camera = camTestUtils.CameraWrapper().camera

column_outputs = ['glon', 'glat', 'x_focal_nominal', 'y_focal_nominal',
'x_pupil', 'y_pupil', 'xPix', 'yPix', 'xFocalPlane', 'yFocalPlane',
'chipName', 'raPhoSim', 'decPhoSim', 'raObserved', 'decObserved']
column_outputs = ['glon', 'glat',
'x_pupil', 'y_pupil',
'xPix', 'yPix',
'xFocalPlane', 'yFocalPlane',
'chipName', 'raPhoSim', 'decPhoSim',
'raObserved', 'decObserved']

class testGalaxyCatalog(InstanceCatalog, AstrometryGalaxies, CameraCoords):
"""
Expand All @@ -77,7 +80,7 @@ class testGalaxyCatalog(InstanceCatalog, AstrometryGalaxies, CameraCoords):

camera = camTestUtils.CameraWrapper().camera

column_outputs = ['glon', 'glat', 'x_focal_nominal', 'y_focal_nominal',
column_outputs = ['glon', 'glat',
'x_pupil', 'y_pupil', 'xPix', 'yPix', 'xFocalPlane', 'yFocalPlane',
'chipName', 'raPhoSim', 'decPhoSim', 'raObserved', 'decObserved']

Expand Down Expand Up @@ -176,10 +179,12 @@ def testUtilityMethods(self):

self.cat.write_catalog("AstrometryTestCatalog.txt")

dtype = [('id',int),('raPhoSim',float),('decPhoSim',float),('raObserved',float),
('decObserved',float),('x_focal_nominal',float),('y_focal_nominal',float),
('x_pupil',float),('y_pupil',float),('chipName',str,11),('xPix',float),
('yPix',float),('xFocalPlane',float),('yFocalPlane',float)]
dtype = [('id',int),
('raPhoSim',float), ('decPhoSim',float),
('raObserved',float), ('decObserved',float),
('x_pupil',float), ('y_pupil',float), ('chipName',str,11),
('xPix',float), ('yPix',float),
('xFocalPlane',float), ('yFocalPlane',float)]

baselineData = numpy.loadtxt('AstrometryTestCatalog.txt', dtype=dtype, delimiter=';')

Expand Down Expand Up @@ -235,15 +240,6 @@ def testUtilityMethods(self):
self.assertTrue(numpy.isnan(xxtest))
self.assertTrue(numpy.isnan(yytest))

gnomonTest = calculateGnomonicProjection(baselineData['raObserved'],
baselineData['decObserved'], obs_metadata=self.obs_metadata,
epoch=2000.0)
for (xxtest, yytest, xx, yy) in \
zip(gnomonTest[0], gnomonTest[1],
baselineData['x_focal_nominal'], baselineData['y_focal_nominal']):

self.assertAlmostEqual(xxtest,xx,6)
self.assertAlmostEqual(yytest,yy,6)

nameTest = findChipName(xPupil=pupilTest[0], yPupil=pupilTest[1],
epoch=self.cat.db_obj.epoch,
Expand Down

0 comments on commit 7a57b1c

Please sign in to comment.