Skip to content
Snippets Groups Projects
Commit 063c0c58 authored by Jonathan Hargreaves's avatar Jonathan Hargreaves
Browse files

Utility to set weights in arts sc4 tab beamformer based on Stefan Wijnholds script

parent 353e10a6
No related branches found
No related tags found
No related merge requests found
#! /usr/bin/env python
###############################################################################
#
# Copyright (C) 2012
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
"""Utility to set the weights in the ARTS SC4 tabs beamformer
Replicate Stefan Wijnhold's Matlab script (BFWeights.m)
Then apply the weights using Pieter Donker's script
$UPE/peripherals/pi_arts_tab_beamformer_weights.py
Usage:
python arts_sc4_tabs_weights.py
"""
import math
import pi_arts_tab_beamformer_weights
num_dish = 10
num_tabs = 12
#phases = [num_dish][num_tabs] * 0
norm_factor = 255.0/math.sqrt(num_dish)
tab_index = range( -int(math.floor(num_tabs/2)), int(math.floor((num_tabs)/2)) )
beta = [float(eachelement) / float(num_tabs) for eachelement in tab_index]
dishes = range(num_dish)
phase_n = [[eachtab * float(eachdish) for eachdish in dishes] for eachtab in beta]
for tab in range(num_tabs):
for dish in range(num_dish):
weightre = norm_factor * math.cos( 2 * math.pi * phase_n[tab][dish])
weightim = norm_factor * math.sin( 2 * math.pi * phase_n[tab][dish])
print "tab ", tab , " dish ", dish , " phase ", 2 * math.pi * phase_n[tab][dish], " weight re, im ", weightre, weightim
#print tab_index, beta, dishes
#print phase_n
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment