Closed claudiodsf closed 1 year ago
Hi Claudio,
I made this change to make sure that the start of the noise window is not before the start of the trace. Without that constraint, the obspy trim operation (in the _cut_signal_noise function) just fills the missing part with zeros. So, the noise window was never considered too short, even if it was absent.
I'm not sure why the noise window is shifted in your case, but it is possible that a trace that was not rejected before is now rejected. The filling in of the missing part with zeros (old behavior) would result in a higher SNR (which is not real).
Could you check if the amount of time before the P arrival with respect to your noise_pre_time for the rejected record?
I also think the plot may be misleading. In my case, in the previous behavior, it shows noise windows (flat lines), where there is no data in my trace. Have a look at the image: stations MASA, STWA and CLHA are late triggered (part of the P window is even missing in STWA), but yet a noise window is drawn.
With the new version, a flat line is still drawn (the trace is not actually as long as shown!), but a noise window is not plotted when it's absent.
Ok, I think I should change the way traces are plotted (or are trimmed?) to avoid this impression of having signal, when it is not there.
Ideally, your plot for, e.g., BE.CLHA should not show any signal before a few seconds before S arrival.
I'll prepare a pull request and I will ask you to test it, if you don't mind.
OK, could you also check if the noise windows are drawn for each trace separately or if it the same box is used for each trace?
You mean each of the three components, for a given station?
Yes.
Probably it is the same box. I'll try and fix that.
Looks like the fix is quite easy: could you please comment out line 380 in ssp_plot_traces.py
:
_trim_traces(config, st_sel)
And see what happens in your case?
It's a big difference! Missing data are no longer plotted, but the traces are much longer, making it more difficult to see the selected windows.
Ok, can you try changing line 311:
trace.trim(starttime=t1, endtime=t2, pad=True, fill_value=0)
with
trace.trim(starttime=t1, endtime=t2)
Of course, remove the comment from line 380 😉
The idea in _trim_traces()
is to plot a time window which is three times the length of the analysis window.
This looks much better!
Great! Looking at the code, noise windows should be plotted separately for each component. Do you have an example where they're not there same, to check that?
Not straightaway. I trimmed all records in my archive to the same start time. I thought maybe in your example, the station FR.PLOF.00 could have different start times for the different components? If not, I will see if I can test it by cutting 1 component before sending it to sourcespec.
The only problem I see is that noise and signal windows are plotted as vertical spans, so they always cover the full plot in vertical.
This can be improved by plotting rectangular patches of 1/3rd of the plot height... looking into that.
I was going to say that it also depends on the selected wave_type (e.g. for P-wave only Z component is used), but I think in ssp_process_traces all components are processed separately. So, the noise windows could still be different.
Ok, I modified the code to plot the patches separately.
I made a test randomising the noise and signal windows, just to see the effect: is that fine for you?
Note: the code is not yet pushed to the repository.
That looks fine!
Sorry, I had to force-push https://github.com/SeismicSource/sourcespec/commit/92ddf7a1f3a6e8eb1d8e6e0388cdca195d2e757c
I switched back to master and it works!
Hi @krisvanneste,
the changes introduced with #18 are causing a small but significant problem in my case: the noise window is shifted and a trace is rejected.
This is due to this line:
which used to be:
Attached two figures showing the old and the new behaviour.
Could you explain why this change is important for you use case? Any idea for a workaround?