# Date ticked LTSA using PAMGuard binaries from duty cycled soundtrap data

I am trying to produce an LTSA of a 3 week period of data from 2018 and the same period in 2020. My 2018 data was collected using a SoundTrap on a 10 min on/10 min off duty cycle. I have processed the files in PAMGuard to create LTSA binary files and found the below code from the very helpful Conservation Coding blog.

folder='D:\PAMGUARD\PAMBinary\Depl953\20180626';
channel=0; %use channel zero (these data are form one channel anyway)
plotLTSA=true; %true to autimaticall plot the LTSA
hsens=-172.3;%hydrophone sensitivity in dB re 1V/uPa
vp2p=2; %peak to peak voltage in dB
gain=0; %gain in dB
day_num_start=0; %time start
day_num_end=200000000; %time end
climits=[40,120]; %colour limits in dB root Hertz

[ltsa_spectrum, ltsa_time, interval, ltsa_spectrumdB] = load_LTSA_folder(...
folder, channel, day_num_start, day_num_end, plotLTSA, hsens, vp2p, gain, climits);

%make a colour bar showing the spectral density
colormap jet;
ax = gca;
c=colorbar;
c.Label.FontSize = 12;
c.Label.Interpreter='tex';
c.Label.String = 'dB re 1\muPa \surdHz';


This plots the following LTSA:

My questions are:

1. PAMGuard binary files are organised in folders by day. Is there a simple way to load more than one folder at a time so I can plot 3 weeks on one LTSA or do I need to loop through each folder?
2. How can I make my x-axis dates/times as opposed to time in minutes?
3. This may resolve itself after addressing (2), but, how can I include the duty cycle in the LTSA aka have 'blank' where there was no data? I want this because I want to plot the same 3-week period from 2018 and 2020 in a multiplot figure to allow qualitative comparison of course-scale noise variability within and between years.

Thanks!

• Hi Laura, do you have access to matlab by chance? Aug 4 at 17:06

Try using PAMGuard's datagram library instead - this has all the features for making an LTSA with date/time ticks and much more.

LTSA example below.

%% load an LTSA and plot
pamguardbinaryfolder ='/path/to/binary/folder

detindex = 4; %LTSA
hsens = -175; % dB re 1V/uPa hydrophone sensitivity
vp2p = 2; %V Daq card peak to peak voltage range
sR = 384000; % sample rate.

% calculate a datagram
'TimeBin', 10, 'Gain', gain, 'HSens', hsens, 'vp2p', 2);

% plot the datagram

1. Yes, use the loadPamguardBinaryFolder function in the latest PAMGuard-MATLAB library to load folders and sub folders of binary files. See function help for description of usage.