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