How to use the pyuvsim.simsetup.initialize_uvdata_from_params 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 / file_series_from_config.py View on Github external
params['time'] = time_params
    input_uv, beam_list, beam_ids = simsetup.initialize_uvdata_from_params(params)
    set_other_required_params(input_uv, nonzero_uvw)
    input_uv.history = 'Made on '+str(datetime.date.today())+ ' from config file '+args['paramsfile']+' by Adam Lanman'
    opath = set_ofilename(params, input_uv)
    input_uv.write_uvfits(opath,spoof_nonessential=True, force_phase=True)
else:
    for fi in range(Nfiles):
        time_params['start_time'] = tzero + length_days * fi
        time_params['end_time'] = time_params['start_time'] + length_days
        if time_params['end_time'] > tfin:
            time_params['end_time'] = tfin
            time_params['Ntimes'] = int((tfin - time_params['start_time'])*3600.*24./float(time_params['integration_time']))
        params['time'] = time_params
        params['snapshot_number'] = fi
        input_uv, beam_list, beam_ids = simsetup.initialize_uvdata_from_params(params)
        set_other_required_params(input_uv, nonzero_uvw)
        input_uv.history = 'Made on '+str(datetime.date.today())+ ' from config file '+args['paramsfile']+' by Adam Lanman'
        opath = set_ofilename(params, input_uv)
        print opath
        input_uv.write_uvfits(opath,spoof_nonessential=True, force_phase=True)
github RadioAstronomySoftwareGroup / pyuvsim / pyuvsim / uvsim.py View on Github external
raise ImportError("You need mpi4py to use the uvsim module. "
                          "Install it by running pip install pyuvsim[sim] "
                          "or pip install pyuvsim[all] if you also want the "
                          "line_profiler installed.")

    mpi.start_mpi()
    rank = mpi.get_rank()
    comm = mpi.get_comm()

    input_uv = UVData()
    beam_list = None
    beam_dict = None
    skydata = SkyModelData()

    if rank == 0:
        input_uv, beam_list, beam_dict = simsetup.initialize_uvdata_from_params(params)
        skydata, source_list_name = simsetup.initialize_catalog_from_params(
            params, input_uv, return_recarray=False
        )
        skydata = simsetup.SkyModelData(skydata)

    input_uv = comm.bcast(input_uv, root=0)
    beam_list = comm.bcast(beam_list, root=0)
    beam_dict = comm.bcast(beam_dict, root=0)
    skydata.share(root=0)

    uv_out = run_uvdata_uvsim(
        input_uv, beam_list, beam_dict=beam_dict, catalog=skydata, quiet=quiet
    )

    if rank == 0:
        if isinstance(params, str):
github RadioAstronomySoftwareGroup / pyuvsim / scripts / run_profile_pyuvsim.py View on Github external
beam_list = None
beam_dict = None
input_uv = UVData()
mock_keywords = None
catalog = None
profiling.set_profiler(outfile_prefix=args.prof_out)

if rank == 0:
    print("{} freqs, {} times, {} bls, {} srcs, {} beam".format(
        args.Nfreqs, args.Ntimes, args.Nbls, args.Nsrcs, args.beam))
    params['freq']['Nfreqs'] = args.Nfreqs
    params['time']['Ntimes'] = args.Ntimes
    params['sources'] = {'catalog': 'mock'}

    input_uv, beam_list, beam_dict = simsetup.initialize_uvdata_from_params(params)

    if input_uv.Nbls < args.Nbls:
        raise ValueError('Cannot profile for more than {} baselines, requeted {}'.format(
            input_uv.Nbls, args.Nbls))

    # Baseline selection:
    input_uv.baseline_array = np.repeat(input_uv.baseline_array[:args.Nbls], args.Ntimes)
    input_uv.ant_1_array, input_uv.ant_2_array = \
        input_uv.baseline_to_antnums(input_uv.baseline_array)
    ants_new = np.unique(input_uv.ant_1_array.tolist() + input_uv.ant_2_array.tolist())
    input_uv.antenna_numbers = ants_new
    input_uv.antenna_names = ants_new.astype(str)
    Nants = ants_new.size
    # For now, all use the same beam model
    beam_dict = dict(zip(input_uv.antenna_names, np.zeros(Nants, dtype=int)))
    input_uv.antenna_positions = input_uv.antenna_positions[:Nants, :]
github RadioAstronomySoftwareGroup / pyuvsim / scripts / file_series_from_config.py View on Github external
print "Warning: Running in serial"
        serial=True
else:
    serial = True
    Nfiles = 1
    length_days = tfin - tzero

params['Nfiles'] = Nfiles

## There's a persistent bug in FHD that causes an error when a u, v, or w coordinate is exactly 0
## This option sets zeros to the machine precision in this case.
nonzero_uvw = False if not 'nonzero_uvw' in params else bool(params['nonzero_uvw'])

if not serial:
    params['time'] = time_params
    input_uv, beam_list, beam_ids = simsetup.initialize_uvdata_from_params(params)
    set_other_required_params(input_uv, nonzero_uvw)
    input_uv.history = 'Made on '+str(datetime.date.today())+ ' from config file '+args['paramsfile']+' by Adam Lanman'
    opath = set_ofilename(params, input_uv)
    input_uv.write_uvfits(opath,spoof_nonessential=True, force_phase=True)
else:
    for fi in range(Nfiles):
        time_params['start_time'] = tzero + length_days * fi
        time_params['end_time'] = time_params['start_time'] + length_days
        if time_params['end_time'] > tfin:
            time_params['end_time'] = tfin
            time_params['Ntimes'] = int((tfin - time_params['start_time'])*3600.*24./float(time_params['integration_time']))
        params['time'] = time_params
        params['snapshot_number'] = fi
        input_uv, beam_list, beam_ids = simsetup.initialize_uvdata_from_params(params)
        set_other_required_params(input_uv, nonzero_uvw)
        input_uv.history = 'Made on '+str(datetime.date.today())+ ' from config file '+args['paramsfile']+' by Adam Lanman'