-
Notifications
You must be signed in to change notification settings - Fork 101
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
Harmonic oscillation reduction [JSB version] #313
Harmonic oscillation reduction [JSB version] #313
Conversation
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 @profjsb. There are some small things that can be tidied up here, but none needs to block merging. Go ahead and do as much as you like, then merge on passing of tests.
cesium/features/lomb_scargle.py
Outdated
nharm=8, | ||
nfreq=3, | ||
tone_control=5.0, | ||
opt_normalize=False, |
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.
Would normalize
suffice?
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.
good idea. done.
cesium/features/lomb_scargle.py
Outdated
@@ -71,6 +95,7 @@ def lomb_scargle_model( | |||
detrend_order=1, | |||
) | |||
model_dict["trend"] = fit["trend_coef"][1] | |||
# |
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.
Remove?
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.
done
cesium/features/lomb_scargle.py
Outdated
norm_residual = signal - fit["model"] | ||
signal = norm_residual | ||
|
||
# store current estim_freq results, [**RESCALED for first fund freq] |
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.
If these comments are useful, should they be clarified?
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.
Good idea, done.
cesium/features/lomb_scargle.py
Outdated
model_dict["freq_fits"].append(current_fit) | ||
model_dict["freq_fits"][-1]["resid"] = norm_residual | ||
|
||
if opt_normalize & (i == 0): |
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.
These two if clauses feel as if they should be combined higher up, but perhaps that's tricky.
cesium/features/lomb_scargle.py
Outdated
rescaled_model = norm_model.copy() | ||
# unchanged : 'psd', 'chi0', 'freq', 'chi2', 'trace', 'nu0', 'nu', 'npars', | ||
# 'rel_phase', 'rel_phase_error', 'time0', 'signif' | ||
rescaled_model["s0"] = rescaled_model["s0"] / mscale**2 |
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.
Maybe three for-loops here?
This is a copy of the PR #285 by @sarajamal57, that has been rebased to the current main of cesium.
It is meant to solve the overflow problem in issue #284 by:
opt_normalize == True
Additional output:
The full power spectrum and associated frequencies are added in the output dictionary ("freqs_vector", "psd_vector")