diff --git a/applications/arts/commissioning/arts_sc4_tabs_weights.py b/applications/arts/commissioning/arts_sc4_tabs_weights.py new file mode 100644 index 0000000000000000000000000000000000000000..663acc34d5025a8bb433b71afccae047be8a1389 --- /dev/null +++ b/applications/arts/commissioning/arts_sc4_tabs_weights.py @@ -0,0 +1,58 @@ +#! /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 +