Updated LTSA code

My first blog post for conservationcoding.com was how to make a long term spectral average (LTSA) in PAMGuard. However, since then, the PAMGuard MATLAB library has been updated for the new version 2.0+. So, in a very short blog post, here’s the updated code.

To make this code work you need LTSA data collected in PAMGuard using the LTSA module. This can run in real time or port processing of wav files. If throwing data away, e.g. by saving only detection data during real time operation it’s very useful to have a LTSA- it doesn’t take up much memory space but provides some useful context of the overall soundscape. So for example, if you detect lots of porpoises but on manual inspection the clicks look a bit suspect, you can refer to the LTSA to see if an echosounder might have been present or perhaps there’s lots of broadband noise. I wrote in a previous post how to set up the PAMGuard LTSA module and here I’ve provided¬† some example data including the updated function.

The updated function is pretty simple to use and, if correct data acquisition card peak to peak voltage, hydrophone sensitivity and total gain is correctly input should provide a proper root hertz measurment of spectral density.

folder='E:\Google Drive\SMRU_research\Gill nets 2016\SoundTrap4c_wet_test_2\Binary1c\20170707';
channel=0; %use channel zero (these data are form one channel anyway)
plotLTSA=true; %true to autimaticall plot the LTSA
hsens=-171;%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=100000000; %time end
climits=[10,60]; %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.Label.FontSize = 12;
c.Label.String = 'dB re 1\muPa \surdHz';

The example script above plots a days data from a SoundTrap. The only variable that needs changing is folder which should point to wherever you’ve saved the example data or your own PAMGuard LTSA data.¬† If you use the example files you should see the LTSA below . Note some 200kHz echosounders are very obvious but other than that, in this example, there’s not a lot going on. If you play around with the colour limits e.g. caxis([20 35]) you’ll start to see a few other featuresLTSA_example

Ok, that’s it for now. Thanks for reading.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s