Skip to content

Commit

Permalink
Docstring fixes, notebook text
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcvey3 committed Aug 27, 2024
1 parent 1fd72f0 commit d330162
Show file tree
Hide file tree
Showing 3 changed files with 330 additions and 104 deletions.
375 changes: 278 additions & 97 deletions examples/acoustics_example.ipynb

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions examples/data/acoustics/6247_calibration.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Frequency,Analog Sensitivity,
1,-223.49,
1.183,-220.8,
1.399,-218.13,
1.655,-215.41,
1.958,-212.68,
2.316,-209.91,
2.74,-207.12,
3.241,-204.29,
3.834,-201.45,
4.535,-198.58,
5.364,-195.69,
6.345,-192.79,
7.506,-189.85,
8.879,-186.9,
10.5,-183.93,
12.42,-180.93,
14.7,-177.92,
17.38,-174.97,
20.56,-172.16,
24.33,-169.61,
28.78,-167.69,
34.04,-166.52,
40.26,-165.96,
47.63,-165.81,
56.34,-165.85,
66.65,-165.95,
78.84,-166.05,
93.26,-166.13,
110.3,-166.2,
130.5,-166.25,
154.4,-166.28,
182.6,-166.29,
216,-166.29,
255.5,-166.27,
302.2,-166.24,
357.5,-166.17,
422.9,-166.03,
500.3,-165.79,
591.8,-165.47,
700,-164.87,
18 changes: 11 additions & 7 deletions mhkit/acoustics/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ def read_hydrophone(
peak_V: numeric
Peak voltage supplied to the analog to digital converter (ADC) in V.
(Or 1/2 of the peak to peak voltage).
Sf: numeric
sensitivity: numeric
Hydrophone calibration sensitivity in dB re 1 V/uPa.
Should be negative. Default: None.
gain: numeric
Amplifier gain in dB re 1 V/uPa. Default 0.
start_time: str
Start time in the format yyyy-mm-ddTHH:MM:SS
Returns
-------
out: numpy.array
Sound pressure [Pa] or Voltage [V] indexed by time[s]
"""

if peak_V is None:
raise ValueError(
"Please provide the peak voltage of the hydrophone's ADC `peak_V`."
Expand Down Expand Up @@ -150,7 +153,7 @@ def read_soundtrap(filename, sensitivity=None, gain=0):
----------
filename: string
Input filename
Sf: numeric
sensitivity: numeric
Hydrophone calibration sensitivity in dB re 1 V/uPa.
Should be negative.
gain: numeric
Expand Down Expand Up @@ -198,16 +201,17 @@ def read_iclisten(filename, sensitivity=None, use_metadata=True):
----------
filename: string
Input filename
Sf: numeric
sensitivity: numeric
Hydrophone calibration sensitivity in dB re 1 V/uPa.
Should be negative.
gain: numeric
Amplifier gain in dB re 1 V/uPa. Default 0.
Should be negative. Default: None.
use_metadata: bool
If True and `sensitivity` = None, applies sensitivity value stored in .wav file LIST block.
If False and `sensitivity` = None, a sensitivity value isn't applied
Returns
-------
out: numpy.array
Sound pressure [Pa] indexed by time[s]
Sound pressure [Pa] or [V] indexed by time[s]
"""

# Read icListen metadata from file header
Expand Down

0 comments on commit d330162

Please sign in to comment.