From c59cd8b85bcbede83f4dda424779c9c35c37c02c Mon Sep 17 00:00:00 2001 From: Lynne Jones Date: Thu, 9 Jul 2015 19:05:20 -0700 Subject: [PATCH 1/2] Comment completion for camera use. --- python/lsst/sims/maf/slicers/baseSpatialSlicer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/sims/maf/slicers/baseSpatialSlicer.py b/python/lsst/sims/maf/slicers/baseSpatialSlicer.py index c4190b4f1..213c2ac65 100644 --- a/python/lsst/sims/maf/slicers/baseSpatialSlicer.py +++ b/python/lsst/sims/maf/slicers/baseSpatialSlicer.py @@ -129,7 +129,7 @@ def _presliceFootprint(self, simData): self.obs_metadata.unrefractedDec = dec self.obs_metadata.rotSkyPos = rotSkyPos self.obs_metadata.mjd = mjd - # Correct ra,dec for + # Correct ra,dec for refraction (because this is automatically done within findChipNames for the boresight) raCorr, decCorr = observedFromICRS(self.slicePoints['ra'][hpIndices], self.slicePoints['dec'][hpIndices], obs_metadata=self.obs_metadata, From d1b97ef268602a586f420e81c4166e58d51f7d5b Mon Sep 17 00:00:00 2001 From: Lynne Jones Date: Thu, 9 Jul 2015 19:05:50 -0700 Subject: [PATCH 2/2] Fix healpix and userPoints slicers so that they also count 'useCamera' to see if equal or not. --- python/lsst/sims/maf/slicers/healpixSlicer.py | 3 ++- .../lsst/sims/maf/slicers/userPointsSlicer.py | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/python/lsst/sims/maf/slicers/healpixSlicer.py b/python/lsst/sims/maf/slicers/healpixSlicer.py index 17adfe8dd..d284c142f 100644 --- a/python/lsst/sims/maf/slicers/healpixSlicer.py +++ b/python/lsst/sims/maf/slicers/healpixSlicer.py @@ -63,7 +63,8 @@ def __eq__(self, otherSlicer): if otherSlicer.nside == self.nside: if (otherSlicer.lonCol == self.lonCol and otherSlicer.latCol == self.latCol): if otherSlicer.radius == self.radius: - result = True + if otherSlicer.useCamera == self.useCamera: + result = True return result def _pix2radec(self, islice): diff --git a/python/lsst/sims/maf/slicers/userPointsSlicer.py b/python/lsst/sims/maf/slicers/userPointsSlicer.py index 755199353..04841b4b9 100644 --- a/python/lsst/sims/maf/slicers/userPointsSlicer.py +++ b/python/lsst/sims/maf/slicers/userPointsSlicer.py @@ -6,8 +6,9 @@ class UserPointsSlicer(BaseSpatialSlicer): """Use spatial slicer on a user provided point """ - def __init__(self, verbose=True, lonCol='fieldRA', latCol='fieldDec', - badval=-666, leafsize=100, radius=1.75, ra=None, dec=None, **kwargs): + def __init__(self, ra, dec, verbose=True, lonCol='fieldRA', latCol='fieldDec', + badval=-666, leafsize=100, radius=1.75, + useCamera=False, rotSkyPosColName='rotSkyPos', mjdColName='expMJD'): """ ra = list of ra points to use dec = list of dec points to use @@ -15,15 +16,31 @@ def __init__(self, verbose=True, lonCol='fieldRA', latCol='fieldDec', super(UserPointsSlicer,self).__init__(verbose=verbose, lonCol=lonCol, latCol=latCol, - badval=badval, radius=radius, leafsize=leafsize, **kwargs) + badval=badval, radius=radius, leafsize=leafsize, + useCamera=useCamera, rotSkyPosColName=rotSkyPosColName, + mjdColName=mjdColName) # check that ra and dec are iterable, if not, they are probably naked numbers, wrap in list if not hasattr(ra, '__iter__'): ra = [ra] if not hasattr(dec, '__iter__'): dec = [dec] + if len(ra) != len(dec): + raise ValueError('RA and Dec must be the same length') self.nslice = np.size(ra) self.slicePoints['sid'] = np.arange(np.size(ra)) self.slicePoints['ra'] = np.array(ra) self.slicePoints['dec'] = np.array(dec) self.plotFuncs = [BaseSkyMap, BaseHistogram] + + def __eq__(self, otherSlicer): + """Evaluate if two slicers are equivalent.""" + result = False + if isinstance(otherSlicer, UserPointsSlicer): + if otherSlicer.nslice == self.nslice: + if np.all(otherSlicer.ra == self.ra) and np.all(otherSlicer.dec == self.dec): + if (otherSlicer.lonCol == self.lonCol and otherSlicer.latCol == self.latCol): + if otherSlicer.radius == self.radius: + if otherSlicer.useCamera == self.useCamera: + result = True + return result