Skip to content

🐛 add zeros to complete pncc frames instead of ignoring the last …#71

Open
raglady wants to merge 1 commit intoSuperKogito:masterfrom
raglady:bugfix/pncc-framing
Open

🐛 add zeros to complete pncc frames instead of ignoring the last …#71
raglady wants to merge 1 commit intoSuperKogito:masterfrom
raglady:bugfix/pncc-framing

Conversation

@raglady
Copy link
Copy Markdown

@raglady raglady commented Jan 3, 2026

Describe the bug

PNCC: When calling the function framing inside spafe/utils/preprocessing.py, we lose the last frame if it is shorter than others instead having it filled by zeros.

To Reproduce

With the code below, we lose the last frame containing the value 20 instead of having it followed by 0 0.

from spafe.utils.preprocessing import framing

sig = [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0]

frames, frame_length = framing(
        sig=sig, fs=1, win_len=4, win_hop=3
    )

print(f"frames: {frames}, frames_len: {frame_length}")

Result before fix

frames: [[ 1. 2. 3. 4.]
[ 4. 5. 6. 7.]
[ 7. 8. 9. 10.]
[10. 11. 12. 13.]
[13. 14. 15. 16.]
[16. 17. 18. 19.]], frames_len: 4

Result after fix

frames: [[ 1. 2. 3. 4.]
[ 4. 5. 6. 7.]
[ 7. 8. 9. 10.]
[10. 11. 12. 13.]
[13. 14. 15. 16.]
[16. 17. 18. 19.]
[19. 20. 0. 0.]], frames_len: 4

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

Successfully merging this pull request may close these issues.

1 participant