Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/sim 1250 camera equals #20

Merged
merged 2 commits into from
Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/lsst/sims/maf/slicers/baseSpatialSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion python/lsst/sims/maf/slicers/healpixSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
23 changes: 20 additions & 3 deletions python/lsst/sims/maf/slicers/userPointsSlicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,41 @@

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
"""

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