Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion soundscapy/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def loudness_from_wav(
# Input sanity!
methodlist = ["time_varying", "stationary"]
if method not in methodlist:
if method in ["stationary_levels", "Stationary_Levels"]:
if method in {"stationary_levels", "Stationary_Levels"}:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function loudness_from_wav refactored with the following changes:

  • Use set when checking membership of a collection of literals (collection-into-set)
  • Simplify conditional into switch-like form (switch)

raise ValueError(
"Calculating loudness from pre-calculated levels has its own method! (or it soon will...)"
)
Expand Down