Skip to content

Commit

Permalink
Merge pull request #349 from digitraceslab/audio_bugfix
Browse files Browse the repository at this point in the history
Audio bugfix (1.2.2)
  • Loading branch information
rantahar authored Oct 23, 2024
2 parents 82c5ae0 + 4b73004 commit b7bbbbd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Binary file added dist/niimpy-1.2.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/niimpy-1.2.2.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion niimpy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.2.1'
__version__ = '1.2.2'
2 changes: 1 addition & 1 deletion niimpy/preprocessing/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def audio_count_loud(df_u, config=None):
df_u[col_name] = pd.to_numeric(df_u[col_name])

if len(df_u)>0:
df_s = df_u[df_u[col_name]>70] #check if environment was noisy
df_u = df_u[df_u[col_name]>70] #check if environment was noisy
result = group_data(df_u)[col_name].resample(**config["resample_args"]).count()
result = result.to_frame(name='audio_count_loud')
result = reset_groups(result)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "niimpy"

[project]
name = "niimpy"
version = "1.2.1"
version = "1.2.2"
readme = "README.md"
description = "Python module for analysis of behavioral data"
authors = [
Expand Down Expand Up @@ -56,7 +56,7 @@ Repository = "https://github.com/digitraceslab/niimpy"


[bumpver]
current_version = "1.2.1"
current_version = "1.2.2"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
commit = true
Expand Down
10 changes: 5 additions & 5 deletions tests/preprocessing/test_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_audio_features():
test_user1 = test[test["user"] == "jd9INuQ5BBlW"]
assert test_user1["audio_count_silent"].sum() == 0
assert test_user1.loc[pd.Timestamp("2020-01-09 02:00:00", tz='Europe/Helsinki')]["audio_count_silent"] == 0
assert test_user1["audio_count_loud"].sum() == 16
assert test_user1["audio_count_loud"].sum() == 12
assert test_user1.loc[pd.Timestamp("2020-01-09 10:30:00", tz='Europe/Helsinki')]["audio_min_freq"] == 9601
assert test_user1.loc[pd.Timestamp("2020-01-09 10:30:00", tz='Europe/Helsinki')]["audio_max_freq"] == 9601
assert test_user1.loc[pd.Timestamp("2020-01-09 10:30:00", tz='Europe/Helsinki')]["audio_mean_freq"] == 9601
Expand All @@ -33,7 +33,7 @@ def test_audio_features():
assert test_user2["audio_count_silent"].sum() == 3
assert test_user2.loc[pd.Timestamp("2019-08-13 15:00:00", tz='Europe/Helsinki')]["audio_count_silent"] == 2
assert test_user2.loc[pd.Timestamp("2019-08-13 15:30:00", tz='Europe/Helsinki')]["audio_count_speech"] == 1
assert test_user2["audio_count_loud"].sum() == 17
assert test_user2["audio_count_loud"].sum() == 10
assert test_user2.loc[pd.Timestamp("2019-08-13 15:00:00", tz='Europe/Helsinki')]["audio_min_freq"] == 2914
assert test_user2.loc[pd.Timestamp("2019-08-13 15:00:00", tz='Europe/Helsinki')]["audio_max_freq"] == 7195
assert test_user2.loc[pd.Timestamp("2019-08-13 15:00:00", tz='Europe/Helsinki')]["audio_mean_freq"] == 5054.5
Expand All @@ -57,9 +57,9 @@ def test_audio_features():
assert test_user1_dev1.loc[pd.Timestamp("2020-01-09", tz='Europe/Helsinki')]["audio_count_silent"] == 0
assert test_user2.loc[pd.Timestamp("2019-08-13", tz='Europe/Helsinki')]["audio_count_silent"] == 3
assert test_user2.loc[pd.Timestamp("2019-08-13", tz='Europe/Helsinki')]["audio_count_speech"] == 1
assert test_user1_dev1.loc[pd.Timestamp("2020-01-09", tz='Europe/Helsinki')]["audio_count_loud"] == 10
assert test_user1_dev2.loc[pd.Timestamp("2020-01-09", tz='Europe/Helsinki')]["audio_count_loud"] == 6
assert test_user2.loc[pd.Timestamp("2019-08-13", tz='Europe/Helsinki')]["audio_count_loud"] == 17
assert test_user1_dev1.loc[pd.Timestamp("2020-01-09", tz='Europe/Helsinki')]["audio_count_loud"] == 7
assert test_user1_dev2.loc[pd.Timestamp("2020-01-09", tz='Europe/Helsinki')]["audio_count_loud"] == 5
assert test_user2.loc[pd.Timestamp("2019-08-13", tz='Europe/Helsinki')]["audio_count_loud"] == 10

features ={audio.audio_min_freq:{"audio_column_name":"double_frequency","resample_args":{"rule":"2h"}},
audio.audio_max_freq:{"audio_column_name":"double_frequency","resample_args":{"rule":"2h"}},
Expand Down

0 comments on commit b7bbbbd

Please sign in to comment.