Would support on more numpy integer types be a good idea?
See original GitHub issueIs 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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 addint()
to transfer data type fromnp.int64
toint
, 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 😆