def start(self, inSecs, durSecs):
        "Start a scan in inSecs for durSecs long"

        # our fake GPU simulator needs to know the start time of the scan
        # and it's duration, so we need to write it to status shared mem.
        def secs_2_dmjd(secs):
            dmjd = (secs/86400) + 40587
            return dmjd + ((secs % 86400)/86400.)

        inSecs = inSecs if inSecs is not None else 5
        durSecs = durSecs if durSecs is not None else 5

        # TBF: we've done our stuff w/ DMJD, but our start is a utc datetime obj
        now = time.time()
        startDMJD = secs_2_dmjd(int(now + inSecs))

        # NOTE: SCANLEN can also be set w/ player.set_param(scan_length=#)
        self.write_status(STRTDMJD=str(startDMJD),SCANLEN=str(durSecs))

        dt = datetime.utcnow()
        dt.replace(second = 0)
        dt.replace(microsecond = 0)
        dt += timedelta(seconds = inSecs)

        VegasBackend.start(self, starttime = dt)
Esempio n. 2
0
    def start(self, inSecs, durSecs):
        "Start a scan in inSecs for durSecs long"

        # our fake GPU simulator needs to know the start time of the scan
        # and it's duration, so we need to write it to status shared mem.
        def secs_2_dmjd(secs):
            dmjd = (secs / 86400) + 40587
            return dmjd + ((secs % 86400) / 86400.)

        inSecs = inSecs if inSecs is not None else 5
        durSecs = durSecs if durSecs is not None else 5

        # TBF: we've done our stuff w/ DMJD, but our start is a utc datetime obj
        now = time.time()
        startDMJD = secs_2_dmjd(int(now + inSecs))

        # NOTE: SCANLEN can also be set w/ player.set_param(scan_length=#)
        self.write_status(STRTDMJD=str(startDMJD), SCANLEN=str(durSecs))

        dt = datetime.utcnow()
        dt.replace(second=0)
        dt.replace(microsecond=0)
        dt += timedelta(seconds=inSecs)

        VegasBackend.start(self, starttime=dt)
    def __init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test = False, instance_id = 0):
        """
        Creates an instance of BeamformerBackend
        """

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test)

        # In the Beamformer, there are 2 GPUs, so we run multiple instances
        # of the 'pipeline': more then one player!
        self.instance_id = 0

        self.progdev()
        self.net_config()

        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank = False, cal = False, sig_ref_1 = False)
        self.start_hpc()

        self.fits_writer_program = 'bfFitsWriter'
        self.start_fits_writer()
Esempio n. 4
0
    def __init__(self,
                 theBank,
                 theMode,
                 theRoach,
                 theValon,
                 hpc_macs,
                 unit_test=False):
        """
        Creates an instance of VegasHBWBackend
        """

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon,
                              hpc_macs, unit_test)

        self.progdev()
        self.net_config()

        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank=False, cal=False, sig_ref_1=False)
        self.start_hpc()
        self.start_fits_writer()
