
clear all

% read the received power
datafile=[cd '/rio_KIL_20250102/rio_KIL_20250102_h5/KIL_2025-01-02.h5'];

% h5disp(datafile) % use this to check what's in there
data=h5read(datafile,'/data');
P=data(1:141,:)+data(142:end,:);

timestamp=h5read(datafile,'/timestamp');
t=timestamp/(24*60*60)+datenum(1970,1,1);
f=h5read(datafile,'/freq');


% make one min averages
%P1min=reshape(mean(reshape(P',60,prod(size(P))/60)),1440,141)';

% read the qdc
qdcfile=[cd '/rio_KIL_20250102/rio_KIL_20250102_h5/KIL_QDC2_2025-01-02.h5'];
qdc0=h5read(qdcfile,'/qdc');
qdct0=double(h5read(qdcfile,'/t'));

qdct=qdct0/(24*60*60)+t(1);
qdc=interp1(qdct',qdc0',t')';
qdc=10.^(qdc/10);

AdB=10*log10(qdc./P);
pcolor(t,f,AdB), shading flat






