Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CircuitPython uLab port, Melbank.py #61

Open
Kroikey opened this issue Apr 1, 2022 · 0 comments
Open

CircuitPython uLab port, Melbank.py #61

Kroikey opened this issue Apr 1, 2022 · 0 comments

Comments

@Kroikey
Copy link

Kroikey commented Apr 1, 2022

Hi, I'm trying to convert the melbank.py file and I'm struggling to understand why this code doesn't work.

for imelband, (center, lower, upper) in enumerate(zip(
        center_frequencies_hz, lower_edges_hz, upper_edges_hz))

    left_slope = (freqs >= lower) == (freqs <= center)
    melmat[imelband, left_slope] =  (freqs[left_slope] - lower)/((center - lower)

I'm getting 'IndexError: indices must be integers, slices, or Boolean lists', which is from the left_slope. Its a list of booleans?
printing the arrays shows this.
freqs array([0.0, 25.0784, 50.1567, ..., 7949.8, 7974.88, 7999.96], dtype=float32)
left_slope array([False, False, False, ..., False, False, False], dtype=bool)

I think its something to do with this line, left_slope - (freqs >= lower) == (freqs <= center)
that is where it sets the array to false. It looks like all them are set to false, so I guess my python-noobness is showing here.

If anyone can help that would be amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant