You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to understand causal / acausal filtering today in the context of ObsPy's functions and came across the Basics in filtering notebook.
In the Causal versus acausal section of the notebook, there looks to be a typo where the "causal" filters have zerophase=True while the "acausal" filter has zerophase=False.
tr_filt=tr.copy() # causal filter / not zero phase. Order = 2tr_filt.filter('lowpass', freq=f, zerophase=True, corners=2)
tr_filt2=tr.copy() # causal filter / not zero phase. Order = set by ncornerstr_filt2.filter('lowpass', freq=f, zerophase=True, corners=ncorners)
tr_filt3=tr.copy() # acausal filter / zero phase. Order = set by ncornerstr_filt3.filter('lowpass', freq=f, zerophase=False, corners=ncorners)
Presumably, these should be switched?
On a related note, in the solutions the following discussion:
The difference between the two causal filters (red and blue) are minor, even when the order of the filter is increased. But the acausal filter (green) shows a phase shift relative to the original data. This phase shift increases drastically when increasing the order of the filter.
"causal" and "acausal" would need to be swapped here — the trace in green has a phase shift due to its causal nature, not the opposite.
Zooming into a time window from 4.5 s to 5 s and setting the maximum amplitude to 400, we see that the phase shift is also shifting the first onset. We would pick it incorrectly. Therefore, whenever the scientific task involves the correct time picking of phases, we have to work with causal filters. When only the frequency content is important, we can also work with acausal filters.
It is my understanding that the final two sentences here are correct, but in this case for the wrong reason. The causal filter does introduce a phase shift but it is typically used in phase picking applications to avoid pre-onset artifacts arising from acausal filtering of impulsive arrivals, correct? It might be good to clarify here.
I would be happy to draft a quick PR to address these comments, if they make sense to the notebook creators.
The text was updated successfully, but these errors were encountered:
In the Causal versus acausal section of the notebook, there looks to be a typo where the "causal" filters have zerophase=True while the "acausal" filter has zerophase=False.
I agree, that looks like an error in there. The wording is also weird: "The output of a causal filter depends only on past and present input, while the output also depends on future input." The second half of the sentence is about acausal filter only mentioned in the following sentence. It probably should be ..., while the output [of an acausal filter] also depends on future input.
"causal" and "acausal" would need to be swapped here — the trace in green has a phase shift due to its causal nature, not the opposite.
Agreed.
It is my understanding that the final two sentences here are correct, but in this case for the wrong reason.
I guess the wording could be improved but in general it seems OK like you said.
It would be good to have these things fixed. Sadly, currently we don't have a set workflow for making updates to seismo live, so it means quite some work, so not sure how/when an update would make it to the live webpage.
megies
changed the title
Casuality discussion and typos in Filtering Basics notebook
Causality discussion and typos in Filtering Basics notebook
Mar 30, 2023
Thanks for these great resources.
I was trying to understand causal / acausal filtering today in the context of ObsPy's functions and came across the Basics in filtering notebook.
In the Causal versus acausal section of the notebook, there looks to be a typo where the "causal" filters have
zerophase=True
while the "acausal" filter haszerophase=False
.Presumably, these should be switched?
On a related note, in the solutions the following discussion:
"causal" and "acausal" would need to be swapped here — the trace in green has a phase shift due to its causal nature, not the opposite.
It is my understanding that the final two sentences here are correct, but in this case for the wrong reason. The causal filter does introduce a phase shift but it is typically used in phase picking applications to avoid pre-onset artifacts arising from acausal filtering of impulsive arrivals, correct? It might be good to clarify here.
I would be happy to draft a quick PR to address these comments, if they make sense to the notebook creators.
The text was updated successfully, but these errors were encountered: