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

Refactor filtering again: this time make subclasses of Filter with filter_records(...) methods #315

Merged
merged 7 commits into from
Dec 9, 2024

Conversation

joefowler
Copy link
Member

This removes filtering algorithms from the MicrocalDataSet into the filter_records(...) methods of the various subclasses of Filter. In so doing, many if branches are removed (or at least, they are hidden from the user).

Fixes #314.

These subclasses can separately apply the filter to data
Don't build the filtering algorithm into the `MicrocalDataSet` but into the `FilterATS` or `Filter5Lag` class instead. Fixes #314.
@joefowler joefowler requested a review from ggggggggg December 6, 2024 22:53
Copy link
Collaborator

@ggggggggg ggggggggg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small edit requests.

return self.convolution_lags == 1 and self.dt_values is not None
return False

@property
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we supposed to never make an object of type Filter? In that case consider naming is BaseFilter and def __init__(self, ...): raise Error? Move the error as early as possible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. And...it turns out there's a package and a special decorator to enforce this. I'll use that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it did exist already in Python 3.9, so we are safe to use it.

mass/core/optimal_filtering.py Outdated Show resolved Hide resolved
mass/core/optimal_filtering.py Outdated Show resolved Hide resolved
mass/core/optimal_filtering.py Outdated Show resolved Hide resolved
@joefowler
Copy link
Member Author

Revised following @ggggggggg's suggestions in this review.

@joefowler joefowler merged commit e25e36c into master Dec 9, 2024
4 checks passed
@joefowler joefowler deleted the refactor_filtering branch December 9, 2024 19:24
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.

Make the new Filter objects capable of filtering a data vector or 2d array
2 participants