Skip to content

Causality discussion and typos in Filtering Basics notebook #45

@liamtoney

Description

@liamtoney

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 has zerophase=False.

tr_filt = tr.copy()            # causal filter / not zero phase. Order = 2
tr_filt.filter('lowpass', freq=f, zerophase=True, corners=2)
tr_filt2 = tr.copy()           # causal filter / not zero phase. Order = set by ncorners
tr_filt2.filter('lowpass', freq=f, zerophase=True, corners=ncorners)
tr_filt3 = tr.copy()           # acausal filter / zero phase. Order = set by ncorners
tr_filt3.filter('lowpass', freq=f, zerophase=False, corners=ncorners)

Presumably, these should be switched?

On a related note, in the solutions the following discussion:

  1. 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.

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions