Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _convert_to_filetype(self, filetype):
if filetype is 'uvfits':
from . import uvfits
other_obj = uvfits.UVFITS()
elif filetype is 'fhd':
from . import fhd
other_obj = fhd.FHD()
elif filetype is 'miriad':
from . import miriad
other_obj = miriad.Miriad()
elif filetype is 'uvh5':
from . import uvh5
other_obj = uvh5.UVH5()
else:
raise ValueError('filetype must be uvfits, miriad, fhd, or uvh5')
for p in self:
param = getattr(self, p)
setattr(other_obj, p, param)
return other_obj
phase_type=phase_type, antenna_nums=antenna_nums,
ant_str=ant_str, bls=bls,
polarizations=polarizations, time_range=time_range)
if len(filepath) > 1:
for f in filepath[1:]:
uv2 = UVData()
uv2.read_miriad(f, correct_lat_lon=correct_lat_lon,
run_check=run_check, check_extra=check_extra,
run_check_acceptability=run_check_acceptability,
phase_type=phase_type, antenna_nums=antenna_nums,
ant_str=ant_str, bls=bls,
polarizations=polarizations, time_range=time_range)
self += uv2
del(uv2)
else:
miriad_obj = miriad.Miriad()
miriad_obj.read_miriad(filepath, correct_lat_lon=correct_lat_lon,
run_check=run_check, check_extra=check_extra,
run_check_acceptability=run_check_acceptability,
phase_type=phase_type, antenna_nums=antenna_nums,
ant_str=ant_str, bls=bls,
polarizations=polarizations, time_range=time_range)
self._convert_from_filetype(miriad_obj)
del(miriad_obj)