How to use the pyuvdata.telescopes.get_telescope function in pyuvdata

To help you get started, we’ve selected a few pyuvdata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RadioAstronomySoftwareGroup / pyuvdata / pyuvdata / uvdata / fhd.py View on Github external
)

                # check both lat/lon/alt and xyz because of subtle differences
                # in tolerances
                if self._xyz_close(
                    location_latlonalt, arr_center
                ) or self._latlonalt_close(
                    (latitude, longitude, altitude), latlonalt_arr_center
                ):
                    self.telescope_location = arr_center
                else:
                    # values do not agree with each other to within the tolerances.
                    # this is a known issue with FHD runs on cotter uvfits
                    # files for the MWA
                    # compare with the known_telescopes values
                    telescope_obj = uvtel.get_telescope(self.telescope_name)
                    # start warning message
                    message = (
                        "Telescope location derived from obs lat/lon/alt "
                        "values does not match the location in the layout file."
                    )

                    if telescope_obj is not False:
                        if self._latlonalt_close(
                            (latitude, longitude, altitude),
                            telescope_obj.telescope_location_lat_lon_alt,
                        ):
                            # obs lat/lon/alt matches known_telescopes
                            message += (
                                " Value from obs lat/lon/alt matches the "
                                "known_telescopes values, using them."
                            )
github RadioAstronomySoftwareGroup / pyuvdata / pyuvdata / uvflag / uvflag.py View on Github external
uv : a UVData or UVCal object.
        Object from which lsts are calculated

    Returns
    -------
    lst_array: array of float
        lst_array corresponding to time_array and at telescope location.
        Units are radian.

    """
    if not isinstance(uv, (UVCal, UVData)):
        raise ValueError(
            "Function lst_from_uv can only operate on " "UVCal or UVData object."
        )

    tel = uvtel.get_telescope(uv.telescope_name)
    lat, lon, alt = tel.telescope_location_lat_lon_alt_degrees
    lst_array = uvutils.get_lst_for_time(uv.time_array, lat, lon, alt)
    return lst_array
github RadioAstronomySoftwareGroup / pyuvdata / pyuvdata / uvdata.py View on Github external
def set_telescope_params(self, overwrite=False):
        """
        Set telescope related parameters.

        If the telescope_name is in the known_telescopes, set any missing
        telescope-associated parameters (e.g. telescope location) to the value
        for the known telescope.

        Args:
            overwrite: Option to overwrite existing telescope-associated
                parameters with the values from the known telescope.
                Default is False.
        """
        telescope_obj = uvtel.get_telescope(self.telescope_name)
        if telescope_obj is not False:
            params_set = []
            for p in telescope_obj:
                telescope_param = getattr(telescope_obj, p)
                self_param = getattr(self, p)
                if telescope_param.value is not None and (overwrite is True
                                                          or self_param.value is None):
                    telescope_shape = telescope_param.expected_shape(telescope_obj)
                    self_shape = self_param.expected_shape(self)
                    if telescope_shape == self_shape:
                        params_set.append(self_param.name)
                        prop_name = self_param.name
                        setattr(self, prop_name, getattr(telescope_obj, prop_name))
                    else:
                        # expected shapes aren't equal. This can happen e.g. with diameters,
                        # which is a single value on the telescope object but is
github RadioAstronomySoftwareGroup / pyuvdata / pyuvdata / uvdata / miriad.py View on Github external
list if the altitude is missing.

        """
        # check if telescope name is present
        if self.telescope_name is None:
            self._load_miriad_variables(uv)

        latitude = uv["latitud"]  # in units of radians
        longitude = uv["longitu"]
        try:
            altitude = uv["altitude"]
            self.telescope_location_lat_lon_alt = (latitude, longitude, altitude)
        except (KeyError):
            # get info from known telescopes.
            # Check to make sure the lat/lon values match reasonably well
            telescope_obj = uvtel.get_telescope(self.telescope_name)
            if telescope_obj is not False:

                tol = 2 * np.pi * 1e-3 / (60.0 * 60.0 * 24.0)  # 1mas in radians
                lat_close = np.isclose(
                    telescope_obj.telescope_location_lat_lon_alt[0],
                    latitude,
                    rtol=0,
                    atol=tol,
                )
                lon_close = np.isclose(
                    telescope_obj.telescope_location_lat_lon_alt[1],
                    longitude,
                    rtol=0,
                    atol=tol,
                )
                if correct_lat_lon: