Product specifications
NRAO Linux Python Library
26
@return: dBm (int)
"""
rfl_table = {0: -4, 1: -1, 2: 2, 3: 5}
self.conn.open()
bytes = struct.pack('>B', 0x80 | synth)
self.conn.write(bytes)
bytes = self.conn.read(24)
checksum = self.conn.read(1)
self.conn.close()
#self._verify_checksum(bytes, checksum)
reg0, reg1, reg2, reg3, reg4, reg5 = struct.unpack('>IIIIII', bytes)
rfl = (reg4 >> 3) & 0x03
rf_level = rfl_table.get(rfl)
return rf_level
def set_rf_level(self, synth, rf_level):
"""
Set RF level
@param synth : synthesizer address, 0 or 8
@type synth : int
@param rf_level : RF power in dBm
@type rf_level : int
@return: True if success (bool)
"""
rfl_rev_table = {-4: 0, -1: 1, 2: 2, 5: 3}
rfl = rfl_rev_table.get(rf_level)
if(rfl is None): return False
self.conn.open()
bytes = struct.pack('>B', 0x80 | synth)
self.conn.write(bytes)
bytes = self.conn.read(24)
checksum = self.conn.read(1)
#self._verify_checksum(bytes, checksum)
reg0, reg1, reg2, reg3, reg4, reg5 = struct.unpack('>IIIIII', bytes)
reg4 &= 0xffffffe7
reg4 |= (rfl & 0x03) << 3
bytes = struct.pack('>BIIIIII', 0x00 | synth,
reg0, reg1, reg2, reg3, reg4, reg5)
checksum = self._generate_checksum(bytes)
self.conn.write(bytes + checksum)
bytes = self.conn.read(1)
self.conn.close()
ack = struct.unpack('>B', bytes)[0]
return ack == ACK
def get_options(self, synth):
"""
Get options tuple:
bool double: if True, reference frequency is doubled
bool half: if True, reference frequency is halved
int r: reference frequency divisor
bool low_spur: if True, minimizes PLL spurs;
if False, minimizes phase noise
double and half both True is same as both False.
@param synth : synthesizer address
@return: double (bool), half (bool), r (int), low_spur (bool)
"""
self.conn.open()
bytes = struct.pack('>B', 0x80 | synth)
self.conn.write(bytes)
bytes = self.conn.read(24)