Coverage for python/lsst/sims/catUtils/mixins/AstrometryMixin.py : 88%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
cartesianFromSpherical
"PhoSimAstrometryBase", "PhoSimAstrometryStars", "PhoSimAstrometryGalaxies", "PhoSimAstrometrySSM", "CameraCoords", "CameraCoordsLSST"]
"""Collection of astrometry routines that operate on numpy arrays"""
def get_galactic_coords(self): """ Getter for galactic coordinates, in case the catalog class does not provide that
Reads in the ra and dec from the data base and returns columns with galactic longitude and latitude.
All angles are in radians """
def get_pupilFromSky(self): """ Take an input RA and dec from the sky and convert it to coordinates in the pupil. """
obs_metadata=self.obs_metadata)
"""Methods for getting coordinates from the camera object""" # chipNameFromPupilCoords to return objects that land on # multiple chips; only the first chip would be # written to the catalog
def get_chipName(self): """Get the chip name if there is one for each catalog entry""" raise RuntimeError("No camera defined; cannot find chipName") allow_multiple_chips=self.allow_multiple_chips)
def get_pixelCoordinates(self): """Get the pixel positions (or nan if not on a chip) for all objects in the catalog""" raise RuntimeError("No camera is defined; cannot calculate pixel coordinates") camera=self.camera)
def get_focalPlaneCoordinates(self): """Get the focal plane coordinates for all objects in the catalog.""" raise RuntimeError("No camera defined. Cannot calculate focal plane coordinates")
def get_chipName(self): """Get the chip name if there is one for each catalog entry"""
allow_multiple_chips=self.allow_multiple_chips)
def get_pixelCoordinates(self): """Get the pixel positions (or nan if not on a chip) for all objects in the catalog""" xPupil, yPupil = (self.column_by_name('x_pupil'), self.column_by_name('y_pupil')) chipNameList = self.column_by_name('chipName') if len(xPupil) == 0: return np.array([[],[]]) return pixelCoordsFromPupilCoordsLSST(xPupil, yPupil, chipName=chipNameList, band=self.obs_metadata.bandpass)
def get_focalPlaneCoordinates(self): """Get the focal plane coordinates for all objects in the catalog.""" xPupil, yPupil = (self.column_by_name('x_pupil'), self.column_by_name('y_pupil')) if len(xPupil) == 0: return np.array([[],[]]) return focalPlaneCoordsFromPupilCoords(xPupil, yPupil, band=self.obs_metadata.bandpass)
""" This mixin contains astrometry getters for objects with zero parallax, proper motion, or radial velocity (i.e. extragalactic sources).
Available getters are: raICRS, decICRS -- the RA, Dec of the object in the International Celestial Reference System
raObserved, decObserved -- the result of applying precession, nutation, aberration, and refraction to raICRS, decICRS """
def get_icrsCoordinates(self): """Getter for RA, Dec in the International Celestial Reference System with effects due to proper motion and radial velocity applied"""
def get_observedCoordinates(self): """Getter for observed RA, Dec (i.e. RA and Dec with all effects due to the motion of the Earth and refraction by the atmosphere applied)"""
""" This mixin contains getters for objects with non-zero parallax, proper motion, and radial velocities (i.e. sources in the Milky Way).
Available getters are: raICRS, decICRS -- the RA, Dec of the object in the International Celestial Reference System with proper motion and radial velocity applied
raObserved, decObserved -- the result of applying precession, nutation, aberration, parallax, and refraction to raICRS, decICRS """
""" Getter which converts mean coordinates in the International Celestial Reference Frame to observed coordinates. """
# TODO # are we going to store proper motion in raw radians per year # or in sky motion = cos(dec) * (radians per year) # PAL asks for radians per year inputs
includeRefraction = includeRefraction, obs_metadata=self.obs_metadata, epoch=self.db_obj.epoch)
def get_observedCoordinates(self): """Getter for observed RA, Dec (i.e. RA and Dec with all effects due to the motion of the Earth and refraction by the atmosphere applied)"""
def get_icrsCoordinates(self): """Getter for RA, Dec in the International Celestial Reference System with effects due to proper motion and radial velocity applied"""
""" This mixin will provide getters for astrometric columns customized to Solar System Object tables """
def get_icrsCoordinates(self): return np.array([self.column_by_name('raJ2000'), self.column_by_name('decJ2000')])
""" Reads in ICRS coordinates from the database. Returns observed coordinates with refraction toggled on or off based on the input boolean includeRefraction """
obs_metadata=self.obs_metadata, epoch=self.db_obj.epoch)
def get_observedCoordinates(self):
def get_skyVelocity(self): """ Gets the skyVelocity in radians per day """
# i.e., no need to divide by cos(dec))
""" This mixin contains the _dePrecess method necessary to create PhoSim images that are astrometrically consistent with their input catalogs. """
""" Transform a set of RA, Dec pairs by subtracting out a rotation which represents the effects of precession, nutation, and aberration.
Specifically:
Calculate the displacement between the boresite and the boresite corrected for precession, nutation, and aberration (not refraction).
Convert boresite and corrected boresite to Cartesian coordinates.
Calculate the rotation matrix to go between those Cartesian vectors.
Convert [ra_in, dec_in] into Cartesian coordinates.
Apply the rotation vector to those Cartesian coordinates.
Convert back to ra, dec-like coordinates
@param [in] ra_in is a numpy array of RA in radians
@param [in] dec_in is a numpy array of Dec in radians
@param [in] obs is an ObservationMetaData
@param [out] ra_out is a numpy array of de-precessed RA in radians
@param [out] dec_out is a numpy array of de-precessed Dec in radians """
obs_metadata=obs, epoch=2000.0, includeRefraction=False)
arcsecFromRadians(_angularSeparation(obs._pointingRA, obs._pointingDec, self._icrs_to_phosim_rotator._ra1, self._icrs_to_phosim_rotator._dec1))>1.0e-6 or arcsecFromRadians(_angularSeparation(precessedRA, precessedDec, self._icrs_to_phosim_rotator._ra0, self._icrs_to_phosim_rotator._dec0))>1.0e-6):
obs._pointingRA, obs._pointingDec)
def _appGeoFromPhoSim(self, raPhoSim, decPhoSim, obs): """ This method will convert from the 'deprecessed' coordinates expected by PhoSim to apparent geocentric coordinates
Parameters ---------- raPhoSim is the PhoSim RA-like coordinate (in radians)
decPhoSim is the PhoSim Dec-like coordinate (in radians)
obs is an ObservationMetaData characterizing the telescope pointing
Returns ------- apparent geocentric RA in radians
apparent geocentric Dec in radians """ obs_metadata=obs, epoch=2000.0, includeRefraction=False)
arcsecFromRadians(_angularSeparation(obs._pointingRA, obs._pointingDec, self._phosim_to_icrs_rotator._ra0, self._phosim_to_icrs_rotator._dec0))>1.0e-6 or arcsecFromRadians(_angularSeparation(precessedRA, precessedDec, self._phosim_to_icrs_rotator._ra1, self._phosim_to_icrs_rotator._dec1))>1.0e-6):
precessedRA, precessedDec)
obs_metadata=obs)
def appGeoFromPhoSim(self, raPhoSim, decPhoSim, obs_metadata): """ This method will convert from the 'deprecessed' coordinates expected by PhoSim to apparent geocentric coordinates
Parameters ---------- raPhoSim is the PhoSim RA-like coordinate (in degrees)
decPhoSim is the PhoSim Dec-like coordinate (in degrees)
obs_metadata is an ObservationMetaData characterizing the telescope pointing
Returns ------- apparent geocentric RA in degrees
apparent geocentric Dec in degrees """ np.radians(decPhoSim), obs_metadata)
def _icrsFromPhoSim(self, raPhoSim, decPhoSim, obs_metadata): """ This method will convert from the 'deprecessed' coordinates expected by PhoSim to ICRS coordinates
Parameters ---------- raPhoSim is the PhoSim RA-like coordinate (in radians)
decPhoSim is the PhoSim Dec-like coordinate (in radians)
obs_metadata is an ObservationMetaData characterizing the telescope pointing
Returns ------- raICRS in radians
decICRS in radians """
dec_appGeo) = self._appGeoFromPhoSim(raPhoSim, decPhoSim, obs_metadata)
# convert to ICRS coordinates epoch=2000.0)
def icrsFromPhoSim(self, raPhoSim, decPhoSim, obs_metadata): """ This method will convert from the 'deprecessed' coordinates expected by PhoSim to ICRS coordinates
Parameters ---------- raPhoSim is the PhoSim RA-like coordinate (in degrees)
decPhoSim is the PhoSim Dec-like coordinate (in degrees)
obs_metadata is an ObservationMetaData characterizing the telescope pointing
Returns ------- raICRS in degrees
decICRS in degrees """ np.radians(decPhoSim), obs_metadata)
""" This mixin contains the getter method that calculates raPhoSim, decPhoSim (the coordinates necessary for a PhoSim-readable InstanceCatalog) in the case of stellar sources. """
def get_phoSimCoordinates(self): """Getter for RA, Dec coordinates expected by PhoSim.
These are observed RA, Dec coordinates with the effects of nutation, aberration, and precession subtracted out by the PhosimInputBase._dePrecess() method. This preserves the relative effects of nutation, aberration, and precession while re-aligning the catalog with the boresite RA, Dec so that astrometric solutions make sense."""
""" This mixin contains the getter method that calculates raPhoSim, decPhoSim (the coordinates necessary for a PhoSim-readable InstanceCatalog) in the case of extra-galactic sources. """
def get_phoSimCoordinates(self): """Getter for RA, Dec coordinates expected by PhoSim.
These are observed RA, Dec coordinates with the effects of nutation, aberration, and precession subtracted out by the PhosimInputBase._dePrecess() method. This preserves the relative effects of nutation, aberration, and precession while re-aligning the catalog with the boresite RA, Dec so that astrometric solutions make sense."""
epoch=self.db_obj.epoch)
""" This mixin contains the getter method that calculates raPhoSim, decPhoSim (the coordinates necessary for a PhoSim-readable InstanceCatalog) in the case of solar system sources. """
def get_phoSimCoordinates(self): |