Beispiel #1
0
                        unicode_literals)
from future.builtins import *  # NOQA

import os
import warnings
import pickle
import math
import bisect
import bz2
import numpy as np
from obspy import Trace, Stream
from obspy.core.util import getMatplotlibVersion
from obspy.signal import cosTaper
from obspy.signal.util import prevpow2

MATPLOTLIB_VERSION = getMatplotlibVersion()

dtiny = np.finfo(0.0).tiny

if MATPLOTLIB_VERSION is None:
    # if matplotlib is not present be silent about it and only raise the
    # ImportError if matplotlib actually is used (currently in psd() and
    # PPSD())
    msg_matplotlib_ImportError = "Failed to import matplotlib. While this " \
        "is no dependency of obspy.signal it is however necessary for a " \
        "few routines. Please install matplotlib in order to be able " \
        "to use e.g. psd() or PPSD()."

    # set up two dummy functions. this makes it possible to make the docstring
    # of psd() look like it should with two functions as default values for
    # kwargs although matplotlib might not be present and the routines
Beispiel #2
0
 def lines(self, value):
     if getMatplotlibVersion() < [1, 3, 0]:
         self.__dict__["lines"] = value
     else:
         self.vlines = value
Beispiel #3
0
 def lines(self):
     if getMatplotlibVersion() < [1, 3, 0]:
         return self.__dict__["lines"]
     else:
         return self.vlines
Beispiel #4
0
    GNU Lesser General Public License, Version 3
    (http://www.gnu.org/copyleft/lesser.html)
"""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from future.builtins import *  # NOQA @UnusedWildImport

from matplotlib import mlab
from matplotlib.colors import Normalize
from obspy.core.util import getMatplotlibVersion
import math as M
import matplotlib.pyplot as plt
import numpy as np


MATPLOTLIB_VERSION = getMatplotlibVersion()


def _nearestPow2(x):
    """
    Find power of two nearest to x

    >>> _nearestPow2(3)
    2.0
    >>> _nearestPow2(15)
    16.0

    :type x: float
    :param x: Number
    :rtype: Int
    :return: Nearest power of 2 to x
Beispiel #5
0
 def lines(self, value):
     if getMatplotlibVersion() < [1, 3, 0]:
         self.__dict__["lines"] = value
     else:
         self.vlines = value
Beispiel #6
0
 def lines(self):
     if getMatplotlibVersion() < [1, 3, 0]:
         return self.__dict__["lines"]
     else:
         return self.vlines