def _calculate_pos_crs(self, source): """Calculate position for a source Args: source (String): Key saying which source to calculate position for. Returns: Array: Positions, one 2-vector """ ga = 0.0058 * Unit.mas2rad # Aberration constant (mas/yr) mjd_2015 = 57023.0 # # Reference epoch of aberration model # Galactic center gc = Direction(ra=Unit.hms_to_rad(17, 45, 40.04), dec=Unit.dms_to_rad(-29, 0, 28.1)) # Radio source src = Direction(ra=self.data[source]["ra"], dec=self.data[source]["dec"]) # Compute correction dra = ga * gc.unit_vector @ src.dsrc_dra ddec = ga * gc.unit_vector @ src.dsrc_ddec dt = (self.time.mean.mjd - mjd_2015) * Unit.day2julian_year ra = src.right_ascension + dra * dt dec = src.declination + ddec * dt return np.squeeze(Direction(ra=ra, dec=dec, time=self.time))
def _calculate_pos_crs(self, source): """Calculate position for a source Args: source (String): Key saying which source to calculate position for. Returns: Array: Positions, one 2-vector """ ga = 0.0058 * Unit.mas2rad # Aberration constant (mas/yr) mjd_2015 = 57023.0 # # Reference epoch of aberration model # Galactic center gc_ra = Unit.hms_to_rad(17, 45, 40.04) gc_dec = Unit.dms_to_rad(-29, 0, 28.1) gc = radec2unitvector(gc_ra, gc_dec) source_info = self.data[source] # Compute correction dra = ga * gc @ dsrc_dra(source_info["ra"], source_info["dec"]) ddec = ga * gc @ dsrc_ddec(source_info["ra"], source_info["dec"]) dt = (self.time.mean.mjd - mjd_2015) * Unit.day2julian_year return np.array( [source_info["ra"] + dra * dt, source_info["dec"] + ddec * dt])
def _convert_dms2rad(self, field: bytes) -> float: """Convert DMS (degrees, minutes, seconds) to radians Args: field: Original field with degrees, minutes, seconds separated by whitespace. Returns: Field converted to radians. """ degrees, minutes, seconds = [float(f) for f in field.split()] return Unit.dms_to_rad(degrees, minutes, seconds)
def parse_radio_source(self, line, _): """Read station position Reads the station position from the NGS file. Args: line: Input data from NGS file """ src_name = line["name"] self.data[src_name] = dict() self.data[src_name]["ra"] = Unit.hms_to_rad(float(line["ra_hrs"]), int(line["ra_mins"]), float(line["ra_secs"])) self.data[src_name]["dec"] = Unit.dms_to_rad( float(line["dec_degs"].replace(" ", "")), int(line["dec_mins"]), float(line["dec_secs"]))
def structure_data(self): ra = Unit.hms_to_rad(self._array["ra_h"], self._array["ra_m"], self._array["ra_s"]) dec = Unit.dms_to_rad(self._array["dec_deg"], self._array["dec_m"], self._array["dec_s"]) src_type = dict(vcs=False, non_vcs=True, undefined=False) self.data = { src["iers_name"]: dict(icrf_name=src["icrf_name"], defining=src["defining"], special=src["special"], ra=ra[i], dec=dec[i], **src_type) for i, src in enumerate(self._array) }