Esempio n. 5
0
    def __init__(self,
                 theBank,
                 theMode,
                 theRoach,
                 theValon,
                 hpc_macs,
                 unit_test=False,
                 instance_id=None):
        """
        Creates an instance of BeamformerBackend
        """

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon,
                              hpc_macs, unit_test)

        # In the Beamformer, there are 2 GPUs, so we run multiple instances
        # of the 'pipeline': more then one player!
        # should be set in base class ...
        if instance_id is not None:
            self.instance_id = instance_id

        self.progdev()
        self.net_config()

        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank=False, cal=False, sig_ref_1=False)
        self.start_hpc()

        self.fits_writer_program = 'bfFitsWriter'
        self.start_fits_writer()
    def __init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test = False, instance_id = None):
        """
        Creates an instance of BeamformerBackend
        """

        # Read in the additional parameters from the configuration file
        self.read_parameters(theBank, theMode)
        # Clear shared memory segments
        command = "hashpipe_clean_shmem -I %d" %(self.instance)
        ps_clean = subprocess.Popen(command.split())
        ps_clean.wait()

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test)
        # Create the ARP table from the mac addresses in dibas.conf under [HPCMACS]
        self.name = theMode.backend_name.lower()
        self.hpc_macs = hpc_macs
        if self.roach:
            self.table = []
            for m in range(256):
                self.table.append(0xFFFFFFFFFFFF)
            for mac in self.hpc_macs:
                self.table[mac] = self.hpc_macs[mac]

        # Add additional dealer-controlled parameters
        self.params["int_length"] = self.setIntegrationTime

        # Generate ROACH 10-GbE source mac addresses
        self.mac_base0 = 0x020200000000 + (2**8)*self.xid + 1
        self.mac_base1 = 0x020200000000 + (2**8)*self.xid + 2
        self.mac_base2 = 0x020200000000 + (2**8)*self.xid + 3
        self.mac_base3 = 0x020200000000 + (2**8)*self.xid + 4

        self.source_ip0 = 10*(2**24) + 17*(2**16) + 16*(2**8) + 230
        self.source_ip1 = 10*(2**24) + 17*(2**16) + 16*(2**8) + 231
        self.source_ip2 = 10*(2**24) + 17*(2**16) + 16*(2**8) + 232
        self.source_ip3 = 10*(2**24) + 17*(2**16) + 16*(2**8) + 233

        # TODO: Add source port to configuration file
        self.source_port = 60000

        # In the Beamformer, there are 2 GPUs, so we run multiple instances
        # of the 'pipeline': more then one player!
        # should be set in base class ...
        if instance_id is not None:
            self.instance_id = instance_id

        self.progdev()
        self.net_config()
        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank = False, cal = False, sig_ref_1 = False)
        self.start_hpc()

        # self.fits_writer_program = 'bfFitsWriter'
        self.fits_writer_program = self.fits_writer_program_bf
        self.start_fits_writer()
    def start_old(self, inSecs, durSecs):
        """
        Start a scan in inSecs for durSecs long
        Now deprecated (Richard Black), use def start(self, starttime) instead
        """

        # our fake GPU simulator needs to know the start time of the scan
        # and it's duration, so we need to write it to status shared mem.
        def secs_2_dmjd(secs):
            dmjd = (secs / 86400) + 40587
            return dmjd + ((secs % 86400) / 86400.)

        inSecs = inSecs if inSecs is not None else 5
        durSecs = durSecs if durSecs is not None else 5
        print "self.scan_length= %f" % (self.scan_length)
        self.scan_length = durSecs
        print "self.scan_length after = %f" % (self.scan_length)

        # TBF: we've done our stuff w/ DMJD, but our start is a utc datetime obj
        now = time.time()
        startDMJD = secs_2_dmjd(int(now + inSecs))

        # NOTE: SCANLEN can also be set w/ player.set_param(scan_length=#)
        self.write_status(STRTDMJD=str(startDMJD), SCANLEN=str(durSecs))
        self.write_status(REQSTI=str(self.requested_integration_time))
        self.write_status(BWEIFILE=str(self.requested_weight_file))
        self.write_status(CHANSEL=str(self.requested_channel))

        self.weifile_old = self.weifile_new
        self.weifile_new = self.get_status('BWEIFILE')

        if self.weifile_old is self.weifile_new:
            print "Weight file name unchanged."
            self.write_status(WFLAG=str(0))
        else:
            print "Weight file name changed."
            self.write_status(WFLAG=str(1))

        dt = datetime.utcnow()
        dt.replace(second=0)
        dt.replace(microsecond=0)
        dt += timedelta(seconds=inSecs)

        print "In Vegas Backend!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        print "Vegas self.scan_length after = %f" % (self.scan_length)
        VegasBackend.start(self, starttime=dt)
        print "Vegas self.scan_length after = %f" % (self.scan_length)
        print "Out of Vegas Backend!!!!!!!!!!!!!!!!!!!!!"
    def __init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test = False):
        """
        Creates an instance of VegasHBWBackend
        """

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test)

        self.progdev()
        self.net_config()

        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank = False, cal = False, sig_ref_1 = False)
        self.start_hpc()
        self.start_fits_writer()
Esempio n. 9
0
 def stop(self):
     """
    Stops the FITS writer and restarts it immediately for the next scan
    @author Mark Ruzindana
    """
     # print "Hello there, little people"
     val = VegasBackend.stop(self)
     print val[0]
     if (val[0] == True):
         self.start_fits_writer()
    def __init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test=False):
        """
        Creates an instance of the vegas internals.
        """

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon, hpc_macs, unit_test)

        # gain array. May be 1 or 8 in length, depending on mode.
        self.gain = theMode.gain

        # setup the parameter dictionary/methods
        self.params["gain"] = self.setLBWGain

        # In LBW mode the spec_tick is computed differently than in HBW
        # mode. Inform the switching signal builder of the change.
        self.spec_tick = self.computeSpecTick()
        self.ss.set_spec_tick(self.spec_tick)
        self.ss.set_hwexposr(self.hwexposr)
        self.clear_switching_states()
        self.add_switching_state(1.0, blank=False, cal=False, sig_ref_1=False)
