def create_configuration_from_file(antfile: str, name: str = None, location: EarthLocation = None,
mount: str = 'altaz',
names: str = "%d", frame: str = 'local',
diameter=35.0,
meta: dict = None,
rmax=None, **kwargs) -> Configuration:
""" Define from a file
:param names:
:param antfile: Antenna file name
:param name: Name of array e.g. 'LOWBD2'
:param location:
:param mount: mount type: 'altaz', 'xy'
:param frame: 'local' | 'global'
:param diameter: Effective diameter of station or antenna
:param meta: Any meta info
:return: Configuration
"""
antxyz = numpy.genfromtxt(antfile, delimiter=",")
assert antxyz.shape[1] == 3, ("Antenna array has wrong shape %s" % antxyz.shape)
if frame == 'local':
latitude = location.geodetic[1].to(u.rad).value
antxyz = xyz_at_latitude(antxyz, latitude)
if rmax is not None:
lantxyz = antxyz - numpy.average(antxyz, axis=0)
r = numpy.sqrt(lantxyz[:, 0] ** 2 + lantxyz[:, 1] ** 2 + lantxyz[:, 2] ** 2)
antxyz = antxyz[r < rmax]
log.debug('create_configuration_from_file: Maximum radius %.1f m includes %d antennas/stations' %
(rmax, antxyz.shape[0]))
nants = antxyz.shape[0]
anames = [names % ant for ant in range(nants)]
mounts = numpy.repeat(mount, nants)
fc = Configuration(location=location, names=anames, mount=mounts, xyz=antxyz, frame=frame,
diameter=diameter)
return fc
testing_support.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录