Open flixha opened 3 years ago
One thing that I would like to be able to do is have a template with all the information in it, but only use certain channels for detection, then all for subsequent lag-calc. I want to do this to be able to reduce computational requirements for long-running detection runs, but then be able to maintain the meta-data for picking at the end.
That's a good point! I added it in the list above, and I also added a point that it would be nice to later be able to ask lag_calc
(and maybe match_filter
) to use only a fraction or specific length of the traces in the template. This could make sense if one wants to correlate long traces to achieve efficient MAD-based discrimination of real events vs. misdetections, but then one may prefer to do the picking with shorter traces to achieve higher single-trace correlation coefficients. This would also allow to better handle phases that arrive close in time during picking (e.g., Pn and Pg).
While this is open - other things that I want to do include:
Event
objects for Detection
s - there should be a way to get events from detections (e.g. a gettable property on a Detection
), but they are quite heavy in memory and have more flexibility and possibilities than we need internally;Tribe
and Party
objects - a major part of this would be moving away from full obspy Event
objects - currently QuakeML reading is really quite slow for large catalogs (as discussed in this issue back in 2017).
N
events to a file, and writing multiple files, then reading via threading.Trace
and Stream
objects internally - again, Template
objects should have a stream
gettable property, but we can just use numpy arrays internally and maybe eventually move to using numba
for to jit
some of the slow code. If we work with numpy array directly we can also drop in cupy
when appropriate/available to get GPU speed-ups.
cupy
if anyone is keen to see/test/help then let me know.I think we probably only need a small set of Event
attributes, something like a SparseEvent
class that has:
The SparseEvent
should be supplemented by SparsePick
, SparseMagnitude
and SparseOrigin
classes, and should effectively look like an obspy Event
(so have things like .preferred_origin(), ...
to reduce the need to rewrite large chunks of code - writing could be to json with dict deserialisation via a fixed set of values.
I'm opening this issue with the intent to collect information and discuss a suitable implementation strategy. So this is very much Work in Progress and I would appreciate any input to add to the current restrictions, related features wishes, and proposed implementation strategies.
Current restrictions The current implementation of templates, detection, cross-correlation, and lag-calc has some restrictions including:
relative_magnitudes
doesn't work right now because templates don't contain enough information to compute pre-event noise (see #385)match_filter
andlag_calc
always use all available channels of a template, without options for discriminationmatch_filter
andlag_calc
use the full length of the traces in the template for correlationIs your feature request related to a problem? Please describe. It would be nice if we could support the following functionality in the future:
match_filter
andlag_calc
should come with options to let e.g.match_filter
only run on a subset of the channels, while keeping all channels in the template (e.g., to detect with a subset for computational efficiency, but pick with all available channels)match_filter
andlag_calc
should come with an option to use only a fraction of the channels for correlation (e.g., to detect with the full seismogram, but pick with only the phase onset)Describe the solution you'd like For now, I'm opening this issue to collect a list of challenges, missing features, and requirements that would all be related, and hopefully addressed, in an update to the template class. I suspect that templates will need to contain some more metadata for us to allow the features described above. I think it would be desirable if we can get away with only one major upgrade to the template class so that we break compatibility with old templates only during one version update.
Describe alternatives you've considered None yet - but this issue will likely evolve and I'm planning to fill these in here!
Updates: 2021-03-15: first version 2021-03-17: added points 6 & 7
Relevant previous issues: #169