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.

Would support on more numpy integer types be a good idea?

See original GitHub issue

Is your feature request related to a problem? Please describe. When playing with librosa especially with other audo libraries and numpy functions, I always meet erros from time to time by type errors where for example, n_bins requires int (as reflected by isinstance() in source code), but other integer types are not acceptable, for example np.int64. Would it be a good idea to support more integer types instead of asking users to transfer a numpy integer to a “pythonic” integer? I know it is a small thing but it can avoid some unexpected behaviors and additional bothering for users if done properly.

Describe the solution you’d like I can implement it and do tests if @bmcfee you think it’s a good idea.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
underdogliucommented, Jan 21, 2021

@bmcfee yeah for np.integer I do found reference after replying.

@dpwe sorry for being ruthless due to lacking knowledge on that and thanks for your suggestion. I think your solution would work.

“I’d like to see some examples of where our current implementation is problematic though.” -> an example can be as simple as lpcs = librosa.lpc(frame, int(lp_order)), where I have to add int() to transfer data type from np.int64 to int, in order to make it work.

0reactions
bmcfeecommented, Apr 9, 2021

where I have to add int() to transfer data type from np.int64 to int, in order to make it work.

Indeed, that case is an exception to what I wrote earlier about our use of int types, and I agree that here we should relax it. That said, if you’re doing LPC with order ~ 2^63, you may be in for a bad time 😆

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data types — NumPy v1.24 Manual
NumPy supports a much greater variety of numerical types than Python does. This section shows which are available, and how to modify an...
Read more >
A Comprehensive Guide to NumPy Data Types
1. Integers ... Just like in C/C++, 'u' stands for 'unsigned' and the digits represent the number of bits used to store the...
Read more >
Understanding Data Types in Python
Here 'i' is a type code indicating the contents are integers. Much more useful, however, is the ndarray object of the NumPy package....
Read more >
If a function arg supports numpy arrays how should its type ...
If you want your function to be able to handle any objects that can be added together to produce an object of the...
Read more >
NumPy: A Different Way to Think About Numbers - Purdue Math
Homogeneous: you cannot mix datatypes in NumPy. Computational: NumPy arrays support batch computations on all elements. NumPy Datatypes. Raw Python integers are ...
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