def __init__(self, name, inputs=None, output_names=[], active=True): """ In most Device types, the first argument is the device providing the signal source. In the case of a Switch it is the instance which "owns" the switch, which may be an observatory or a telescope. Use the attribute 'sources' to see where the signal comes from. @param observatory : argument to pass to Switch() as the parent @type observatory : Observatory() instance @param swID : logical switch in the matrix, keyed to output port @type swID : int """ mylogger = logging.getLogger(module_logger.name + ".MS287") self.name = name # needed by the next statement mylogger.debug(" initializing %s", self) show_port_sources(inputs, " Inputs to MS287:", mylogger.level) Device.__init__(self, name, inputs=inputs, output_names=output_names, active=active) self.logger = mylogger show_port_sources(inputs, " MS287 inputs redefined:", mylogger.level) self.name = name self.hw = get_device_server("MS287server") self.channel = {} for name in output_names: self.channel[name] = self.Channel(self, name, inputs=self.inputs, output_names=[name], active=active) self.logger.debug(" %s outputs: %s", self.name, self.outputs)
def __init__(self, parent, name, inputs=None, output_names=None, active=True): """ """ self.parent = parent self.name = name mylogger = logging.getLogger(logger.name + ".WBDC2.RFsection") mylogger.debug("__init__: for WBDC2 %s", self) show_port_sources( inputs, "WBDC2.RFsection.__init__: inputs before WBDC_base.RFsection init:", mylogger.level) self.inputs = inputs WBDC_base.RFsection.__init__(self, parent, name, inputs=inputs, output_names=output_names, active=True) show_port_sources( self.inputs, "WBDC2.RFsection.__init__: inputs after WBDC_base.RFsection init:", mylogger.level) show_port_sources( self.outputs, "WBDC2.RFsection.__init__: outputs after WBDC_base.RFsection init:", mylogger.level) self.logger = mylogger self._update_signals()
def __init__(self, parent, name, inputs=None, output_names=None, active=True): self.type = MS287.switch_type self.parent = parent self.name = name self.ID = int(name[-1]) - 1 mylogger = logging.getLogger(self.parent.logger.name + ".Channel") show_port_sources(inputs, " Inputs to %s:" % self, mylogger.level) Switch.__init__(self, name, inputs=inputs, output_names=[name], stype=self.type, active=active) self.logger = mylogger show_port_sources(self.inputs, " %s inputs redefined:" % str(self), self.logger.level) self.parent.outputs[name] = self.outputs[name]
def __init__(self, parent, name, inputs=None, output_names=None, active=True): self.parent = parent mylogger = logging.getLogger(module_logger.name+".RFsection") mylogger.debug(" initializing WBDC_core %s", self) show_port_sources(inputs, "WBDC_core.RFsection inputs before superclass init:", mylogger.level) WBDC_base.RFsection.__init__(self, parent, name, inputs=inputs, output_names=output_names, active=True) show_port_sources(self.inputs, "WBDC_core.RFsection inputs after superclass init:", mylogger.level) show_port_sources(self.outputs, "WBDC_core.RFsection outputs after superclass init:", mylogger.level) self.logger = mylogger
def __init__(self, name, inputs=None, output_names=None, active=True, hardware=None): """ Initialize a WBDC2 object. @param name : unique identifier @type name : str @param inputs : a dict with sources for different inputs @type inputs : dict of str:str @param output_names : names of the output channels/ports @type output_names : list of str @param active : True is the FrontEnd instance is functional @type active : bool @param hardware : True if this client connects to the hardware server @type hardware : dict keyed with generic hardware names """ self.name = name if hardware: from support.pyro import get_device_server, pyro_server_request self.hardware = get_device_server("wbdc2hw_server-dss43wbdc2", pyro_ns="crux") self.atten_keys = pyro_server_request(self.hardware.get_atten_IDs) else: self.hardware = None mylogger = logging.getLogger(logger.name + ".WBDC2") mylogger.debug("__init__: for %s", self) show_port_sources(inputs, "WBDC2.__init__: inputs before WBDC_base init:", mylogger.level) if hardware: uri = Pyro5.api.URI("PYRO:Spec@localhost:50003") self.hardware = Pyro5.api.Proxy(uri) try: self.hardware.__get_state__() except Pyro5.errors.CommunicationError as details: mylogger.error("__init__: %s", details) raise Pyro5.errors.CommunicationError( "is the SAO spec server running?") except AttributeError: # no __get_state__ because we have a connection pass else: # use the simulator self.hardware = None WBDC_base.__init__(self, name, active=active, inputs=inputs, output_names=output_names) if inputs is not None: show_port_sources(self.inputs, "WBDC2.__init__: inputs after WBDC_base init:", mylogger.level) show_port_sources(self.outputs, "WBDC2.__init__: outputs after WBDC_base init:", mylogger.level) self.logger = mylogger self.data['bandwidth'] = 1e10 # Hz # The transfer switch is created in WBDC_base if self.hardware: self.crossSwitch.get_state() else: self.crossSwitch.set_state(False) # the four transfer switch outputs (2 feeds, 2 pols) are RF section inputs rfs = list(self.crossSwitch.outputs.keys()) rfs.sort() self.logger.debug("__init__: transfer switch outputs: %s", rfs) self.rf_section = {} for rf in rfs: index = rfs.index(rf) rf_inputs = {} outnames = [] rf_inputs[rf] = self.crossSwitch.outputs[rf] self.logger.debug(" __init__: RF %s inputs is now %s", rf, rf_inputs) for band in WBDC2.bands: outnames.append(rf + band) self.rf_section[rf] = self.RFsection(self, rf, inputs=rf_inputs, output_names=outnames) self.logger.debug(" __init__: RF %s outputs is now %s\n", rf, self.rf_section[rf].outputs) # Outputs from two RFsections for each feed and band feed a pol section self.pol_sec = {} for band in WBDC2.bands: for rx in WBDC_base.RF_names: psec_inputs = {} psec_name = rx + '-' + band for pol in WBDC_base.pol_names: psec_inputs[pol] = self.rf_section[rx + pol].outputs[rx + pol + band] self.logger.debug(" __init__: PolSection %s inputs is now %s", psec_name, psec_inputs) self.pol_sec[psec_name] = self.PolSection(self, psec_name, inputs=psec_inputs) self.pol_sec[psec_name].data['band'] = band self.pol_sec[psec_name].data['receiver'] = rx self.pol_sec[psec_name]._get_state() self.logger.debug(" __init__: pol section %s outputs: %s", self.pol_sec[psec_name].name, list(self.pol_sec[psec_name].outputs.keys())) pol_sec_names = list(self.pol_sec.keys()) pol_sec_names.sort() self.logger.debug(" __init__: pol sections: %s\n", pol_sec_names) # Each pol section has two outputs, each going to a down-converter # Each down-converter has two IF outputs self.DC = {} for name in pol_sec_names: for pol in WBDC_base.out_pols: self.logger.debug("__init__: making DC for %s", name + pol) self.logger.debug("__init__: creating inputs for %s", name + pol) dc_inputs = { name + pol: self.pol_sec[name].outputs[name + pol] } self.DC[name + pol] = self.DownConv(self, name + pol, inputs=dc_inputs) rx, band = name.split('-') self.DC[name + pol].data['receiver'] = rx self.DC[name + pol].data['band'] = band self.DC[name + pol].data['pol'] = pol self.DC[name + pol]._get_state() self.logger.debug("__init__: DC %s created", self.DC[name + pol]) self._update_signals() # invokes WBDC_base._update_signals() # debug outputs self.logger.debug("__init__: %s outputs: %s", self, str(self.outputs)) self.analog_monitor = self.AnalogMonitor(self) self.logger.debug(" initialized for %s", self.name)