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 noticed some time ago that the scale argument for the constructor of the SeismicPlotter does nothing. We have workarounds in the tutorials that use the scale algorithm before calling the plot method. I just looked and the cause of this bug is clear: it is a feature that the comments say was not completed. Here, in fact, is the current section that needs to be fixed:
def _normalize(self, d):
"""
Normalizes data (d) using scale function. for ensembles that
is peak normalization to level self.scale by section. For
Seismograms each component will be normalized independently.
For TimeSeries the peak is adjusted to self.scale.
:param d: input data to be scanned (must be one of mspass supported
data objects or will throw an exception)
:param perf: clip level as used in seismic unix displays.
"""
# These are place holders for now. Requires some new code in ccore
# to sort absolute values and return perf level - should use faster
# max value when perf is 100%
if isinstance(d, SeismogramEnsemble):
alg_scale(d, scale_by_section=True, level=self.scale)
elif isinstance(d, TimeSeriesEnsemble):
alg_scale(d, scale_by_section=True, level=self.scale)
elif isinstance(d, TimeSeries):
alg_scale(d, level=self.scale)
elif isinstance(d, Seismogram):
alg_scale(d, level=self.scale)
else:
raise RuntimeError(
"SeismicPlotter._normalize: Received unsupported data type=", type(d)
)
A simple fix is to replace that whole chain of if-elif-else conditions to this:
d=scale(d,level=self.scale,method='peak')
which would make the _normalize method pretty trivial. I didn't do this for two reasons:
I think this shows a need to add a self.scaling_method to the SeismicPlotter class constructor that would allow the scaling to be run like this: d=scale(d,level=self.scale,method=self.scaling_method) . There are other options for scale, but the method is one that should be selectable as you can get very different results with different scaling methods. The "perc" algorithm as used in seismic unix, for example, is known to be useful. What we need really is a default set of arguments for scaling that would make most plots useful without options. Right now that is not true as it is too easy to get a black screen from the wrong scaling. So, I think the group needs to discuss what options we need before I jump in and just fix this crudely.
We need a pytest function for this kind of thing in SeismicPlotter. There is currently no pytest for the graphics module, which is not good. I know no way to test if the graphics functionality in pytest, but we should at least test the exception handlers and functions like _normalize that don't produce graphical output.
An additional change we should make with this bug fix: I strongly recommend we change the default "style" from "wtvaimg" to "wt". It is faster and more conventional to most seismologists.
The text was updated successfully, but these errors were encountered:
I may have fixed this bug in pull request #558 but that needs to be verified before we close this. I know I fixed the issue with dead data but am less confident I fixed this one.
I noticed some time ago that the scale argument for the constructor of the
SeismicPlotter
does nothing. We have workarounds in the tutorials that use thescale
algorithm before calling the plot method. I just looked and the cause of this bug is clear: it is a feature that the comments say was not completed. Here, in fact, is the current section that needs to be fixed:A simple fix is to replace that whole chain of if-elif-else conditions to this:
which would make the
_normalize
method pretty trivial. I didn't do this for two reasons:self.scaling_method
to theSeismicPlotter
class constructor that would allow the scaling to be run like this:d=scale(d,level=self.scale,method=self.scaling_method)
. There are other options for scale, but the method is one that should be selectable as you can get very different results with different scaling methods. The "perc" algorithm as used in seismic unix, for example, is known to be useful. What we need really is a default set of arguments for scaling that would make most plots useful without options. Right now that is not true as it is too easy to get a black screen from the wrong scaling. So, I think the group needs to discuss what options we need before I jump in and just fix this crudely.SeismicPlotter
. There is currently no pytest for the graphics module, which is not good. I know no way to test if the graphics functionality in pytest, but we should at least test the exception handlers and functions like_normalize
that don't produce graphical output.An additional change we should make with this bug fix: I strongly recommend we change the default "style" from "wtvaimg" to "wt". It is faster and more conventional to most seismologists.
The text was updated successfully, but these errors were encountered: