def get_params_as_ICRS(self): result = dict() # NOTE This feature below needs astropy version 2.0. dlon_coslat = self.PMELONG.quantity # * numpy.cos(self.ELAT.quantity.radian) # Astropy2 and astropy3 have different APIs if int(astropy_version.split(".")[0]) <= 2: pv_ECL = PulsarEcliptic( lon=self.ELONG.quantity, lat=self.ELAT.quantity, d_lon_coslat=dlon_coslat, d_lat=self.PMELAT.quantity, ) else: pv_ECL = PulsarEcliptic( lon=self.ELONG.quantity, lat=self.ELAT.quantity, pm_lon_coslat=dlon_coslat, pm_lat=self.PMELAT.quantity, ) pv_ICRS = pv_ECL.transform_to(coords.ICRS) result["RAJ"] = pv_ICRS.ra.to(u.hourangle) result["DECJ"] = pv_ICRS.dec result["PMRA"] = pv_ICRS.pm_ra_cosdec result["PMDEC"] = pv_ICRS.pm_dec return result
def coords_as_ICRS(self, epoch=None): """Returns pulsar sky coordinates as an astropy ICRS object instance. Pulsar coordinates will be transform from ecliptic coordinates to ICRS If epoch (MJD) is specified, proper motion is included to return the position at the given epoch. If the ecliptic coordinates are provided, """ if epoch is None or (self.PMELONG.value == 0.0 and self.PMELAT.value == 0.0): pos_ecl = PulsarEcliptic(lon=self.ELONG.quantity, lat=self.ELAT.quantity) else: dt = (epoch - self.POSEPOCH.quantity.mjd) * u.d dELONG = dt * self.PMELONG.quantity / numpy.cos( self.ELAT.quantity.radian) dELAT = dt * self.PMELAT.quantity try: PulsarEcliptic.obliquity = OBL[self.ECL.value] except KeyError: raise ValueError("No obliquity " + self.ECL.value + " provided. " "Check your pint/datafile/ecliptic.dat file.") pos_ecl = PulsarEcliptic(lon=self.ELONG.quantity + dELONG, lat=self.ELAT.quantity + dELAT) return pos_ecl.transform_to(coords.ICRS)
def get_params_as_ICRS(self): result = dict() # NOTE This feature below needs astropy version 2.0. dlon_coslat = self.PMELONG.quantity #* numpy.cos(self.ELAT.quantity.radian) pv_ECL = PulsarEcliptic(lon=self.ELONG.quantity, lat=self.ELAT.quantity, d_lon_coslat=dlon_coslat, d_lat=self.PMELAT.quantity) pv_ICRS = pv_ECL.transform_to(coords.ICRS) result['RAJ'] = pv_ICRS.ra.to(u.hourangle) result['DECJ'] = pv_ICRS.dec result['PMRA'] = pv_ICRS.pm_ra_cosdec result['PMDEC'] = pv_ICRS.pm_dec return result
def get_params_as_ICRS(self): result = dict() # NOTE This feature below needs astropy version 2.0. dlon_coslat = self.PMELONG.quantity #* numpy.cos(self.ELAT.quantity.radian) # Astropy2 and astropy3 have different APIs if int(astropy_version.split('.')[0]) <= 2: pv_ECL = PulsarEcliptic(lon=self.ELONG.quantity, lat=self.ELAT.quantity, d_lon_coslat=dlon_coslat, d_lat=self.PMELAT.quantity) else: pv_ECL = PulsarEcliptic(lon=self.ELONG.quantity, lat=self.ELAT.quantity, pm_lon_coslat=dlon_coslat, pm_lat=self.PMELAT.quantity) pv_ICRS = pv_ECL.transform_to(coords.ICRS) result['RAJ'] = pv_ICRS.ra.to(u.hourangle) result['DECJ'] = pv_ICRS.dec result['PMRA'] = pv_ICRS.pm_ra_cosdec result['PMDEC'] = pv_ICRS.pm_dec return result
def coords_as_ICRS(self, epoch=None): """Returns pulsar sky coordinates as an astropy ICRS object instance. Pulsar coordinates will be transform from ecliptic coordinates to ICRS If epoch (MJD) is specified, proper motion is included to return the position at the given epoch. If the ecliptic coordinates are provided, """ if epoch is None or (self.PMELONG.value == 0.0 and self.PMELAT.value == 0.0): pos_ecl = PulsarEcliptic(lon=self.ELONG.quantity, lat=self.ELAT.quantity) else: dt = (epoch - self.POSEPOCH.quantity.mjd) * u.d dELONG = dt * self.PMELONG.quantity / numpy.cos(self.ELAT.quantity.radian) dELAT = dt * self.PMELAT.quantity try: PulsarEcliptic.obliquity = OBL[self.ECL.value] except KeyError: raise ValueError("No obliquity " + self.ECL.value + " provided. " "Check your pint/datafile/ecliptic.dat file.") pos_ecl = PulsarEcliptic(lon=self.ELONG.quantity+dELONG, lat=self.ELAT.quantity+dELAT) return pos_ecl.transform_to(coords.ICRS)