9
$\begingroup$

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
 
%load and plot LTSA data
[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:

enter image description here

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!

$\endgroup$
1
  • $\begingroup$ Hi Laura, do you have access to matlab by chance? $\endgroup$ Aug 4, 2022 at 17:06

2 Answers 2

9
$\begingroup$

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
gain =0; % additonal gain
vp2p = 2; %V Daq card peak to peak voltage range
sR = 384000; % sample rate.

% calculate a datagram
[datagram, summarydat, metadata] = loaddatagram(pamguardbinaryfolder, detindex, ...
    'TimeBin', 10, 'Gain', gain, 'HSens', hsens, 'vp2p', 2);

% plot the datagram
metadata.sR = sR;
[s, c] = plotdatagram(datagram, metadata);
datetick('KeepLimits', 'x')
set(gca, 'FontSize', 14)

To specifically answer your three questions.

  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.
  2. See example above.
  3. Will resolve with 2.
$\endgroup$
3
$\begingroup$

In the PAMGuard Matlab library at https://github.com/PAMGuard/PAMGuardMatlab there is a function LoadPamguardBinaryFolder which will load all data from a folder with sub folders. This will save you looping through individual files. See Matlab help for how to set axis values on a colour plot.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.