Skip to content

Commit 9700060

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent eb054c5 commit 9700060

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

.github/workflows/noise_processing.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
schedule:
77
- cron: '2 * * * *'
8-
8+
99
jobs:
1010
process:
1111
runs-on: ubuntu-latest
@@ -22,12 +22,12 @@ jobs:
2222
run: |
2323
pip install -r requirements_noise.txt
2424
25-
25+
2626
- name: Install ffmpeg
2727
run: |
2828
sudo apt-get update
2929
sudo apt-get install ffmpeg
30-
30+
3131
- uses: awalsh128/cache-apt-pkgs-action@latest
3232
with:
3333
packages: ffmpeg
@@ -53,6 +53,6 @@ jobs:
5353
# uses: AnimMouse/setup-rclone@v1
5454
# with:
5555
# rclone_config: ${{secrets.RCLONE_CONFIG}}
56-
#
56+
#
5757
# - run: |
5858
# rclone copy ambient_sound_analysis/img/broadband.png mydrive:rclone_uploads/

noise_processing.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
# importing general Python libraries
2-
import pandas as pd
32
import datetime as dt
43
import os
4+
55
import matplotlib.pyplot as plt
6-
import pytz
6+
import pandas as pd
77
import plotly.graph_objects as go
8+
import pytz
9+
from orcasound_noise.pipeline.acoustic_util import plot_bb, plot_spec
810

911
# importing orcasound_noise libraries
1012
from orcasound_noise.pipeline.pipeline import NoiseAnalysisPipeline
1113
from orcasound_noise.utils import Hydrophone
12-
from orcasound_noise.pipeline.acoustic_util import plot_spec, plot_bb
13-
1414

1515
# Set Location and Resolution
1616
# Port Townsend, 1 Hz Frequency, 60-second samples
17-
if __name__ == '__main__':
18-
pipeline = NoiseAnalysisPipeline(Hydrophone.BUSH_POINT,
19-
delta_f=10, bands=None,
20-
delta_t=60, mode='safe')
21-
22-
17+
if __name__ == "__main__":
18+
pipeline = NoiseAnalysisPipeline(
19+
Hydrophone.BUSH_POINT, delta_f=10, bands=None, delta_t=60, mode="safe"
20+
)
2321

2422

2523
# Generate parquet dataframes with noise levels for a time period
2624

27-
now = dt.datetime.now(pytz.timezone('US/Pacific'))
25+
now = dt.datetime.now(pytz.timezone("US/Pacific"))
2826
# now = dt.datetime(2024, 11, 20, 10)
2927
# now = dt.datetime(2025, 1, 16, 10)
30-
psd_path, broadband_path = pipeline.generate_parquet_file(now - dt.timedelta(hours = 6),
31-
now - dt.timedelta(hours = 1),
32-
upload_to_s3=False)
28+
psd_path, broadband_path = pipeline.generate_parquet_file(
29+
now - dt.timedelta(hours=6), now - dt.timedelta(hours=1), upload_to_s3=False
30+
)
3331

3432
# Read the parquet files
3533
psd_df = pd.read_parquet(psd_path)
3634
bb_df = pd.read_parquet(broadband_path)
3735

3836
# Create a new directory if it does not exist
39-
if not os.path.exists('img'):
40-
os.makedirs('img')
37+
if not os.path.exists("img"):
38+
os.makedirs("img")
4139

42-
# Create and save psd plot
40+
# Create and save psd plot
4341
fig = plot_spec(psd_df)
44-
fig.write_image('img/psd.png')
42+
fig.write_image("img/psd.png")
4543

4644
# Create and save bb plot
4745
fig = plot_bb(bb_df)
48-
fig.savefig('img/broadband.png')
46+
fig.savefig("img/broadband.png")

requirements_noise.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
matplotlib
2-
# scipy
3-
m3u8
1+
matplotlib
2+
# scipy
3+
m3u8
44
git+https://github.com/kkroening/ffmpeg-python
55
orcasound_noise@git+https://github.com/orcasound/ambient-sound-analysis
66
kaleido

tests/test_ooi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Unit tests for OOI workflow"""
2+
23
import datetime
34
import os
45
import shutil

tests/test_spectrograms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Unit tests for various util functions relating to spectrogram creation"""
2+
23
import os.path
34

45
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)