Source code for VegasL1LBWBackend

######################################################################
#
#  VegasL1LBWBackend.py -- A backend for the L1LBW1 modes (aka modes
#  4-9).
#
#  Copyright (C) 2014 Associated Universities, Inc. Washington DC, USA.
#
#  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 2 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, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  Correspondence concerning GBT software should be addressed as follows:
#  GBT Operations
#  National Radio Astronomy Observatory
#  P. O. Box 2
#  Green Bank, WV 24944-0002 USA
#
######################################################################

from VegasLBWBackend import VegasLBWBackend
from Backend import convertToMHz

[docs]class VegasL1LBWBackend(VegasLBWBackend): """A class which implements the VEGAS L1LBW1-specific parameter calculations. VegasL1LBWBackend(theBank, theMode, theRoach = None, theValon = None) Where: * *theBank:* Instance of specific bank configuration data BankData. * *theMode:* Instance of specific mode configuration data ModeData. * *theRoach:* Instance of katcp_wrapper * *theValon:* instance of ValonKATCP * *unit_test:* Set to true to unit test. Will not attempt to talk to roach, shared memory, etc. """ def __init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test = False): """Creates an instance of the VegasL1LBWBackend. """ VegasLBWBackend.__init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test) if not self.gain: self.gain = [1024] # give it a default if config file is mising gain. self.progdev() self.net_config() if self.mode.roach_kvpairs: self.write_registers(**self.mode.roach_kvpairs) self.reset_roach() self.clear_switching_states() self.add_switching_state(1.0, blank = False, cal = False, sig_ref_1 = False) self.prepare() self.start_hpc() self.start_fits_writer() self._init_gpu_resources()
[docs] def prepare(self): """ This command writes calculated values to the hardware and status memory. This command should be run prior to the first scan to properly setup the hardware. The sequence of commands to set up a measurement is thus typically:: be.set_param(...) be.set_param(...) ... be.set_param(...) be.prepare() """ super(VegasL1LBWBackend, self).prepare() self.set_register(gain = self.gain[0]) # Talk to outside things: status memory, HPC programs, roach if self.bank is not None: self.write_status(**self.status_mem_local) else: for i in self.status_mem_local.keys(): print "%s = %s" % (i, self.status_mem_local[i]) if self.roach: self.write_registers(**self.roach_registers_local)
[docs] def _sampler_frequency_dep(self): """ Computes the effective frequency of the A/D sampler based on mode """ self.sampler_frequency = convertToMHz(self.frequency) * 1e6 / 4