Esempio n. 11
0
    def start_old(self, inSecs, durSecs):
        """
        Start a scan in inSecs for durSecs long
        Now deprecated (Richard Black), use def start(self, starttime) instead
        """

        # our fake GPU simulator needs to know the start time of the scan
        # and it's duration, so we need to write it to status shared mem.
        def secs_2_dmjd(secs):
            dmjd = (secs / 86400) + 40587
            return dmjd + ((secs % 86400) / 86400.)

        inSecs = inSecs if inSecs is not None else 5
        durSecs = durSecs if durSecs is not None else 5
        print "self.scan_length= %f" % (self.scan_length)
        self.scan_length = durSecs
        print "self.scan_length after = %f" % (self.scan_length)

        # TBF: we've done our stuff w/ DMJD, but our start is a utc datetime obj
        now = time.time()
        startDMJD = secs_2_dmjd(int(now + inSecs))

        # NOTE: SCANLEN can also be set w/ player.set_param(scan_length=#)
        self.write_status(STRTDMJD=str(startDMJD), SCANLEN=str(durSecs))
        self.write_status(REQSTI=str(self.requested_integration_time))

        dt = datetime.utcnow()
        dt.replace(second=0)
        dt.replace(microsecond=0)
        dt += timedelta(seconds=inSecs)

        # Write the nchunk to shared memory
        print "Player: Writing NCHUNK=%d" % (self.nchunk)
        self.write_status(NCHUNK=self.nchunk)

        print "In Vegas Backend!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        print "Vegas self.scan_length after = %f" % (self.scan_length)
        VegasBackend.start(self, starttime=dt)
        print "Vegas self.scan_length after = %f" % (self.scan_length)
        print "Out of Vegas Backend!!!!!!!!!!!!!!!!!!!!!"
    def stop(self):
        """
       Stops the FITS writer and restarts it immediately for the next scan
       @author Mark Ruzindana
       """
        # print "Hello there, little people"
        val = VegasBackend.stop(self)

        if self.has_roaches:
            for roach in self.roaches:
                print "BFBE: Stop data flow for roach %s" % roach.host
                roach.write_int('pkt_stop', 1)
                time.sleep(.1)
                roach.write_int('pkt_stop', 0)

        print val[0]
        if (val[0] == True):
            self.start_fits_writer()
Esempio n. 13
0
    def __init__(self,
                 theBank,
                 theMode,
                 theRoach,
                 theValon,
                 hpc_macs,
                 unit_test=False,
                 instance_id=None):
        """
        Creates an instance of BeamformerBackend
        """

        # Read in the additional parameters from the configuration file
        self.read_parameters(theBank, theMode)

        # Print out configuration details
        if self.sim3:
            print "Using Simulator III (NOT the full ROACH system)"
        else:
            print "Using the full ROACH system"

        # Clear shared memory segments
        command = "hashpipe_clean_shmem -I %d" % (self.instance)
        ps_clean = subprocess.Popen(command.split())
        ps_clean.wait()

        # Make sure bogus fifo exists
        os.system('touch /tmp/bogus.fifo')

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon,
                              hpc_macs, unit_test)
        # Create the ARP table from the mac addresses in dibas.conf under [HPCMACS]
        self.name = theMode.backend_name.lower()
        self.hpc_macs = hpc_macs
        if self.roach:
            self.table = []
            for m in range(256):
                self.table.append(0xFFFFFFFFFFFF)
            for mac in self.hpc_macs:
                self.table[mac] = self.hpc_macs[mac]

        # Set some default parameter values
        self.requested_weight_file = ''
        self.nchunk = 0

        # Add additional dealer-controlled parameters
        self.params["int_length"] = self.setIntegrationTime
        self.params["weight_file"] = self.setNewWeightFilename
        self.params["nchunk"] = self.setFrequencyChunk

        # Generate ROACH 10-GbE source mac addresses
        self.mac_base0 = 0x020200000000 + (2**8) * self.xid + 1
        self.mac_base1 = 0x020200000000 + (2**8) * self.xid + 2
        self.mac_base2 = 0x020200000000 + (2**8) * self.xid + 3
        self.mac_base3 = 0x020200000000 + (2**8) * self.xid + 4

        self.source_ip0 = 10 * (2**24) + 17 * (2**16) + 16 * (2**8) + 230
        self.source_ip1 = 10 * (2**24) + 17 * (2**16) + 16 * (2**8) + 231
        self.source_ip2 = 10 * (2**24) + 17 * (2**16) + 16 * (2**8) + 232
        self.source_ip3 = 10 * (2**24) + 17 * (2**16) + 16 * (2**8) + 233

        # TODO: Add source port to configuration file
        self.source_port = 60000

        # In the Beamformer, there are 2 GPUs, so we run multiple instances
        # of the 'pipeline': more then one player!
        # should be set in base class ...
        if instance_id is not None:
            self.instance_id = instance_id

        self.progdev()
        self.net_config()
        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank=False, cal=False, sig_ref_1=False)
        self.start_hpc()

        self.fits_writer_program = 'bfFitsWriter'
        #self.fits_writer_program = self.fits_writer_program_bf
        self.start_fits_writer()
    def start(self,dt):
	VegasBackend.start(self,dt)
