How to use the pyuvsim.data.DATA_PATH 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 / scripts / run_profile_pyuvsim.py View on Github external
import numpy as np
import os
import sys
import resource
import time as pytime

from pyuvdata import UVBeam, UVData
from pyuvdata.data import DATA_PATH
from pyuvsim.data import DATA_PATH as SIM_DATA_PATH
from pyuvsim import mpi, profiling, simsetup, uvsim

parser = argparse.ArgumentParser(description=("A command-line script "
                                              "to execute a pyuvsim simulation for"
                                              "profiling purposes."))

paramsfile = os.path.join(SIM_DATA_PATH, 'profiling_params.yaml')
cst_files = ['HERA_NicCST_150MHz.txt', 'HERA_NicCST_123MHz.txt']
beam_files = [os.path.join(DATA_PATH, f) for f in cst_files]

parser.add_argument('--Nsrcs', dest='Nsrcs', type=int, default=1)
parser.add_argument('--Ntimes', dest='Ntimes', type=int, default=1)
parser.add_argument('--Nfreqs', dest='Nfreqs', type=int, default=1)
parser.add_argument('--Nbls', dest='Nbls', type=int, default=1)
parser.add_argument('--beam', dest='beam', type=str, default='uniform')
parser.add_argument('--prof_out', dest='prof_out', type=str, default='time_profile.out')
parser.add_argument('--mem_out', dest='mem_out', type=str, default='memory_usage.out')
parser.add_argument('--time_out', dest='time_out', type=str, default='time_usage.out')

args = parser.parse_args()

with open(paramsfile, 'r') as pfile:
    params = yaml.safe_load(pfile)
github RadioAstronomySoftwareGroup / pyuvsim / scripts / uvdata_to_telescope_config.py View on Github external
from pyuvdata import UVData

import pyuvsim.simsetup
from pyuvsim.data import DATA_PATH as SIM_DATA_PATH

# Read in a uvfits file and automatically generate yaml files.
# Will assume the same beam_id for all antennas for now.

parser = argparse.ArgumentParser(description=("Extracts antenna position info from uvfits."))

parser.add_argument('file_in', metavar='', type=str, nargs='+')
parser.add_argument('-l', '--layout_csv_name', default=None)
parser.add_argument('-t', '--telescope_config_name', default=None)
parser.add_argument('-b', '--beam_filepath', type=str,
                    default=os.path.join(SIM_DATA_PATH, 'HERA_NicCST.uvbeam'))

args = parser.parse_args()

uvd = UVData()
uvd.read(args.file_in[0])

pyuvsim.simsetup.uvdata_to_telescope_config(
    uvd, args.beam_filepath, layout_csv_name=args.layout_csv_name,
    telescope_config_name=args.telescope_config_name,
    return_names=False, path_out='.'
)
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
if 'spline_interp_opts' in telconfig.keys():
        beam_list.spline_interp_opts = telconfig['spline_interp_opts']
    for beamID in beam_ids:
        beam_model = telconfig['beam_paths'][beamID]

        for key in beam_list.uvb_params.keys():
            if key in telconfig:
                beam_list.uvb_params[key] = telconfig[key]

        if not isinstance(beam_model, (str, dict)):
            raise ValueError('Beam model is not properly specified in telescope config file.')

        # first check to see if the beam_model is a string giving a file location
        if (isinstance(beam_model, str)
                and (os.path.exists(beam_model)
                     or os.path.exists(os.path.join(SIM_DATA_PATH, beam_model)))):
            if os.path.exists(beam_model):
                beam_list.append(beam_model)
            else:
                beam_list.append(os.path.join(SIM_DATA_PATH, beam_model))
        # Failing that, try to parse the beam string as an analytic beam.
        else:
            if isinstance(beam_model, str):
                beam_type = beam_model
            elif 'type' in beam_model:
                beam_type = beam_model['type']
            else:
                raise ValueError("Beam model must have a 'type' field.")

            if beam_type not in AnalyticBeam.supported_types:
                raise ValueError("Undefined beam model type: {}".format(beam_type))
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / simsetup.py View on Github external
for key in beam_list.uvb_params.keys():
            if key in telconfig:
                beam_list.uvb_params[key] = telconfig[key]

        if not isinstance(beam_model, (str, dict)):
            raise ValueError('Beam model is not properly specified in telescope config file.')

        # first check to see if the beam_model is a string giving a file location
        if (isinstance(beam_model, str)
                and (os.path.exists(beam_model)
                     or os.path.exists(os.path.join(SIM_DATA_PATH, beam_model)))):
            if os.path.exists(beam_model):
                beam_list.append(beam_model)
            else:
                beam_list.append(os.path.join(SIM_DATA_PATH, beam_model))
        # Failing that, try to parse the beam string as an analytic beam.
        else:
            if isinstance(beam_model, str):
                beam_type = beam_model
            elif 'type' in beam_model:
                beam_type = beam_model['type']
            else:
                raise ValueError("Beam model must have a 'type' field.")

            if beam_type not in AnalyticBeam.supported_types:
                raise ValueError("Undefined beam model type: {}".format(beam_type))

            this_beam_opts = {}
            if isinstance(beam_model, dict):
                for key in beam_model:
                    if key != 'type':