How to use the pyuvsim.astropy_interface.MoonLocation function in pyuvsim

To help you get started, we’ve selected a few pyuvsim 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 / pyuvsim / pyuvsim / simsetup.py View on Github external
26.565, -26.565, -45.000, -56.310, -71.565])

        zas = np.array([7.280, 5.385, 3.606, 2.828, 2.236, 2.236, 3.606,
                        5.385, 7.280, 7.071, 5.099, 3.162, 1.414, 2.236,
                        5.099, 7.071, 7.000, 6.000, 5.000, 3.000, 2.000,
                        1.000, 2.000, 3.000, 5.000, 6.000, 7.000, 7.071,
                        5.099, 3.162, 1.414, 3.162, 5.099, 7.071, 7.280,
                        5.385, 3.606, 2.828, 2.236, 2.236, 2.828, 3.606, 6.325])

        alts = 90. - zas
        Nsrcs = alts.size
        fluxes = np.ones_like(alts)

    catalog = []

    if isinstance(array_location, MoonLocation):
        localframe = 'lunartopo'
        mock_keywords['world'] = 'moon'
    else:
        localframe = 'altaz'
        mock_keywords['world'] = 'earth'
    source_coord = SkyCoord(alt=Angle(alts, unit=units.deg), az=Angle(azs, unit=units.deg),
                            obstime=time, frame=localframe, location=array_location)
    icrs_coord = source_coord.transform_to('icrs')

    ra = icrs_coord.ra
    dec = icrs_coord.dec
    names = np.array(['src' + str(si) for si in range(Nsrcs)])
    stokes = np.zeros((4, 1, Nsrcs))
    stokes[0, :] = fluxes
    catalog = pyradiosky.SkyModel(names, ra, dec, stokes, 'flat')
    if return_data:
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
def _set_lsts_on_uvdata(uv_obj):

    # If the telescope location is a MoonLocation,
    # then uv_obj.extra_keywords['world'] == 'moon'.
    world = uv_obj.extra_keywords.get('world', 'earth')

    if world == 'earth':
        uv_obj.set_lsts_from_time_array()
    elif world == 'moon':
        if not 'hasmoon':
            raise ValueError("Cannot construct lsts for MoonLocation without lunarsky module")
        un_jds, inv = np.unique(uv_obj.time_array, return_inverse=True)
        loc = MoonLocation(*uv_obj.telescope_location, unit='m')
        times = Time(un_jds, format='jd', scale='utc', location=loc)
        uv_obj.lst_array = times.sidereal_time('apparent').rad[inv]
    else:
        raise ValueError(f"Invalid world {world}.")
    return uv_obj