コード例 #1
0
 def ssoInFov(self, interpfuncs, simdata, rFov=np.radians(1.75),
              useCamera=True,
              simdataRaCol = 'fieldRA', simdataDecCol='fieldDec'):
     """
     Return the indexes of the simdata observations where the object was inside the fov.
     """
     # See if the object is within 'rFov' of the center of the boresight.
     raSso = np.radians(interpfuncs['ra'](simdata['expMJD']))
     decSso = np.radians(interpfuncs['dec'](simdata['expMJD']))
     sep = haversine(raSso, decSso, simdata[simdataRaCol], simdata[simdataDecCol])
     if not useCamera:
         idxObsRough = np.where(sep<rFov)[0]
         return idxObsRough
     # Or go on and use the camera footprint.
     try:
         self.camera
     except AttributeError:
         self._setupCamera()
     idxObs = []
     idxObsRough = np.where(sep<self.cameraFov)[0]
     for idx in idxObsRough:
         mjd = simdata[idx]['expMJD']
         obs_metadata = ObservationMetaData(unrefractedRA=np.degrees(simdata[idx][simdataRaCol]),
                                            unrefractedDec=np.degrees(simdata[idx][simdataDecCol]),
                                            rotSkyPos=np.degrees(simdata[idx]['rotSkyPos']),
                                            mjd=simdata[idx]['expMJD'])
         raObj = np.radians(np.array([interpfuncs['ra'](simdata[idx]['expMJD'])]))
         decObj = np.radians(np.array([interpfuncs['dec'](simdata[idx]['expMJD'])]))
         raObj, decObj = observedFromICRS(raObj, decObj, obs_metadata=obs_metadata, epoch=self.epoch)
         chipNames = findChipName(ra=raObj,dec=decObj, epoch=self.epoch, camera=self.camera, obs_metadata=obs_metadata)
         if chipNames != [None]:
             idxObs.append(idx)
     idxObs = np.array(idxObs)
     return idxObs
コード例 #2
0
from lsst.obs.lsstSim import LsstSimMapper

mapper = LsstSimMapper()
camera = mapper.camera

epoch = 2000.0

#generate an ObservationMetaData object based on an actual OpSim pointing
obshistid = 88625744
radiusDegrees = 3.0
OpSimDB = OpSim3_61DBObject()
obs_metadata = OpSimDB.getObservationMetaData(obshistid, radiusDegrees, makeCircBounds=True)

#generate some random RA and Dec to find chips for
nsamples = 10
numpy.random.seed(32)
rr = numpy.radians(2.0)*numpy.random.sample(nsamples)
theta = 2.0*numpy.pi*numpy.random.sample(nsamples)
ra = numpy.degrees(numpy.radians(obs_metadata.unrefractedRA) + rr*numpy.cos(theta))
dec = numpy.degrees(numpy.radians(obs_metadata.unrefractedDec) + rr*numpy.sin(theta))

#need to correct coordinates for precession, nutation, and aberration
ra, dec = observedFromICRS(ra, dec, obs_metadata=obs_metadata, epoch=epoch)

xx, yy = pupilCoordsFromRaDec(ra, dec, obs_metadata=obs_metadata, epoch=epoch)

chipNames = chipNameFromRaDec(ra, dec, epoch=epoch, camera=camera, obs_metadata=obs_metadata)

for (rr,dd,x,y,nn) in zip(ra,dec,xx,yy,chipNames):
    print rr,dd,arcsecFromRadians(x),arcsecFromRadians(y),nn