-
Notifications
You must be signed in to change notification settings - Fork 35
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
Compact show for Frequencies #55
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #55 +/- ##
==========================================
+ Coverage 94.80% 94.83% +0.02%
==========================================
Files 5 5
Lines 443 445 +2
==========================================
+ Hits 420 422 +2
Misses 23 23 ☔ View full report in Codecov by Sentry. |
Looks fine to me. |
I personally don't find it to be a significant improvement in readability but I also don't care much. |
To me this seems to be a quality-of-life improvement, as it makes the output of Even otherwise, it's easier to get the number of frequency bins from this display format. On master: julia> f = fftfreq(10, 3);
julia> show(f)
[0.0, 0.3, 0.6, 0.8999999999999999, 1.2, -1.5, -1.2, -0.8999999999999999, -0.6, -0.3] This PR: julia> show(f)
[0:4; -5:-1]*0.3 One may obtain, for example, the index of the Nyquist frequency without the need to count. |
An alternative would be to print |
Gentle bump. I'm not sure about using functions to represent the types, since this can't be uniquely determined for julia> rfftfreq(4,4) == rfftfreq(5,5)
true Perhaps it's better to represent the exact form of the constructor, although that might be a bit cryptic if one doesn't know what the fields are. E.g.: julia> f = rfftfreq(4, 4); show(f)
Frequencies(3, 3, 1.0) The original suggestion in the PR is more readable, but the constructor will firstly communicate the type, and secondly, it will always create the correct object (which is what the docstring of |
This PR specializes
show
forFrequencies
. It's a workaround for JuliaLang/julia#39963, and in general this makes the output more readable while displaying frequencies obtained fromfftfreq
andrfftfreq
.On master
After this PR:
As a consequence:
on master
After this PR: