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
"""
from . import fhd
if isinstance(filelist[0], (list, tuple)):
self.read_fhd(filelist[0], use_model=use_model, run_check=run_check,
check_extra=check_extra,
run_check_acceptability=run_check_acceptability)
if len(filelist) > 1:
for f in filelist[1:]:
uv2 = UVData()
uv2.read_fhd(f, use_model=use_model, run_check=run_check,
check_extra=check_extra,
run_check_acceptability=run_check_acceptability)
self += uv2
del(uv2)
else:
fhd_obj = fhd.FHD()
fhd_obj.read_fhd(filelist, use_model=use_model, run_check=run_check,
check_extra=check_extra,
run_check_acceptability=run_check_acceptability)
self._convert_from_filetype(fhd_obj)
del(fhd_obj)