jpvantassel / hvsrpy

A Python package for Horizontal-to-Vertical (H/V, HVSR) Spectral Ratio Processing.
https://pypi.org/project/hvsrpy/
Other
82 stars 32 forks source link

Possible issue with window rejection #31

Closed chenyu-lii closed 2 months ago

chenyu-lii commented 2 months ago

Hello!

My name is Chenyu, and I am using hvsrpy to compute HVSR curves for my dataset. Thanks for this great open package.

I applied this script to my data: example_mhvsr_traditional_window_rejection.ipynb. I tried to read in multiple mseed files, and it works well for some stations. Unfortunately, for a few other stations, the window rejection seems not working, they didn't reject any curves, and the error seems quite large. The parameter is always n=2.

I was wondering if there are any reasons for not rejecting windows, such as the waveforms or HVSR curves are too noisy?

Thank you so much for your time!

Regards, Chenyu

jpvantassel commented 2 months ago

Hi @chenyu-lii,

The full algorithm is described in the Cox et al. (2020) paper. There is no exclusion of windows, the only issue may be if the HVSR does not have a peak. It’s hard to say what the issue is, without more information. Can you share some examples of what you mean?

chenyu-lii commented 2 months ago

Thanks for your reply! Here are some examples.

example_mhvsr_traditional_window_rejection_20220808_MP02_all_panels example_mhvsr_traditional_window_rejection_20220708_MP01_all_panels

Probably it's because the HVSR didn't have a clear peak?

alangi commented 2 months ago

Hi @chenyu-lii, You could try selecting only the lower peak by changing the line below, which can be found in

Apply Window Rejection Algorithm

search_range_in_hz = (None, None)

Change the second None to be 3, so:

search_range_in_hz = (None, 3)

This is the high cutoff for the search range, and will stop the algorithm looking at any of the peaks above 3 Hz. You may still have issues though because the lower frequency peak has a broad range of peaks around it. I can see that the rejection algorithm is working in the second image though because the is one peak at about 0.7 Hz that is red.

chenyu-lii commented 2 months ago

Thanks for your suggestions. I could see an improvement after setting the search_range_in_hz = (None, 3).

Here is an example after changing the search range: example_mhvsr_traditional_window_rejection_20220804_MP02_14day_all_panels

The HVSR before looks like this: example_mhvsr_traditional_window_rejection_20220803_MP02_14day_all_panels

Thank you so much again!