Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of median amplitude normalization. #261

Merged
merged 5 commits into from
Apr 6, 2024

Conversation

thurinj
Copy link
Member

@thurinj thurinj commented Apr 5, 2024

See PR #252 for complete discussion.

I've moved the normalization logic out of the plotting function in order to fix the stream-per-stream normalization, and allow the addition of median based normalization. I haven't changed the default (still based on the maximum value in the dataset). Having the median normalization should help visualize the dataset when big changes in amplitudes are expected (for strong-motion data for instance).

This also comes with minor fixes for the waveform plots.

Implementation of wavefield normalization from PR #252.
Adding new feature (median-based normalization), and fixing station_amplitude.
Improved degree's distance so that it uses latitude/longitude instead of m_to_deg.
Fixed typo.
@thurinj thurinj requested a review from rmodrak April 5, 2024 04:46
@rmodrak
Copy link
Member

rmodrak commented Apr 5, 2024

Very strange, here is the main problem (some kind of scipy regression?):

ImportError: module 'scipy.signal' has no attribute 'hann'

For the full traceback:
https://github.com/uafgeotools/mtuq/actions/runs/8565130022/job/23472731288#step:6:23

@rmodrak
Copy link
Member

rmodrak commented Apr 5, 2024

There is also a nonfatal typo, from a while back:

20090407201255351.tgz 20210809074550.tgz 20SPECFEM3D_SGT.tgz SPECFEM3D_SAC.tgz;

tar (child): 20SPECFEM3D_SGT.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

@thurinj
Copy link
Member Author

thurinj commented Apr 5, 2024

Scipy 1.13.0 was released on April 2nd, so not impossible that the error is coming from there. I'll work on it. I'll also include the unpack fix.

Removed extra character in one of the file's name. Would prevent unpacking otherwise.
@thurinj
Copy link
Member Author

thurinj commented Apr 5, 2024

The problem seems to be coming from the dictionary entry in the obspy plugin system. I've tested it by modifying the entry_points.txt in obspy-1.4.0.dist-info from:

hann = scipy.signal:hann
to
hann = scipy.signal.windows:hann

and the taper function called in process_data.py is working again.

The new doc for scipy.signal.hann says it is deprecated and that we should be using scipy.signal.windos.hann instead.
A quick temporary fix would be to lock the scipy version to <= 1.12.0 and wait for an obspy fix before removing this version constraint.

Scipy version fix to avoid conflict with obspy.
(scipy.signal.hann is deprecated since scipy 1.13.0 and called in obspy).
@rmodrak
Copy link
Member

rmodrak commented Apr 6, 2024

The problem seems to be coming from the dictionary entry in the obspy plugin system. I've tested it by modifying the entry_points.txt in obspy-1.4.0.dist-info from:

hann = scipy.signal:hann to hann = scipy.signal.windows:hann

and the taper function called in process_data.py is working again.

The new doc for scipy.signal.hann says it is deprecated and that we should be using scipy.signal.windos.hann instead. A quick temporary fix would be to lock the scipy version to <= 1.12.0 and wait for an obspy fix before removing this version constraint.

Very helpful thanks!

@rmodrak rmodrak merged commit 109b4e5 into master Apr 6, 2024
1 check passed
@thurinj thurinj deleted the waveform_normalization branch April 6, 2024 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants