Skip to content

Commit b72f849

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

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

.github/workflows/noise_processing.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
# schedule:
77
# - cron: '9 * * * *'
8-
8+
99
jobs:
1010
process:
1111
runs-on: ubuntu-latest
@@ -22,7 +22,7 @@ jobs:
2222
python -m pip install -U setuptools wheel
2323
python -m pip install -r requirements_noise.txt
2424
25-
25+
2626
- name: Install ffmpeg
2727
run: |
2828
sudo apt-get update
@@ -43,4 +43,3 @@ jobs:
4343
with:
4444
commit_message: Commit to Github
4545
file_pattern: 'img/*.png'
46-

noise_processing.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
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.PORT_TOWNSEND,
19-
delta_f=10, bands=None,
20-
delta_t=60, mode='safe')
21-
22-
17+
if __name__ == "__main__":
18+
pipeline = NoiseAnalysisPipeline(
19+
Hydrophone.PORT_TOWNSEND, 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'))
28-
psd_path, broadband_path = pipeline.generate_parquet_file(now - dt.timedelta(hours = 6),
29-
now - dt.timedelta(hours = 1),
30-
upload_to_s3=False)
25+
now = dt.datetime.now(pytz.timezone("US/Pacific"))
26+
psd_path, broadband_path = pipeline.generate_parquet_file(
27+
now - dt.timedelta(hours=6), now - dt.timedelta(hours=1), upload_to_s3=False
28+
)
3129

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

3634
# Create a new directory if it does not exist
37-
if not os.path.exists('img'):
38-
os.makedirs('img')
35+
if not os.path.exists("img"):
36+
os.makedirs("img")
3937

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

4442
# Create and save bb plot
4543
fig = plot_bb(bb_df)
46-
fig.savefig('img/broadband.png')
44+
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@plotting_update
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)