-
Notifications
You must be signed in to change notification settings - Fork 0
/
tx_power.py
38 lines (31 loc) · 1.21 KB
/
tx_power.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as n
import matplotlib.pyplot as plt
from digital_rf import DigitalRFReader, DigitalMetadataReader, DigitalMetadataWriter
import scipy.interpolate as sint
def get_tx_power_model(dirn="/media/j/fee7388b-a51d-4e10-86e3-5cabb0e1bc13/isr/2023-09-05/usrp-rx0-r_20230905T214448_20230906T040054/metadata/powermeter"):
print("Reading transmit power meter metadata. Might take a few seconds")
dmd=DigitalMetadataReader(dirn)
b=dmd.get_bounds()
zenith_t=[]
zenith_pwr=[]
misa_t=[]
misa_pwr=[]
sid = dmd.read(b[0],b[1],"zenith_power")
for keyi,key in enumerate(sid.keys()):
zenith_t.append(key)
zenith_pwr.append(sid[key])
# print("%1.2f %1.2f"%(key,sid[key]))
sid = dmd.read(b[0],b[1],"misa_power")
for keyi,key in enumerate(sid.keys()):
misa_t.append(key)
misa_pwr.append(sid[key])
# print("%1.2f %1.2f"%(key,sid[key]))
if False:
plt.plot(zenith_t,zenith_pwr)
plt.plot(misa_t,misa_pwr)
plt.show()
zenith_pwrf=sint.interp1d(zenith_t,zenith_pwr)
misa_pwrf=sint.interp1d(misa_t,misa_pwr)
return(zenith_pwrf,misa_pwrf)
if __name__ == "__main__":
get_tx_power_model()