-
Notifications
You must be signed in to change notification settings - Fork 12
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
Relax noise window requirements #18
Relax noise window requirements #18
Conversation
Thanks Kris for this PR! I'm currently quite busy and will look into it hopefully in the next weeks 😉 |
OK, thank you Claudio! |
Dear Kris, happy new year! I went through the PR and made some comments. Let me know! |
Hello Claudio, |
Great! Everything looks fine now. Could you please just add a Changelog entry? |
OK, I will add a changelog entry. |
I added 2 entries in the changelog. I hope the way I did it is OK to you. |
I ran the new code on my test case. Unfortunately, it's impossible to obtain the same results because I have changed several instrument responses since the previous time. However, I get the same warnings and magnitudes for triggered accelerometric records where the noise window is lacking, so it seems to work as expected. |
…noise weighting is used, otherwise just log a warning. Improved _add_hypo_dist_and_arrivals function: raise error if signal window is incomplete (arrival earlier than start of trace), constrain signal_pre_time for S-phase to half the S-P interval, constrain start of signal and noise windows (including signal_pre_time) to start of trace.
…_signal_noise function: only truncate signal window if noise weighting is used and log warning, otherwise zero-pad noise window to length of signal window. Added 'config' argument to _check_noise_level function, and apply scale factor to trace_noise_rms based on number of non-zero samples; if noise level is too low, only raise error if noise weighting is used, and made warning message more clear. Improved checking for zero noise spectrum in _build_weight_from_noise function, and set data_raw property of weight to ones if noise spectrum is zero. Pass 'config' argument to _check_noise_level in build_spectra function.
…ild_weight_from_noise function.
…The check for overlapping noise and S-windows is not needed as we already check for overlap with the P-window.
…_signal_noise function, and also simplified zero-padding.
7318c15
to
d20fd42
Compare
Good. I just rebased and force-pushed. I will also somehow simplify the CHANGELOG entry |
I modified the CHANGELOG and added a warning when (Ts-Tp)/2 is used. Could you please force-pull and double-check? |
I pulled the relax_noise_window branch and ran the example again. The results are identical. I suppose I better not push the relax_noise_window branch again? Maybe I did something wrong, but it contains a lot of changes that come from somewhere else. By the way, there is a small error in ssp_sqlite_output.py in line 73. This should read: |
I think that the extra changes are the effects of the rebase. Thanks for reporting the error in So I'm going ahead and merge this. Thank you again! |
Dear Claudio,
I would like to propose this branch for inclusion in sourcespec. It relaxes noise window requirements if noise weighting is not used. This is useful for older records or triggered records with noise windows that are short or even missing entirely.
Currently, traces with missing noise windows are skipped and for traces with noise windows shorter than win_length, the signal is (silently) truncated to the length of the noise window. In this branch:
In addition, I made two further improvements in ssp_process_traces._add_hypo_dist_and_arrivals function:
If you have any questions or remarks, let me know.
Kris