function [] = LoadDensity(client, shotnum)
% Load the density data
% 

dataStruct = client.getData('POST.PROCESSED.DENSITY','0x0000', shotnum);
densityData = dataStruct(1).getData;            
len = length(densityData);

densityOffset = mean(densityData(50:100));

tstart = dataStruct(1).getTStart;
tend = dataStruct(1).getTEnd;
tbs = (tend.getTimeInMicros - tstart.getTimeInMicros)/len;
events = dataStruct(1).getEvents;
tevent = events(1).getTimeStamp;


delay = tstart.getTimeInMicros - tevent.getTimeInMicros;
densityTimes = delay:tbs:delay+tbs*(len-1);
density = (densityData-densityOffset);                   % adjust the offset
densityTimes=densityTimes/1000;                          % convert to ms

figure(2);
plot(densityTimes, density)
title(['Shot number ' num2str(shotnum)], 'fontsize', 16);
xlabel('time (ms)');
ylabel('density');
grid on;