Esempio n. 15
0
 def stop(self):
     print "Hello there, little people"
     val = VegasBackend.stop(self)
     print val[0]
     if (val[0] == True):
         self.start_fits_writer()
Esempio n. 16
0
    def __init__(self,
                 theBank,
                 theMode,
                 theRoach,
                 theValon,
                 hpc_macs,
                 unit_test=False,
                 instance_id=None):
        """
        Creates an instance of BeamformerBackend
        """

        # Get Instance ID
        self.get_instance_id(theBank, theMode)
        self.instance_id = self.instance

        # Clear shared memory segments
        command = "hashpipe_clean_shmem -I %d" % (self.instance)
        ps_clean = subprocess.Popen(command.split())
        ps_clean.wait()

        VegasBackend.__init__(self, theBank, theMode, theRoach, theValon,
                              hpc_macs, unit_test)

        # Read in the additional parameters from the configuration file
        self.read_parameters(theBank, theMode)

        # Create the ARP table from the mac addresses in dibas.conf under [HPCMACS]
        self.name = theMode.backend_name.lower()
        self.hpc_macs = hpc_macs
        if self.roach:
            self.table = []
            for m in range(256):
                self.table.append(0xFFFFFFFFFFFF)
            for mac in self.hpc_macs:
                self.table[mac] = self.hpc_macs[mac]

        # Set some default parameter values
        self.requested_weight_file = ''
        self.weifile2 = ''
        self.requested_channel = 0

        # Add additional dealer-controlled parameters
        self.params["int_length"] = self.setIntegrationTime
        self.params["weight_file"] = self.setNewWeightFilename
        self.params["channel_select"] = self.setChannel

        # Set weight flag to default value of 0
        self.write_status(WFLAG=str(0))

        # Generate ROACH 10-GbE source mac addresses
        self.mac_base0 = 0x020200000000 + (2**8) * self.xid + 1
        self.mac_base1 = 0x020200000000 + (2**8) * self.xid + 2
        self.mac_base2 = 0x020200000000 + (2**8) * self.xid + 3
        self.mac_base3 = 0x020200000000 + (2**8) * self.xid + 4

        self.source_ip0 = 10 * (2**24) + 10 * (2**16) + 1 * (
            2**8) + 101 + self.xid * 4
        self.source_ip1 = 10 * (2**24) + 10 * (2**16) + 1 * (
            2**8) + 102 + self.xid * 4
        self.source_ip2 = 10 * (2**24) + 10 * (2**16) + 1 * (
            2**8) + 103 + self.xid * 4
        self.source_ip3 = 10 * (2**24) + 10 * (2**16) + 1 * (
            2**8) + 104 + self.xid * 4

        # TODO: Add source port to configuration file
        self.source_port = 60000

        # In the Beamformer, there are 2 GPUs, so we run multiple instances
        # of the 'pipeline': more then one player!
        # should be set in base class ...
        if instance_id is not None:
            self.instance_id = instance_id

        self.progdev()
        self.net_config()

        if self.mode.roach_kvpairs:
            self.write_registers(**self.mode.roach_kvpairs)

        self.reset_roach()
        self.prepare()
        self.clear_switching_states()
        self.add_switching_state(1.0, blank=False, cal=False, sig_ref_1=False)
        self.start_hpc()

        # self.fits_writer_program = 'bfFitsWriter'
        self.start_fits_writer()