question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify kwargs in feature functions

See original GitHub issue

Some of our feature functions (melspectrogram, mfcc, etc) use kwargs to pass through parameters to core functions (stft, filter construction etc). This isn’t terribly well documented, and can be a little difficult for new users to navigate and understand what the options are.

At this point, it’s probably worth replacing some of these kwargs, eg https://github.com/librosa/librosa/blob/25538adb3aed3485a06e60b6dad88be3d540f0c2/librosa/feature/spectral.py#L1767-L1769 by

def mfcc(
    *, y=None, sr=22050, S=None, n_mfcc=20, dct_type=2, norm="ortho", lifter=0,
    n_mels=128, n_fft=2048, ...
):

Alternatively, if we don’t want to make the API totally redundant, we could at least provide more documentation in the kwarg’ed functions’ docstrings to better explain what options are available.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
Embot2000commented, Jul 16, 2022

If no one has started working on this issue I’d like to give it a try!

1reaction
bmcfeecommented, Jul 16, 2022

Thanks @Embot2000 - that looks like a good start. I might hold off on the last two since they’re kwargs to external functions in numpy and scipy.

On the feature side, I think you have it covered. We could also look at some other parts of the package after that, eg effects and decompose, but let’s get the feature parts done first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python args and kwargs: Demystified
In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add more flexibility to your functions. You'll also...
Read more >
10 Examples to Master *args and **kwargs in Python
The **kwargs collect all the keyword arguments that are not explicitly defined. Thus, it does the same operation as *args but for keyword ......
Read more >
*args and **kwargs in Python - GeeksforGeeks
The special syntax **kwargs in function definitions in python is used to pass a keyworded, variable-length argument list. We use the name kwargs...
Read more >
Python - Understanding args, kwargs in functions
*args and **kwargs allow you to pass multiple arguments and keyword arguments to a function. Let's explain *args and **kwargs through basic ...
Read more >
What is the purpose and use of **kwargs? - Stack Overflow
The usage of the two asterisk before the parameter name, **kwargs, is when one doesn't know how many keyword arguments will be passed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found