Simple Analysis of Recording Levels#
This tutorial covers the basic steps required to load recording data, make a simple spectrogram, and how to compute and plot hourly averages over a single day.
Initialization code
>>> import uwacan
>>> from pathlib import Path
>>> data_path = Path(r"D:\ExampleData\LongRecording")
Sensor information#
To load data from recordings and convert it to physical units, we need to specify some information about the sensor used to do the recording.
For a simple level analysis, only the sensor sensitivity is required, but for other types of analysis the position and depth of the sensor might also be needed.
We store the information in a sensor object:
>>> sensor = uwacan.sensor(
... "RTsys 1",
... sensitivity=-179.2,
... position="58° 51.065'N 11° 4.569'E",
... depth=18,
... )
The first argument gives a label. In uwacan, sensors always have to be labeled.
Recordings#
Recordings are object is responsible for loading time-data from disk, and performs conversions from the data storage format to physical units:
>>> recording = uwacan.recordings.SylenceLP.read_folder(
... data_path / "RTsys 1" / "timedata",
... sensor=sensor,
... )
>>> print(recording.time_window)
TimeWindow(start=2024-08-01 00:19:58Z, stop=2024-08-04 00:26:07.952Z)
Some common recording types are implemented in uwacan.recordings.
Spectrogram#
To compute a detailed Spectrogram, we start by selecting a shorter time to compute it over.
This is done using the subwindow method, which is implemented on most of the objects which hold time dependent data:
>>> selection = recording.subwindow(start="2024-08-02 06:30:00z", duration=10 * 60)
>>> time_data = selection.time_data()
>>> spectrogram = uwacan.analysis.Spectrogram.analyze_timedata(
... time_data,
... hybrid_resolution=2,
... bands_per_decade=100,
... min_frequency=10,
... max_frequency=40e3,
... )
>>> fig = spectrogram.make_figure()
>>> fig.add_trace(spectrogram.plot(zmin=30, zmax=90))
>>> fig.show()