-
Notifications
You must be signed in to change notification settings - Fork 72
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
Improved input syntax for frequency_differencing
operation
#1106
Conversation
These improvements are very cool! Since you're adding Are there lighter-weight alternatives to |
I feel
I'm using |
Right! Scratch my comment about dependency resolution per se. I did see that the dependency was limited to mpmath > gmpy2, and we don't currently use those libraries. My apologies. |
No worries! I understand the clarification now. Since we don't use mpmath or gmpy2 libraries, these dependencies doesn't affect us. But we need to look at alternatives for |
Since the equations are pretty predictable, one option would be to just do |
@leewujung Do you mean we use a single regex expression to check for the validity of the whole frequency differencing criteria? Wouldn't that make the code a bit messy? |
I think it would be ok? For the freqAB case, the |
@leewujung I think it shouldn't be overly complicated, it's just that i split everything into individual parts for better code debugging. I'll make these changes by today. |
@leewujung Even if use a single |
Hi @praneethratna : sorry for my super late response. What I am thinking in terms of using
What do you think? |
@leewujung No worries! I understand it now, these suggestions helped me to refactor the code in a much simpler and clean way. |
@praneethratna : there are still places where you use |
d829b55
to
189c23f
Compare
@leewujung I have removed the usage 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.
@praneethratna : Thanks for this great PR!! It is awesome to have this intuitive way of putting in the freq diff equations.
I have some small suggestions for the organization and the tests:
- Since in Add transient and impulse noise masks #1142 there are more functions added to the
mask
subpackage, how about in this PR moving the frequency-differencing-related functions (_check_source_Sv_freq_diff
andcheck_freq_diff_and_parse_arguments
) to a separate module, sayechopype/mask/freq_diff.py
and keep the main API functionfrequency_differencing
inechopype/mask/api.py
? - for the tests, currently
test_frequency_differencing
is more of an integrated test, and in it the frequency units are all Hz so the unit matching was not tested. How about adding another set of tests to test for the function you wrotecheck_freq_diff_and_parse_arguments
? This way you can test parsed element values and xfail the ones that should fail, etc. - rename
check_freq_diff_and_parse_arguments
to_parse_freq_diff_eq
to make it obvious that it is a private function, and also making it shorter - rename
_check_source_Sv_freq_diff
to_check_freq_diff_source_Sv
: this more of a style thing, but I feel that having the freq_diff part first make it easier to know where this function is used.
Also, I caught a bug / undesired behavior in the current Lines 463 to 467 in 254ee10
However, it is possible that there are 2 channels (with different Looking at the code again, what do you think if we take the following approach to change this function?
|
f17a474
to
a9491fe
Compare
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.
Thanks @praneethratna for your speedy changes! I added some suggestions, and I think once they are addressed we can merge this PR. :)
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.
@praneethratna : Thanks a lot for your contribution. We can merge this PR now once the tests run through!
Ugh sorry just remember one thing. In here
frequency_differencing is called (this is something the CI does not catch, unless one uses [all tests ci] (see here). Could you quickly change it? Then I will merge. Thank you!
|
Codecov Report
@@ Coverage Diff @@
## dev #1106 +/- ##
==========================================
- Coverage 78.12% 68.69% -9.44%
==========================================
Files 65 8 -57
Lines 6227 658 -5569
==========================================
- Hits 4865 452 -4413
+ Misses 1362 206 -1156
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 63 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Addresses #967. Now input for frequency_differencing can be given directly in the form of frequency differencing criteria instead of separating out freq/chan from operators.
CC @leewujung