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=True, non_vcs=False, defining=False, special=False, undefined=False) self.data = { src["iers_name"]: dict(icrf_name=src["icrf_name"], ra=ra[i], dec=dec[i], **src_type) for i, src in enumerate(self._array) }
def _convert_dms2rad(self, field): """Convert DMS (degrees, minutes, seconds) to radians Args: field (String): Original field with degrees, minutes, seconds separated by whitespace. Returns: Float: 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"]))