Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise ValueError(
'layout_csv file {} from yaml does not exist'.format(layout_csv))
ant_layout = _parse_layout_csv(layout_csv)
E, N, U = ant_layout['e'], ant_layout['n'], ant_layout['u']
antnames = ant_layout['name']
antnums = np.array(ant_layout['number'])
elif isinstance(array_layout, dict):
# Receiving antenna positions directly
antnums = tele_params.pop('antenna_numbers')
antnames = tele_params.pop('antenna_names')
E, N, U = np.array([array_layout[an] for an in antnums]).T
layout_csv = 'user-fed dict'
# fill in outputs with just array info
return_dict = {}
beam_list = BeamList([])
beam_dict = {}
return_dict['Nants_data'] = antnames.size
return_dict['Nants_telescope'] = antnames.size
return_dict['antenna_names'] = np.array(antnames.tolist())
return_dict['antenna_numbers'] = np.array(antnums)
antpos_enu = np.vstack((E, N, U)).T
return_dict['antenna_positions'] = (
uvutils.ECEF_from_ENU(antpos_enu, *telescope_location)
- tele_params['telescope_location'])
if world is not None:
return_dict['world'] = world
return_dict['array_layout'] = layout_csv
return_dict['telescope_location'] = tuple(tele_params['telescope_location'])
return_dict['telescope_location_lat_lon_alt'] = tuple(telescope_location_latlonalt)
return_dict['telescope_name'] = telescope_name
def _construct_beam_list(beam_ids, telconfig):
beam_list = BeamList([])
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 isinstance(frequency, units.Quantity):
freq = np.array([frequency.to('Hz').value])
else:
freq = np.array([frequency])
if array.beam_list[self.beam_id].data_normalization != 'peak':
array.beam_list[self.beam_id].peak_normalize()
if freq_interp_kind is not None:
array.beam_list[self.beam_id].freq_interp_kind = freq_interp_kind
if interpolation_function is not None:
array.beam_list[self.beam_id].interpolation_function = interpolation_function
spline_opts = None
if isinstance(array.beam_list, BeamList):
spline_opts = array.beam_list.spline_interp_opts
interp_kwargs = {'az_array' : source_az, 'za_array' : source_za,
'freq_array' : freq, 'reuse_spline' : reuse_spline}
if spline_opts is not None:
interp_kwargs['spline_opts'] = spline_opts
try:
interp_data, interp_basis_vector = \
array.beam_list[self.beam_id].interp(**interp_kwargs)
except TypeError as err: # pragma: nocover
raise TypeError(
"pyuvdata version >=2.0.1 required to use spline_interp_opts"
) from err