-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor filter #49
Refactor filter #49
Conversation
@griffinmilsap , please let me know if you're OK with the loss of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cboulay I decided to take this branch for a run by using it in some of my projects. I ran into a very strange problem upon instantiating ButterworthFilter
which resulted in an error when deepcopy
ing the __streams__
property of the class. It turns out that the new FilterCoefsMultiType
used in FilterBase.INPUT_FILTER
was not deepcopy
-able.
This should have resulted in the tests failing, because we instantiate a ButterworthFilter
in the tests, but I checked the CI and all tests pass. I ran the tests on my own machine and I saw this same failure. Out of curiosity I used uv
to switch the python version to 3.11 and 3.12 and ButterworthFilter
worked completely fine in both of those versions and all tests passed, but python 3.10 seems broken on my machine.
Digging deeper, I checked out the CI logs on GitHub Actions and noticed that the CI runner on macos aarch64 is using CPython 3.10.15, but on my local machine (also macos aarch64) I'm getting CPython 3.10.0 after a uv sync --all-extras --dev
. I forced a uv python install 3.10.15
and magically everything works and all of my software runs with this branch. I then tracked it down to a bugfix in python 3.10.1 which seems to have resolved the issue. It seems to be related to this issue/fix. python/cpython#89330. This fix got rolled into 3.9.8 and I verified 3.9.7 has the same issue, but we're good with 3.9.10 (uv
can't seem to find a version of 3.9.8 or 3.9.9)
So at the end of the day, we're still Python 3.9, 3.10 compatible, but only ^3.9.8
and ^3.10.1
. We should probably mark this in the pyproject.toml
before merging this branch.
Aside, why was uv
only pulling 3.10.0 until just now? After telling it to grab 3.10.15 it seems to default to that now when I ask it to use python 3.10 which is nice. Spose I wouldn't have found this issue if that hadn't been the case...
Interesting, thanks for tracking that down!
Option 3 would give the widest compatibility, but unfortunately I can't figure out how to do that. Any ideas? |
3b49223
to
bfb0671
Compare
An increasing number of packages are starting to require Python 3.10+. I particularly like the shortening of Its a little silly though that this whole issue comes up because of the typing on |
@griffinmilsap , please let me know if the modified PR is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- Thanks!!
This PR closes #6 by refactoring the
filter
module with the following changes:filter_gen_by_design
generator method applies the filter designed by the callable passed in as an argumentapply_filter
is now gone. Despite not being an underscored method, I think this is safe to change because I don't think this was used anywhere else.design_filter
must return a callable that acceptsfs
and nothing else. For most filters, this means using a lambda or functools.partial to prepare the typical design function.Filter
now inherits this base class and itsdesign_filter
is simply a lambda that returns the coefficients from SETTINGS.ChebyshevFilter
with type I or type II designs.test_filter_system
test_decimate_system
because Decimate was affected by the filter change.ChebyshevFilter
unit instead of the IMO confusing legacyFilter
Importantly, the API is backwards compatible except for the loss of
apply_filter
and I changed theFilterSettings
field name fromfilt
tocoefs
.