uafgeotools / mtuq

moment tensor uncertainty quantification
BSD 2-Clause "Simplified" License
65 stars 22 forks source link

Implementation of median amplitude normalization. #261

Closed thurinj closed 3 months ago

thurinj commented 3 months ago

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.

rmodrak commented 3 months ago

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 commented 3 months ago

There is also a nonfatal typo, from a while back: https://github.com/uafgeotools/mtuq/blob/5ebdd7976ad3b71ae1cb78517caa79b4f4106dcb/data/examples/unpack.bash#L12

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 commented 3 months ago

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.

thurinj commented 3 months ago

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.

rmodrak commented 3 months ago

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!