def configure(self): """ Configure the beams from the config source. This is done whenever an instrument is instantiated. :return: """ if self.beams: raise RuntimeError("Beamformer ops already configured.") # get beam names from config beam_names = [] self.beams = {} for k in self.corr.configd: if k.startswith("beam"): bmnm = self.corr.configd[k]["output_products"] if bmnm in beam_names: raise ValueError( "Cannot have more than one beam with " "the name %s. Please check the " "config file." % bmnm ) newbeam = Beam.from_config(k, self.hosts, self.corr.configd, self.corr.speadops) self.beams[newbeam.name] = newbeam beam_names.append(bmnm.strip()) self.logger.info("Found beams: %s" % beam_names) # configure the beams for beam in self.beams.values(): beam.configure() # add the beam data streams to the instrument list for beam in self.beams.values(): self.corr.register_data_stream(beam.data_stream)
def configure(self, *args, **kwargs): """ Configure the beams from the config source. This is done whenever an instrument is instantiated. :return: """ if self.beams: raise RuntimeError('Beamformer ops already configured.') # get beam names from config beam_names = [] self.beams = {} max_pkt_size = self.corr.b_stream_payload_len for section_name in self.corr.configd: if section_name.startswith('beam'): beam = Beam.from_config(section_name, self.hosts, self.corr.configd, self.corr.fops, self.corr.speadops, max_pkt_size=max_pkt_size, *args, **kwargs) if beam.name in beam_names: raise ValueError('Cannot have more than one beam with ' 'the name %s. Please check the ' 'config file.' % beam.name) self.beams[beam.name] = beam beam_names.append(beam.name) self.logger.info('Found {} beams: {}'.format(len(beam_names), beam_names)) # add the beam data streams to the instrument list for beam in self.beams.values(): self.corr.add_data_stream(beam)