-
Notifications
You must be signed in to change notification settings - Fork 11
Firwin #53
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
base: main
Are you sure you want to change the base?
Firwin #53
Conversation
c042c55 to
cab3736
Compare
To implement firwin, there is a need to get_windows on all window types defined in the Scipy signal.windows namespace, most of which are implemented in a _windows.py file. This commit keeps all the window variants that needs to be implemented as comments in an Enum for future implementation, along with some functions that are used across the implementation of all window types. The intended strategy to combat the variadic function type associated to the Scipy's get_windows function is to enclose all function arguments in a struct that represents the given function type, while ensuring all structs representing the Windows type implement a common trait.
060cf5b to
21010f8
Compare
The error variants here should guide the user as to the wrong use of functions, instead of taking down the entire program with a panic, which is especially necessary in an embedded environment.
We also introduce the convenience enum to go along with the function.
There still is a need for double specification of window size across both firwin and the Window struct that uses it, unless we have a string to enum converter I suppose...; Either way, its suboptimal currently.
|
a92506d I have added error types after looking through how the Rust ecosystem generally does errors. This might still not be ideal and needs more work. We should leave panics instead to Python-facing side of the library. |
0e90be5 to
a1783ca
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
4598cbd There's still some redundancy in argument specification of Firwin. But I'm not sure how to resolve it. Nonetheless it behaves to expectation now. |
|
Forced push with rebase since Bessel trait has been merged. |
|
Forced push with rebase since main has since bumped. |
Variadic argumentsThere is https://crates.io/crates/variadics to resolve the struct-as-arg conundrum if we wish for a more pythonic interface, but I still believe that we should only keep the pythonic interface at the python binding level. Design of interfaceshttps://purplesyringa.moe/blog/the-expression-problem-and-rust/ |
|
An alternative is as done exactly in here, edit: The linked crate is almost certainly entirely AI generated, but it does show how |
7129e87 to
4f8db57
Compare
ee854e1 to
f96e406
Compare
Scipy returns a value error in this case.
Wrong argument was being signalled in the message.
Also add a unit test.
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on January 14. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
This PR aims to implement Firwin.
Blockers before merging:
Original Message:
Currently opening as a draft PR to have eyes on the code before it grows even larger into eventually implementing firwin.
Questions I guess I need answers about specific to this repository to ensure the PR is decent:
*_stor*_dyn?mod.rsto follow the scipy's submodule convention.... Individual files otherwise don't really make sense, and finding a function is best done either via grepping or through the[Source]button as created bycargo docs.Convolution,B-splines,Fitting, ...? I think this is achieveable with//!? Or I might be mistaken.unsafe { F::from(-1).unwrap_unchecked) }or something similar. Is this the norm for "constants" which we can guarantee to be safe, and so I too should be doing this?I will continue to force-push onto this branch with any suggestions such that each commit is consistent with its commit title and message.
Note
Implements FIR filter design via
firwin_dynwith validation and scaling, adds comprehensive window functions and Kaiser utilities, introduces anErrortype, and updates signal module exports/docs.signal/filter/design):firwin_dyn: FIR filter design with argument validation, window application (custom or width-based Kaiser), scaling, and extensive tests.kaiser_beta,kaiser_atten,kaiserordwith tests.signal/windows):GetWindowtrait,Windowenum, andget_windowbuilder.Boxcar,Triangle,Blackman,Hamming,Nuttall,Kaiser,GeneralCosine,GeneralGaussian,GeneralHamming(each with tests and docs).error::Errorenum (InvalidArg,ConflictArg); export vialib.rs.signal::windowsand enhance docs; integrate new design modules insignal::filter::designand adjustfilter/wavedocs.Written by Cursor Bugbot for commit 7760754. This will update automatically on new commits. Configure here.