slight power cal improvement

This commit is contained in:
Brendan Haines 2025-04-12 23:04:59 -06:00
parent 9912e318a8
commit 383fe3ceea

View File

@ -189,22 +189,20 @@ class Charon:
) )
def set_output_power(self, power: float): def set_output_power(self, power: float):
# FIXME: this is a hack because I don't want to go through re-calibration pout = xr.DataArray(
if power == 5: [-15, -10, -5, 0, 5],
tx_gain = -1 dims=["tx_gain"],
elif power == 0: coords=dict(
tx_gain = -7 # TODO: correct over frequency
elif power == -5: frequency=1e9, # FIXME: I'm not sure at what frequency I generated this table
tx_gain = -12 tx_channel=0,
elif power == -10: tx_gain=[-22, -17, -12, -7, -1],
tx_gain = -17 ),
elif power == -15: )
tx_gain = -22
else: tx_gain_idx = np.abs(pout - power).argmin(dim="tx_gain")
raise NotImplementedError() tx_gain = pout.coords["tx_gain"][tx_gain_idx]
# # TODO: correct over frequency
# tx_gain_idx = np.abs(pout.sel(tx_channel=0) - power).argmin(dim="tx_gain")
# tx_gain = pout.coords["tx_gain"][tx_gain_idx]
self.sdr.tx_hardwaregain_chan0 = float(tx_gain) self.sdr.tx_hardwaregain_chan0 = float(tx_gain)
def set_output(self, frequency: float, power: float): def set_output(self, frequency: float, power: float):